Having a pipeline with a few steps that all use caches (gradle, gradlewrapper)
The caches are configured to only be updated when their config files (build.gradle, gradle-wrapper.properties) change.
The problem is that in every build step the build teardown does perform "compression" of the cache, even though it won't be updated.
That adds quite some time to my build.
here's a teardown of a single step:
Assembling contents of new cache 'gradle'
You already have a 'gradlewrapper' cache so we won't create it again
Cache "gradle: ~/.gradle/caches": Cache key d4b80d15320a9f8a8b5d1f2dbaf8f9db40b55f35faa037ab8df457ade969878b
Cache "gradle: ~/.gradle/caches": Compressing
Cache "gradle: ~/.gradle/caches": Compressed in 96 seconds
Cache "gradle: ~/.gradle/caches": Compressed cache size is 245.8 MiB over the 1 GiB upload limit, so the cache will not be uploaded.
Cache "gradlewrapper: ~/.gradle/wrapper": Skipping upload for existing cache
Searching for files matching artifact pattern app/build/reports/**
Artifact pattern app/build/reports/** matched 3 files with a total size of 603.6 KiB
Compressed files matching artifact pattern app/build/reports/** to 79.6 KiB in 0 seconds
Uploading artifact of 79.6 KiB
Successfully uploaded artifact in 0 seconds.
Searching for test report files in directories named [test-results, failsafe-reports, test-reports, TestResults, surefire-reports] down to a depth of 4
Finished scanning for test reports. Found 0 test report files.
Merged test suites, total number tests is 0, with 0 failures and 0 errors.
Hi Christoph and welcome to the community!
Based on your description and also the output you provided here, you are using file-based cache keys for the gradle cache. Is that correct?
This type of cache will be generated again if any of the cache key files is updated or if the cache is not present (it was deleted either automatically or manually).
The error message indicates that the cache failed to upload because it is over the 1 GB limit:
Cache "gradle: ~/.gradle/caches": Compressed cache size is 245.8 MiB over the 1 GiB upload limit, so the cache will not be uploaded.
Only caches under 1 GB once compressed are saved. If that cache still exists and you can see it listed on the Pipelines page of the repo > Caches, I suspect that one of the cache key files was changed in an earlier commit, and Bitbucket now tries to generate a new cache, but since its size is over 1 GB, the upload fails.
I suggest checking if there is a possibility of splitting the cache in two directories and use two cache definitions instead, so that the size of each is less than 1 GB. Please keep in mind that if the same cache key file is used for both caches, then both would be updated when the key file changes.
If that it not possible, then it might be better to stop using the gradle cache, since Bitbucket won't save it as long as it's larger than 1 GB when compressed.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.