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?
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.
Hi there,
Looks like you have a few too many " & "'s in there.
I set my USERNAME environment variable to Atlassian.
With this pipeline
pipelines:
default:
- step:
script:
- 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
I hope that helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.