How to create a key-value Choice Parameter?

Issue

  • I would like to create a key-value Choice Parameter drop-down parameter for jobs

Environment

Resolution

First of all, install the Extensible Choice Parameter Plugin

Access to the job configuration, add a new Extended Choice Parameter and configure it like next image changing the values at your convenience

You can also use property files

The content of the property files would be

NUMBERS-keys.properties

keys=one,two,three

NUMBERS-values.properties

values=1,2,3

Have more questions?

2 Comments

  • 0
    Avatar
    Jussi Hallila

    Note that if values have duplicate values the descriptions don't differ either. This doesn't really achieve proper key-value parameter.

  • 0
    Avatar
    Pramod Nair

    I been trying to use extensible choice parameter to get the list of instance that is available in my AWS account so that I can pass the same to reboot or other day2 activities and thus automating.

    Within Extensible Choice Parameter I used System groovy Choice parameter and wrote below groovy script to get the details :

    ls = "aws ec2 describe-instances --query Reservations[*].Instances[*].{Instance:InstanceId} --region ap-south-1 --output text".execute().text
    def list = ls.readLines()
    return list

    While running this I am not getting any details or list of instances also there is no error in jenkins, while if I am using this script on my server shell it gives me the list. Can you please help me with what could be the reason for this.

Please sign in to leave a comment.