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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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 any interview participants for Bitbucket Data Center

Hi everyone,  We are looking to learn more about development teams’ workflows and pain points, especially around DevOps, integrations, administration, scale, security, and the related challeng...

473 views 5 4
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