Key-Map Variables and Jenkins job parameters

Anyone have any suggestions on how to pass Key-Map variable values to Jenkins using Job Parameters?

I’d like to use the values from an XL-Release key-map inside of a Jenkins task:

Hi , you can try the following syntax:

Unfortunately using this example passes the following to Jenkins:

{breakfast: eggs, lunch: salad, dinner: ratatouille}[lunch]

It doesnt appear to be fully interpolating ${meals}[$mealtime] when being used inside of the Job Parameters section of a Jenkins task.

Here is what I have in my job parameter of Jenkins task:

TEST=${meals}[$mealtime]

also tried the following:

TEST=${meals}[${mealtime}]
TEST=${meals}[’${mealtime}’]
TEST=${meals}[‘lunch’]
TEST=${meals}[lunch]

None of the above is working for me. It will interpolate ${meals} and ${mealtime} but just pass those interpolated values to jenkins as opposed to doing the final interpolation to pass a single value.

UPDATE:

Added a script task before the Jenkins task to dynamically interpolate the value and store it into another release variable. Scrip task included the following:

releaseVariables['mymeal'] = ${meals}['${mealtime}']

I was then able to use the following in my Jenkins task:

TEST=${mymeal}

And jenkins is now receiving the value ‘salad’

This seems extremely tedious. I will have at least 10-15 Key’s that I will need to map to Jenkins parameters which means that I will need to pre-map these keys to release variables in a script task before using them in the Jenkins task

1 Like

HI jfair01, let me investigate a bit more…

Is there no other syntax to be used for example if we have a KEY Value map variable and we want to use the value on another query

${KMVAR}[MYVALUES] ? This is not possible we always have to store it in a variable?

Hi Dan

You are right, adding script tasks / temporary values is currently the way to do it. I agree that this is a bit tedious and we may provide a better way in the future.

Kind regards,

Hes Siemelink
Product Manager, XL Release