Pipelines, Refer to artifact of previous step

I have defined a pipeline with 2 steps: Maven build for war generation and copy war to aws S3.

(project details replaced with 'projectname')


image: maven:3.3.9

- step:
name: war creation
- maven
script: # Modify the commands below to build your repository.
- cd projectname
- mvn -B clean install # -B batch mode makes Maven less verbose
- curl -X POST --user "${BB_AUTH_STRING}" "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"target/project.war"
- $BITBUCKET_CLONE_DIR/projectname/target/project.war
- step:
name: pip install and deploy to s3
image: node:7.5.0
- node
- pip
- apt-get update && apt-get install -y python-dev
- curl -O https://bootstrap.pypa.io/get-pip.py
- python get-pip.py
- pip install awscli --upgrade
- aws --version
- aws --debug --region ap-south-1 s3 cp $BITBUCKET_CLONE_DIR/projectname/target/project.war s3://bucketname/project.war


The WAR file gets created in the first step and i get log entry

-> [INFO] Building war: /opt/atlassian/pipelines/agent/build/projectname/target/project.war

I have used 'artifacts' command to ensure access to project.war in the next step.

But i always get error when accessing the war file in the next step

->RuntimeError: The user-provided path /opt/atlassian/pipelines/agent/build/projectname/target/project.war does not exist.


Is there anything i am not doing properly?


2 answers

0 votes

Hi Pravin,

Can you try replace:

- $BITBUCKET_CLONE_DIR/projectname/target/project.war


- projectname/target/project.war

The artifacts are assumed to already be under the $BITBUCKET_CLONE_DIR. So, you including that is probably resulting is some weird behaviour causing your artifacts to not transfer.

You can also verify the artifact is transferred correct by just verifying the existance of the directory and its container files with some 'ls' commands.



Alternatively, you might need to use

- projectname/target/**
0 votes

Hi @Pravin Prabhu, did you do that? It works?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

688 views 5 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you