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

How properly to create custom dependency cache with file checksum-based hashing?

etreskovskis June 25, 2024

I am trying to use the caches key option to create a custom dependency cache with file checksum-based hashing according these examples:

https://support.atlassian.com/bitbucket-cloud/docs/cache-and-service-container-definitions/#Caches

https://bitbucket.org/blog/announcing-smarter-caches-bitbucket-pipelines

 

definitions:
caches:
pip: ~/.cache/pip
virtualenv: venv
proxies: $BITBUCKET_CLONE_DIR/artifacts/proxies
googleapi:
path: services/google_api/dependencies
key:
files: [ $BITBUCKET_CLONE_DIR/services/google_api/dependencies/dependency.json ]


however the step always fails with error: 

Cache "googleapi: services/google_api/dependencies": Cache key files could not be found.
HOW to solve this issue? Tried different options to provide different format paths for the `path` variable

It works ONLY in this way:

 

definitions:
caches:
pip: ~/.cache/pip
virtualenv: venv
proxies: $BITBUCKET_CLONE_DIR/artifacts/proxies
googleapi: $BITBUCKET_CLONE_DIR/services/google_api/dependencies

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 26, 2024

Hi @etreskovskis  and welcome to the community!

I believe the issue is that you're using an absolute path for the key file. Cache directory paths can be absolute, or relative to the clone directory, but the path to the key files needs to be relative to the clone directory.

Could you try the following definition?

definitions:
caches:
pip: ~/.cache/pip
virtualenv: venv
proxies: $BITBUCKET_CLONE_DIR/artifacts/proxies
googleapi:
path: services/google_api/dependencies
key:
files: [ services/google_api/dependencies/dependency.json ]

Kind regards,
Theodora

etreskovskis June 26, 2024

Great! It worked!!!
image.png

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 28, 2024

That's good to hear, thank you for the update! Please feel free to reach out if you ever need anything else!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events