Reputation: 6131
This is bugging me for a while. In Jenkins I have the correct password. Password looks something like this:
def myPass = 'ZagZS5DMK6$xq26Nx'
Please note the "$" character. Now I want to export that password in to the variable:
--set env.MYSQL_PASSWORD=${mySqlPassword} \
The password looks like this:
ZagZS5DMK6
I was playing around, and I tried using URLencoder
, like this:
--set env.MYSQL_PASSWORD=${URLEncoder.encode(mySqlPassword)} \
And the password is broken still.
What can I do to preserve my password with the special characters?
Upvotes: 0
Views: 2124
Reputation: 27119
The string is being interpreted as ZagZS5DMK6
followed by a variable called $xq26Nx
, which doesn't exist so it expands to an empty string.
Putting single quotes around the string will avoid the $
being interpreted as the beginning of a variable name and will be interpreted literally, instead.
--set env.MYSQL_PASSWORD='${mySqlPassword}'
Upvotes: 1