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

pipelines:
custom:
master:
- step:
name: war creation
caches:
- 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"
artifacts:
- $BITBUCKET_CLONE_DIR/projectname/target/project.war
- step:
name: pip install and deploy to s3
image: node:7.5.0
caches:
- node
- pip
script:
- echo $BITBUCKET_CLONE_DIR
- 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?

 

1 answer

0 vote

Hi Pravin,

Can you try replace:

artifacts:
- $BITBUCKET_CLONE_DIR/projectname/target/project.war

With

artifacts:
- 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.

Thanks,

Phil

Alternatively, you might need to use

artifacts:
- projectname/target/**

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Marketplace Apps

Tips on how to choose the best estimation method for your planning

Planning and grooming sessions all come with their own sets of rules. Team members meet to estimate stories or other work items, all according to an agreed-upon process. And with every session comes ...

65 views 0 11
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