Fetching Bamboo Variable

Above picture shows creation of bamboo variable and accessing inside katalon scripts. But im getting null value.

Hi Sujithra,

Could you provide a detail step to reproduce and how it will affect your work if not fixed?

Chris

you are referencing 2 diferent variables:


you should use

strCred = System.getenv("bambooPass")

in katalon

Hi Andrej,
I tried with that too. I’m getting same value as null. Do i need to change any name of the variable inside it or need to delete any steps in the script? bambooPASS is the variable name and it is not accessing value from the bamboo build

I’m trying to connect Data base. If it is not connected i cannot proceed with the further execution. My scenario is i’ve created a variable in bamboo and that variable is used inside katalon script.when i to run the build the script has to fetch the bamboo bauild variable value and execute it

Can anyone tell the exact steps to fetch the variable from bamboo. Do i need to specify anything in the profile or anywhere?

now i spot just another variable:
in bamboo you are setting bambooPASS
then in bamboo script in docker you are trying to use bamboo_PASS which not exist…
solution:

  1. define bamboo varible katalonDBPassword and set it
  2. in docker starting script use: -e “dbPassword = $bamboo_katalonDBPassword”
  3. in katalon use: str_cred = System.env(“dbPassword”)
    prefix bamboo_ is added automaticaly to each variable defined in bamboo

So how that password that are represented as ******* can be used inside the script? Diid i need to decrypt it or it is actually getting string value?

@sujithra.r you have few mistakes in your setup.

  1. you have the bambooPASS variable set in the plan variable, so you don’t need it again in script Evironment Variables (bottom right in your pic). remove it from there, leave it only in the plan variable.
  2. you are passing the variable to the docker container with a wrong syntax, bash won’t expand it properly
    you did: -e "bambooPASS=$bamboo_bambooPASS"
    must be: -e bambooPASS=${bamboo_bambooPASS} (i am using the curly brackets too just as a good practice)
    explanation: you have to expose the bambooPass variable in the container, passing to it the value of the bamboo_bambooPASS variable (or you can use bamboo.bambooPASS too).
  3. as already pointed, now you should have bambooPASS (not bamboo_bambooPASS or bambooPass) as environment variable in the container so the System.getenv("bambooPass") line must be fixed accordingly.

no, are masked only in the bamboo logs for security reasons but the values are properly passed if you use the right syntax.