I have a bitbucket-pipelines.yml file actually steps are working good. But what I want to do is deploy the backend jar after build is finished. But as you see build image and ubuntu image are in different steps and I cannot integrate them together.
# This is an example Starter pipeline configuration
pipelines:
default:
- step:
name: 'Frontend Build'
image: node:16.4.2
script:
- cd frontend
- npm install
- step:
name: 'Backend Build and Package'
image: maven:3.8.3-openjdk-17
script:
- cd backend
- mvn clean package
- step:
name: 'Deploy'
image: ubuntu:16.04
script:
- apt-get update
- apt-get install curl -y
- apt-get install sshpass -y
- sshpass -f "sshkey.pub" scp backend/target/backend-0.0.1-SNAPSHOT.jar root@164.65.55.278:/root/artifacts2
If I put build and deploy steps togetger as follows:
- step:
name: 'Deploy'
image: ubuntu:16.04
script:
- apt-get update
- apt install maven
- apt install -y openjdk-17-jdk
- cd backend
- mvn clean package
- apt-get install curl -y
- apt-get install sshpass -y
- sshpass -f "sshkey.pub" scp backend/target/backend-0.0.1-SNAPSHOT.jar root@167.71.54.246:/root/artifacts2
Then I get storage error:
Need to get 65.5 MB of archives.
After this operation, 175 MB of additional disk space will be used.
Do you want to continue? [Y/n] Abort.
If I don't put deploy in same step with build then it cannot find the jar file... How can I achieve this in different steps ?