You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I want to cache dependencies per branch, therefore I create a text file containing the branch number
definitions:
steps:
- step: &prepare
name: prepare environment
script:
- echo ${BITBUCKET_BRANCH} > branch.txt
artifacts:
- branch.txt
But I'm unable to use branch.txt in the cache definitions. I tried this:
caches:
node-modules:
key:
files:
- branch.txt
path: node_modules/
How can I achieve this?
Hi Nathan and welcome to the community!
It is not possible to use an artifact as a cache key file. The cache key file needs to be committed in the Bitbucket Cloud repo.
Please keep in mind that even if you commit such a file in the repo, editing it during the Pipelines build will not generate a new cache. The file needs to be changed in a commit of the repo in order for the new cache to be generated. This approach has the following drawback though:
Could you please share why you are looking to cache dependencies per branch?
For node, if you specify for example the package.json file as a cache key file, and you change the dependencies in package.json in feature/a branch, then a new cache will be generated.
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.