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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Can a cache be used instead of artefacts?

When I am using a cache:

 

1) can I specify a cache to be used by a pipeline entirely (eg: it will be automatically used by all steps)

2) if 2 steps use the same cache and step 1 makes changes to the cached data, will step 2 receive the updated cache or the cache state under which the pipeline originally started?

 

Thanks

1 answer

1 vote
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 12, 2023

Hello @Andrei Dascalu , thank you for reaching out to Community!

Caches in Bitbucket Pipelines are defined at the step level, meaning that for each step you want to use cache, you will need to define it directly in the step 

pipelines:
  default:
    - step:
        caches:
          - node
        script:
          - npm install

There's not currently a global option to enable cache for all the steps.

As for your second question, just bring some context on how Bitbucket pipeline caches work, when you define a cache in Bitbucket pipeline, it will generate a cache the first time the build is successful.

Once the cache is generated, it will be available for the next 7 days. During that 7-day period, any new build you trigger will download the previously generated cache during the Build Setup phase.

After 7 days, the cache will be automatically deleted, and a new fresh cache will be generated in the following successful build. You can expedite the cache refresh by manually deleting the cache in the Pipelines page > Cache button in the top right > click on the trash icon.

Another option is to use smart caches, also known as caching with file-based cache-keys , where the cache will be automatically refreshed based on the file(s) in the repository that is(are) defined as the key. Any changes to those key file(s) would result in a new cache.

You can also find more details about pipeline caches in the following article :

Hope that helps! Let me know in case you have any questions.

Thank you, @Andrei Dascalu !

Patrik S

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events