Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


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
Community Members
Community Events
Community Groups

Can't access environment variable

I'm trying to set up CI with Bitbucket pipelines, using a custom Docker image. I need maven to run with an environment variable but I can't get the build script to read the value of this variable. The script is:

echo "'$USERNAME'" && mvn -Dusername="'$USERNAME'" -Dpassword=. package

But then instead of getting the value of the USERNAME variable echoed I get "'$USERNAME'". Same if I echo only $USERNAME or "$USERNAME". How can I fix this?

2 answers

Same issue, unfortunately for this situation we need disable the secured flag. For password and username it works if pass directly without '' or "" but for url that bitbucket needs to pass using " " it doest work as expected. 

0 votes

Hi there,

Looks like you have a few too many " & "'s in there.

I set my USERNAME environment variable to Atlassian.

Screenshot 2018-03-19 13.31.19.png 

With this pipeline

- echo $USERNAME
echo '$USERNAME'

Note: when you type this in, it may try and suggest other environment variables. Don't worry and just keep typing the one you want. :)

I get the return

Screenshot 2018-03-19 12.45.23.png

I hope that helps!

I finally understood my mistake. The variable I wanted was secured and I didn't realize that Bitbucket will print VARIABLE_NAME instead of its value in that case. Another look at the manual made that clear. Thanks for helping out!

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events