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

Bitbucket Pipelines Not Creating New Cache for Different Branches (File based cache key)

Uday Siramdasu
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 14, 2024

 

Hello everyone,

I'm experiencing an issue with Bitbucket Pipelines where it isn't creating a new version of the cache for different branches, even though the package-lock.json file is different in each branch. Instead, it seems to be using the same cache across all branches.

Here's the cache configuration I'm using:

caches:
  node-server:
    key:
      files:
        - server/package-lock.json
    path: server/node_modules

  node-ui:
    key:
      files:
        - package-lock.json
    path: node_modules

 

In each branch, the package-lock.json files differ, so I expect Bitbucket to create a new cache for each branch. However, it keeps reusing the same cache, which causes build issues.

The cache keys are based on the package-lock.json contents, but Bitbucket isn't generating a new cache for each branch as expected.

Has anyone faced this issue? Any suggestions on how to ensure a new cache version is created for each branch when package-lock.json changes?

Thanks in advance!

1 answer

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

Hi Uday and welcome to the community!

I cannot reproduce the issue you are reporting. One thing to check is whether you have these file-based cache definitions in the bitbucket-pipelines.yml file of each of the affected branches.

When you open the Source page of the repo on Bitbucket's website, you will see the source code of the repo's main branch. There is a dropdown with the branch name right above the the list of files and directories. Can you switch the branch and then check the bitbucket-pipelines.yml file of each of the affected branches and see if the same cache definition is in all of them?

If that looks ok, we will need to look at the build logs to figure out what is happening and we need a support ticket for that. You can create a ticket via https://support.atlassian.com/contact/#/, in "What can we help you with?" select "Technical issues and bugs" and then Bitbucket Cloud as product. When you are asked to provide the workspace URL, please make sure you enter the URL of the workspace that is on a paid billing plan to proceed with ticket creation.

Please provide in the ticket the URL of two builds on different branches using the same cache so we can further investigate. The support ticket will be visible only to you and Atlassian staff, so anything you post there won't be publicly visible.

Kind regards,
Theodora

Suggest an answer

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

Atlassian Community Events