1

Hello I want the following behaviour.

A want my job to be parametrized. The thing is that I want to select a unique parameter with multiple values.

I have a unique parameter named number with 2 options (1, 2) and then set of values linked to each option:

Parameter name: var

Options:

1

2

Let´s say:

  • One set of values:
  • value1: "1.0.0"
  • value2: "myname"
  • value3:"build/libs"
  • Another set of values:
  • value1: "2.0.0"
  • value2: "myname2"
  • value3: "var/lib"

In the "Build section" I select "Execute shell" with the following lines:

echo ${var.value1}
echo ${var.value2}
echo ${var.value3}

So when building the job I would like to select from a dropdown list with 2 values as said above: 1 and 2.

If I select 1, I would like to take the first set of values so that it would dislplay:

1.0.0
myname
build/libs

On the other hand if I select 2, I would like to display the second set of values:

2.0.0
myname2
var/lib

I have tried "Extended Choice Parameter plugin" but I don´t know how to manage this situation.

Thank you.

1

My suggestion is to set job parameterized with two options, and just set up variables in the Shell Build step, like this:

if [ "$VAR" == "1" ]; then
    value1="1.0.0"
    value2="myname"
    value3="build/libs"
elif [ "$VAR" == "2" ]; then
    value1="2.0.0"
    value2="myname2"
    value3="var/lib"
fi

echo ${var.value1}
echo ${var.value2}
echo ${var.value3}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.