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
pipelines:
default:
- step:
name: Build and Test
script:
- echo "Cloning..."
artifacts:
- ./**
- parallel:
- step:
name: Install build
clone:
enabled: false
caches:
- build
script:
- npm install
- step:
name: Install app
clone:
enabled: false
caches:
- app
script:
- cd app
- npm install
- npm run lint
- npm run build
- step:
name: Deploy
clone:
enabled: false
caches:
- build
script:
- node ./bin/deploy
definitions:
caches:
app: ./app/node_modules
build: ./node_modules