Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Variable substitution in script and artifacts sections

David I'm New Here May 06, 2021

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

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

262 views 2 10
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you