Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Gradle caches not restored to expected location

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

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?

@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.

@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
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

2,585 views 1 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you