Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Skip a pipeline step if it's already cached

Edited

I'm new to pipelines. I have an application which I am trying to write a pipeline for which has client files in another repository. I already have a step working which can download and install dependencies, which takes some time so I want to cache the built client files after npm install.

It seems to be pulling from cache just fine, but it still runs the step which causes an error because the files already exist. How do I skip this step if it's already been cached?

Here is my pipeline only with the step I'm caching:

image: atlassian/default-image:2
pipelines:
branches:
staging:
- step:
name: client setup
image: node
caches:
- client
script:
- cd ../
- git clone git@bitbucket.org:myorg/client-repo.git
- cd client-repo
- git checkout staging
- npm install
definitions:
caches:
client: ../client-repo

The client setup step works the first time I try it, but the clone fails the second time because the client repo folder already exists. How do I make it skip this entire step if it's been pulled from cache?

1 answer

1 accepted

0 votes
Answer accepted

Nevermind I figured out how cache actually works now.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

⭐ Calling all Bitbucket and DevOps experts: Special showcase opportunity ⭐

Hi, Bitbucket community! Are you a DevOps practitioner (or know one in your network)? Do you have DevOps tips, tricks, or learnings you'd like to share with the community? If so, we'd love to hea...

1,527 views 4 8
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you