Details
-
Type:
Task
-
Status: Closed (View Workflow)
-
Priority:
Major
-
Resolution: Done
-
Component/s: extended-choice-parameter-plugin
-
Labels:None
-
Similar Issues:
Description
I have added an extended choice paramter. Now the source values are lin1, lin2, lin3 as listed in screenshot
now when I run, If I select lin1 then I get param3 = lin1,
If I select lin1 and lin2 then I get param2 - lin1,lin2 ( delimiter is comma )
The question here is, inside jenkins pipeline how can get what all source values were set when the param was created. In short, without selecting any of the checkboxes, want to get the list of the possible values probably in a list
Eg: list1 = some_method(param3) // expected output >> list1 = [lin,lin2,lin3]
Let me know if this description is not clear.
Attachments
Activity
Field | Original Value | New Value |
---|---|---|
Assignee | vimil [ vimil ] | Abhijeet Zope [ azee77 ] |
Resolution | Done [ 10000 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
Solution:
import hudson.model.*
import org.jenkinsci.plugins.workflow.job.*
def job = getJob(JOB_NAME)
def allWindows = getParam(job, "Windows").getValue()
// allWindows will have all the source values
def getJob(name)
{ def hi = Hudson.instance return hi.getItemByFullName(name, Job) }def getParam(WorkflowJob job, String paramName) {
{ return param }def prop = job.getProperty(ParametersDefinitionProperty.class)
for (param in prop.getParameterDefinitions()) {
if (param.name == paramName)
}
return null
}