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

Password variable contains backticks, substitution fails in deployment plans Edited

Say my MySQL password looks like this

T#`DEAE&H29r23328h23c@#X21

which contains a backtick. Of course, it might contain a " or ' or $ or other expandable sequence.

When variable substitution occurs in a deployment plan

MYSQL_PASSWORD=********

 I get this error

error 20-Nov-2019 13:47:21 bash: -c: line 11: unexpected EOF while looking for matching ``' error
20-Nov-2019 13:47:21 bash: -c: line 37: syntax error: unexpected end of file

How can I ensure that variables are safely substituted in deployment (and, presumably, build) plans and ensure they are not interpreted?

Of course, I could create only alphanumeric passphrases, but that reduces entropy somewhat and I don't want to limit our infrastructure configuration. Do I need to use Bamboo Specs or something?

We're running self-hosted Bamboo version 6.3.4 build 60309 - 24 May 18

1 answer

Hi @Michael

Thank you for raising this question.

Global, plan and deployment variables can be evaluated in tasks by using the following format: 

${bamboo.<variableName>}

Please notice that this evaluation takes place before the task is executed.

Let's suppose you are adding the following line in your inline script:

VAR1=${bamboo.myVariable}

Before bash is called the variable is already substituted and you have the error mentioned.

...bash: -c: line 11: unexpected EOF while looking for matching...


How to avoid this?

Use a different variable formating.

We have two ways to mention a variable:

  1. ${bamboo.<variableName>}
    Evaluated before the build
  2. $bamboo_<variableName>
    Available  only when the bash script is run

 

How to move forward?

Please use the second format in inline scripts. It will prevent anomalies caused by strange characters that may be part of your variables.

Another option is to make sure the content of your variables is surrounded by single quotes ( 'content' ).

 

I hope that helps 

It does; thank you!

One clarification: how should I use Bamboo variables that have dots in their names, like `bamboo.deploy.environment` ?

$bamboo_deploy_environment 

or

$bamboo_deploy.environment 

?

Presumably I should convert all `.` to `_` ?

Yes, convert all of them to underscores "_".
You should be able to see all the variables available in your build log file.
Try to search for one that you know and you should find all of them together.

=]

Suggest an answer

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

Bamboo 101 Video

G’day Community! As we gear up to introduce Bamboo Data Center to the world, we wanted to make sure that we shared a bit more about Bamboo, the product. Our team has put together an overview video ...

203 views 4 6
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