Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Copy files from repo to nodemodules of ci pipeline

Deleted user February 23, 2023

I am trying to copy @jsplumbtoolkit @jsplumb libraries into node modules folder of ci pipeline on 2nd step and pass that node_modules to third step for angular build. But not able to.

please suggest changes on step two.

 

Angular pipeline :-

image: node:16

pipelines:
   branches:
      ci-cd-test-branch:

       - step:
             name: Installation
             caches:
                  - node
              script:
                  - npm install
              artifacts:
                  - node_modules/** # Save modules for next steps

        - step:
              name: copy jsplumb to node modules artifact
               script:
                   - cp -r @jsplumbtoolkit @jsplumb node_modules/

         - step:
              name: Build
              script:
                 - npm run build:prod
              artifacts:
                 - dist/** # Save build for next steps

2 answers

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 24, 2023

Hi @[deleted]!

Since node_modules/** is defined as an artifact in the first step only, only the contents of node_modules in the first step will be saved.

You have two options here:

  1. Either use the same artifacts definition in the second step as well
  2. Or combine the two steps into one, as Erez suggested

The second option might make more sense:

For every step in your bitbucket-pipelines.yml file, a Docker container starts based on the image you have specified, the Bitbucket repo is cloned in that container, then the commands of that step's script are executed, and eventually, the container gets destroyed. You may not want to use a separate step, and thus spin up a new container, only to execute a copy command.

If you have any questions, please feel free to let us know!

Kind regards,
Theodora

0 votes
Erez Maadani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 23, 2023

Hey @[deleted] 

Try moving the copy to the first step.

Hope that helps 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events