Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Gradle caches not restored to expected location

Anders Sveen
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 2, 2020

I am setting up a gradle cache to enable faster builds. It seems (they are listed under caches as well) the cache is stored, but I really can't find the restored cache when running subsequent steps.

How can this be? The build setup outputs even says it downloads the cache and unpacks it.

My setup is something like this:

pipelines:
default:
- parallel:
- step:
name: Build and Test
caches:
- gradle
- gradlewrapper
script:
- export TESTCONTAINERS_RYUK_DISABLED=true
- ls -lah
- ./gradlew --build-cache --no-daemon stage
services:
- docker
after-script:
- pipe: atlassian/checkstyle-report:0.2.0
- step:
name: Security Scan
script:
# Run a security scan for sensitive data.
# See more security tools at https://bitbucket.org/product/features/pipelines/integrations?&category=security
- pipe: atlassian/git-secrets-scan:0.4.3
- step:
name: Build and publish docker image
size: 2x
caches:
- docker
- gradle
- gradlewrapper
script:
- *docker_build_variables_anchor
- ls -lah .
- docker build -t $IMAGE_NAME .
- docker tag $IMAGE_NAME $IMAGE:master
- docker push $IMAGE_NAME
- docker push $IMAGE:master
services:
- docker

definitions:
caches:
gradlewrapper: ~/.gradle/wrapper

The "ls -lah ." steps above shows no ".gradle" folder on the paths. Even though the build setup for each steps says this:

Cache "docker": Downloading
Cache "docker": Downloaded 623.7 MiB in 7 seconds

Cache "docker": ExtractingCache "docker": Extracted in 7 seconds
Cache "gradle": Downloading
Cache "gradle": Downloaded 190.9 MiB in 2 seconds
Cache "gradle": Extracting
Cache "gradle": Extracted in 2 seconds
Cache "gradlewrapper": Downloading
Cache "gradlewrapper": Downloaded 196.1 MiB in 3 seconds
Cache "gradlewrapper": Extracting

Cache "gradlewrapper": Extracted in 1 seconds

Am I misundestanding where the folders should end up? Thanks... 

1 answer

0 votes
Anders Sveen
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 2, 2020

From messing around a bit, it seems the gradlewrapper cache is working in the first step (it doesn't re-download when starting). So something is working. How does it find the distrubution without the .gradle/wrapper folder existing?

Alan Guerin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 12, 2020

@Anders Sveen - I'm having a similar issues, and I've tried a number of things to try to work around this without success. I've raised a support issue with Atlassian, and will update here when/if they respond.

Alan Guerin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 12, 2020

@Anders Sveen - After a few more attempts to resolve this, purging the existing caches seems to have fixed it. Go to Pipelines > Caches (top right of screen), and delete the dependency caches. Re-run your pipeline, and the caching should work.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events