Set Jenkins prompt variables using a scripts output
-
07-07-2021 - |
Question
I have a script: ScriptA.bat or ScriptA.sh
I want to call this script from Jenkins interface i.e. using a job. Script needs parameters (where values of that parameter can change dynamically at the backend).
i.e. Jenkins JobScriptA got created which calls this scriptA with 3 parameters that scriptA expects i.e. JobScriptA is set to use "This build is paramterized" setting.
To create the parameters if the script takes 3 parameters, first being a simple text box, 2nd being a listbox containing N number of values in it. These two are easy to setup as first can be set as string/password/text parameter and 2nd can be set as CHOICE parameter type.
OK my ? is: for the 3rd paramter I want. The values for this parameter are similar to "2nd" but I dont know the values i.e. they are not static like being "AAAA" or "BBBB". I have a script "script_param3.sh or .bat" and what I'm wondering is DOES Jenkins support getting the output of "script_param3.sh/.bat" as the list of CHOICE values so that I can set param3 to take that output as its possible values. Sometime script_param.sh/.bat will generate:
- 1
- 2
- 3
- 4
- 5
and sometimes it might generate
- 12
- 33
- 232
- 3
- 21
so.. as I mentioned above, param3 totally depends upon what script_param3.sh/.bat outputs.
How can I achieve this in Jenkins parameter prompt interface.
Any idea!