Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,364,932
Community Members
 
Community Events
168
Community Groups

Variable substitution in script and artifacts sections

I've just started working on a Bitbucket Pipeline for one of our test environments and I cant quite seem to figure out how to substitute an env variable into the zip script line in this block below. I've tried the standard "$ZIP_FILE_NAME" which works on a Linux machine but doesnt work in bitbucket pipelines. It is worth noting that the echo $ZIP_FILE_NAME DOES output the correct value. How do I substitute the $ZIP_FILE_NAME value into the 'zip' command in the last script line below.

Also, with the artifacts section, I'm not sure if its even possible to use a variable value as the name of an artifact?

step:
namePackage
script:
apt-get update
apt-get install -y zip
cp deploy/AppSpec-uat.yml deploy/AppSpec.yml
BASE_PACKAGE_VERSION=$(node -pe "require('./package.json').version")
      - echo $BASE_PACKAGE_VERSION
      - FULL_PACKAGE_VERSION="$BASE_PACKAGE_VERSION.$BITBUCKET_BUILD_NUMBER"
      - echo $FULL_PACKAGE_VERSION
      - ZIP_FILE_NAME="uat-$FULL_PACKAGE_VERSION.zip"
      - echo $ZIP_FILE_NAME
      - zip -r "$ZIP_FILE_NAME" dist/** deploy/AppSpec.yml
    artifacts:
    - package.json
      - $ZIP_FILE_NAME

 Any help/advice would be much appreciated.

Thanks

1 answer

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events