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

Your Points Tracker
  • 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
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?
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

How do I approach environment variables in continuous integration via pipelines? was my first introduction to CI. I love that per branch I can assign environment variables so that with each push the branch deployment responds to its respective environment values.

I am now moving away from and trying to set up my own CI. Of course, I do not want every branch to be deployed using production variables and at the same time, I do not want to create variables named {BRANCH}_SSH_USER. I'd much prefer to have one variable called SSH_USER and have each branches value be different so that my deployment script does not have to be hardcoded to MASTER_SSH_USER or STAGING_SSH_USER.

Am I approaching this the wrong way? If so, how should I be?

1 comment

Hi Tyler I faced a similar situation and ended up doing some workaround, see if it works for you. I created a json environment variable named SSH_USER with value: 

{ "SSH":{"development": { "user": "devuservalue"}, "staging": {"user": "staginguservalue"}}}

This value was set with Secured attribute set; then I user jq to read the value according to the current branch.

sshuser=$(echo $SSH_USER | jq -r ".SSH.${BITBUCKET_BRANCH}.user")

and that did the trick for me, I have a single env variable for any branch, and can be read in a "contextual" manner with the current branch value.


Log in or Sign up to comment
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...

327 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