Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Bitbucket pipeline reuse source code from previous step Edited

Son Le I'm New Here Jun 01, 2021

Basically, I don't want pipeline step clone code on next steps, only first step will clone the source code a time. Another reason is if step clone the source code (and doesn't use the source code from previous) the built code will be lost.

I known that the bitbucket pipeline has the artifacts feature but seems it only store some parts of the source code.

The flow is:

Step 1: Clone source code. Step 2: Run in parallel two steps, one install node modules at root folder, one install node module and build js, css at app folder. Step 3: Will deploy the built source code from step 2.

Here is my bitbucket-pipelines.yml

image: node:11.15.0

    - step:
        name: Build and Test
          - echo "Cloning..."
          - ./**
    - parallel:
      - step:
          name: Install build
            enabled: false
            - build
            - npm install
      - step:
          name: Install app
            enabled: false
            - app
            - cd app
            - npm install
            - npm run lint
            - npm run build
    - step:
        name: Deploy
          enabled: false
          - build
          - node ./bin/deploy

    app: ./app/node_modules
    build: ./node_modules


1 answer

0 votes

Hi @Son Le and welcome to the community.

I'm afraid that this is not possible at the moment.

Every step in in a yml file runs a separate Docker container. We had a request from another user regarding the same issue (their use case was different than yours, but the request was essentially the same):

I am quoting Matt Ryall's response in that request:

We looked at the idea of copying the clone between steps, but it was in fact slower. Because we want to be able to resume steps at any point in the next week (to support manual steps), any data passed between steps needs to be on persistent storage (S3 for us). Uploading data to S3 between steps is costly and time-consuming, and resulted in the pipeline running slower than if we cloned from Bitbucket at the start of each step. So we minimise the data passed between steps to just the declared artifacts.

Regarding what you mentioned here:

Another reason is if step clone the source code (and doesn't use the source code from previous) the built code will be lost.

You can make use of artifacts to pass any files you generate during a step to the next step:

If not all the files you generate are stored in artifacts, please let me know and we can look further into it.

We'd need to know:

- the files you want to save as artifacts and their place in the directory structure
- how you define artifacts in your yml file
- which files are missing from the next steps

Kind regards,

Suggest an answer

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

Bitbucket Pipelines Runners is now in open beta

We are excited to announce the open beta program for self-hosted runners. Bitbucket Pipelines Runners is available to everyone. Please try it and let us know your feedback. If you have any issue...

2,329 views 50 18
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