[JIRA] (JENKINS-42723) Fix form fields for active choices parameters when triggering builds via the parameterized trigger plugin

15 views
Skip to first unread message

thefriendlycoder@gmail.com (JIRA)

unread,
Mar 13, 2017, 12:52:01 PM3/13/17
to jenkinsc...@googlegroups.com
Kevin Phillips created an issue
 
Jenkins / Bug JENKINS-42723
Fix form fields for active choices parameters when triggering builds via the parameterized trigger plugin
Issue Type: Bug Bug
Assignee: Bruno P. Kinoshita
Components: active-choices-plugin, parameterized-trigger-plugin
Created: 2017/Mar/13 4:51 PM
Priority: Major Major
Reporter: Kevin Phillips

I recently discovered that jobs which contain parameter types supported by the Active Choices plugin don't get rendered correctly when using the parameterized trigger plugin.

More specifically, when accessing the <JOB_URL>/parambuild/ URL for a particular job form elements provided by Active Choices parameters are rendered as plain-text parameters instead of their correct types. For example, choice parameters with drop down lists appear as text entry fields with no drop-down list at all.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

thefriendlycoder@gmail.com (JIRA)

unread,
Mar 13, 2017, 12:56:02 PM3/13/17
to jenkinsc...@googlegroups.com
Kevin Phillips updated an issue
Change By: Kevin Phillips
Attachment: Screen Shot 2017-03-13 at 1.53.47 PM.png
Attachment: Screen Shot 2017-03-13 at 1.54.09 PM.png
Attachment: Screen Shot 2017-03-13 at 1.54.36 PM.png

thefriendlycoder@gmail.com (JIRA)

unread,
Mar 13, 2017, 12:59:01 PM3/13/17
to jenkinsc...@googlegroups.com
Kevin Phillips commented on Bug JENKINS-42723
 
Re: Fix form fields for active choices parameters when triggering builds via the parameterized trigger plugin

I attached some screen shots illustrating the problem. A simple choice parameter with a list of choices generated by a groovy script. When using the /build URL for the job, the choices are rendered correctly. When using the /parambuild URL they are not. When the parameter type is 'active choices parameter' it appears as though the Groovy script does get executed but only the first choice from the list appears in the text entry field. When the parameter type is 'active choices reactive parameter' the form element is still rendered as a text entry field but there is no default value provided.

sebastien.bonami@gmail.com (JIRA)

unread,
Aug 1, 2018, 3:11:02 PM8/1/18
to jenkinsc...@googlegroups.com

Hi, I have the exact same problem. Have you find a solution / workaround Kevin Phillips or Bruno P. Kinoshita?

This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)

sebastien.bonami@gmail.com (JIRA)

unread,
Dec 5, 2018, 2:51:08 PM12/5/18
to jenkinsc...@googlegroups.com
Sebastien Bonami updated an issue
 
Change By: Sebastien Bonami
Comment: Hi, I have the exact same problem. Have you find a solution / workaround [~leedega] or [~kinow]?
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

batek.nowak@yahoo.pl (JIRA)

unread,
May 29, 2019, 10:53:02 AM5/29/19
to jenkinsc...@googlegroups.com

batek.nowak@yahoo.pl (JIRA)

unread,
May 29, 2019, 10:54:01 AM5/29/19
to jenkinsc...@googlegroups.com

batek.nowak@yahoo.pl (JIRA)

unread,
May 29, 2019, 10:54:03 AM5/29/19
to jenkinsc...@googlegroups.com

batek.nowak@yahoo.pl (JIRA)

unread,
May 29, 2019, 10:58:02 AM5/29/19
to jenkinsc...@googlegroups.com

batek.nowak@yahoo.pl (JIRA)

unread,
May 29, 2019, 11:00:02 AM5/29/19
to jenkinsc...@googlegroups.com
Bartosz Nowak commented on Bug JENKINS-42723
 
Re: Fix form fields for active choices parameters when triggering builds via the parameterized trigger plugin

I got similar behavior with Extensible Choice Parameter v1.6.0. It looks like groovy script is executed after trigger and thats why builds are unable to find this prams. When i execute it manually everything is working as suppose to.  

 

Passed Params from triggering job: (missing SELECTED_RESOURCE_LABEL and SELECTED_BUILD)

 

Error Log:

 

Started by timer Obtained pipeline_confs/test_all from git g...@gitlab01.sprc.samsung.pl:m.chomiak/mdm-repo.git Running in Durability level: MAX_SURVIVABILITY [Pipeline] Start of Pipeline [Pipeline] End of Pipeline groovy.lang.MissingPropertyException: No such property: SELECTED_RESOURCE_LABEL for class: groovy.lang.Binding at groovy.lang.Binding.getVariable(Binding.java:63) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:270) at org.kohsuke.groovy.sandbox.impl.Checker$6.call(Checker.java:289) at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:293) at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:269) at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:29) at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20) at WorkflowScript.run(WorkflowScript:56) at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.call(ModelInterpreter.groovy:60) at WorkflowScript.run(WorkflowScript:1) at ___cps.transform___(Native Method) at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:74) at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30) at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66) at sun.reflect.GeneratedMethodAccessor314.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72) at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21) at com.cloudbees.groovy.cps.Next.step(Next.java:83) at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174) at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163) at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129) at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268) at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51) at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:174) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:347) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:259) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:247) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Finished: FAILURE

 

 

How it should look like:

 

Triggered Pipeline Params

 

parameters { 
extendedChoice name: 'SELECTED_RESOURCE_LABEL', bindings: '', description: 'Select test device from accessible resources', groovyClasspath: '', multiSelectDelimiter: ',', quoteValue: false, saveJSONParameterToFile: false, type: 'PT_SINGLE_SELECT', visibleItemCount: 5, groovyScript: ''' import org.jenkins.plugins.lockableresources.LockableResourcesManager return new ArrayList<String>(LockableResourcesManager.get().getAllLabels());'''
extendedChoice name: 'SELECTED_BUILD', description: 'Job from rpms are taken', type: 'PT_SINGLE_SELECT', bindings: '', groovyClasspath: '', multiSelectDelimiter: ',', quoteValue: false, saveJSONParameterToFile: false, visibleItemCount: 5, groovyScript: ''' import jenkins.* import jenkins.model.* import hudson.* import hudson.model.* def projList = Jenkins.instance.getAllItems(AbstractItem.class).name projList.removeAll { it.contains("label=") }; projList.removeAll { !it.contains("build") }; return projList;'''
booleanParam name: 'FLASH', defaultValue: false, description: "Re-flash device with clean image"
booleanParam name: 'RUN_TESTS', defaultValue: false, description: "Disable tests for projects which don't has any tests specified yet"
booleanParam name: 'INSTALL_RPMS', defaultValue: true, description: "Allows you to bypass the installation process"
}

 

Triggering Pipeline Prams and Steps

environment { TRIG_PROJECT_NAME = "build" }
 
parameters { 
booleanParam name: 'FLASH', defaultValue: false, description: "Re-flash device with clean image" 
booleanParam name: 'INSTALL_RPMS', defaultValue: true, description: "Allows you to bypass the installation process" 
booleanParam name: 'RUN_TESTS', defaultValue: false, description: "Disable tests for projects which don't has any tests specified yet" 
}
agent none triggers { upstream threshold: hudson.model.Result.SUCCESS, upstreamProjects: '${TRIG_PROJECT_NAME}' } 
stages { 
stage('run job') { 
steps { build job: 'test_ad_hoc', 
parameters: [ 
extendedChoice(name: 'SELECTED_RESOURCE_LABEL', value: 'device'), 
extendedChoice(name: 'SELECTED_BUILD', value: "${TRIG_PROJECT_NAME}"), 
booleanParam(name: 'FLASH', value: "${FLASH}"), 
booleanParam(name: 'RUN_TESTS', value: "${RUN_TESTS}"), 
booleanParam(name: 'INSTALL_RPMS', value: "${INSTALL_RPMS}") ] 
} 
} 
}
 

 

 

 

batek.nowak@yahoo.pl (JIRA)

unread,
May 29, 2019, 11:01:02 AM5/29/19
to jenkinsc...@googlegroups.com
Bartosz Nowak edited a comment on Bug JENKINS-42723
I got similar behavior with Extensible Choice Parameter v1.6.0 and Pipeline Build Step Plugin 2 . 9. It looks like groovy script is executed after trigger and thats why builds are unable to find this prams. When i execute it manually everything is working as suppose to.  

 

*Passed Params from triggering job: (missing SELECTED_RESOURCE_LABEL and SELECTED_BUILD)*

!Test_ad_hoc.png!

 

*Error Log:*

 
{code:java}

Started by timer Obtained pipeline_confs/test_all from git g...@gitlab01.sprc.samsung.pl:m.chomiak/mdm-repo.git Running in Durability level: MAX_SURVIVABILITY [Pipeline] Start of Pipeline [Pipeline] End of Pipeline groovy.lang.MissingPropertyException: No such property: SELECTED_RESOURCE_LABEL for class: groovy.lang.Binding at groovy.lang.Binding.getVariable(Binding.java:63) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:270) at org.kohsuke.groovy.sandbox.impl.Checker$6.call(Checker.java:289) at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:293) at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:269) at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:29) at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20) at WorkflowScript.run(WorkflowScript:56) at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.call(ModelInterpreter.groovy:60) at WorkflowScript.run(WorkflowScript:1) at ___cps.transform___(Native Method) at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:74) at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30) at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66) at sun.reflect.GeneratedMethodAccessor314.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72) at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21) at com.cloudbees.groovy.cps.Next.step(Next.java:83) at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174) at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163) at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129) at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268) at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51) at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:174) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:347) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:259) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:247) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Finished: FAILURE
{code}
 

 

*How it should look like:*

!Proper.png!

 

*Triggered Pipeline Params*

 
{code:java}

parameters {
extendedChoice name: 'SELECTED_RESOURCE_LABEL', bindings: '', description: 'Select test device from accessible resources', groovyClasspath: '', multiSelectDelimiter: ',', quoteValue: false, saveJSONParameterToFile: false, type: 'PT_SINGLE_SELECT', visibleItemCount: 5, groovyScript: ''' import org.jenkins.plugins.lockableresources.LockableResourcesManager return new ArrayList<String>(LockableResourcesManager.get().getAllLabels());'''
extendedChoice name: 'SELECTED_BUILD', description: 'Job from rpms are taken', type: 'PT_SINGLE_SELECT', bindings: '', groovyClasspath: '', multiSelectDelimiter: ',', quoteValue: false, saveJSONParameterToFile: false, visibleItemCount: 5, groovyScript: ''' import jenkins.* import jenkins.model.* import hudson.* import hudson.model.* def projList = Jenkins.instance.getAllItems(AbstractItem.class).name projList.removeAll { it.contains("label=") }; projList.removeAll { !it.contains("build") }; return projList;'''
booleanParam name: 'FLASH', defaultValue: false, description: "Re-flash device with clean image"
booleanParam name: 'RUN_TESTS', defaultValue: false, description: "Disable tests for projects which don't has any tests specified yet"
booleanParam name: 'INSTALL_RPMS', defaultValue: true, description: "Allows you to bypass the installation process"
}
{code}
 

*Triggering Pipeline Prams and Steps*
{code:java}

environment { TRIG_PROJECT_NAME = "build" }
 
parameters {
booleanParam name: 'FLASH', defaultValue: false, description: "Re-flash device with clean image"
booleanParam name: 'INSTALL_RPMS', defaultValue: true, description: "Allows you to bypass the installation process"
booleanParam name: 'RUN_TESTS', defaultValue: false, description: "Disable tests for projects which don't has any tests specified yet"
}
agent none triggers { upstream threshold: hudson.model.Result.SUCCESS, upstreamProjects: '${TRIG_PROJECT_NAME}' }
stages {
stage('run job') {
steps { build job: 'test_ad_hoc',
parameters: [
extendedChoice(name: 'SELECTED_RESOURCE_LABEL', value: 'device'),
extendedChoice(name: 'SELECTED_BUILD', value: "${TRIG_PROJECT_NAME}"),
booleanParam(name: 'FLASH', value: "${FLASH}"),
booleanParam(name: 'RUN_TESTS', value: "${RUN_TESTS}"),
booleanParam(name: 'INSTALL_RPMS', value: "${INSTALL_RPMS}") ]
}
}
}
 
{code}
 

 

 

batek.nowak@yahoo.pl (JIRA)

unread,
May 29, 2019, 11:01:03 AM5/29/19
to jenkinsc...@googlegroups.com

batek.nowak@yahoo.pl (JIRA)

unread,
May 29, 2019, 11:03:02 AM5/29/19
to jenkinsc...@googlegroups.com
Bartosz Nowak edited a comment on Bug JENKINS-42723
I got similar behavior with Extensible Choice Parameter v1.6.0 and Pipeline Build Step Plugin 2.9. It looks like groovy script is executed after trigger and thats why builds are unable to find this prams. When i execute it manually everything is working as suppose to.  


 

*Passed Params from triggering job: (missing SELECTED_RESOURCE_LABEL and SELECTED_BUILD)*

!Test_ad_hoc.png!

 

*Error Log:*

 
{code:java}
Started by timer Obtained pipeline_confs/test_all from git g...@gitlab01.sprc.samsung.pl:m.chomiak/mdm - repo.git ------------- Running in Durability level: MAX_SURVIVABILITY [Pipeline] Start of Pipeline [Pipeline] End of Pipeline groovy.lang.MissingPropertyException: No such property: SELECTED_RESOURCE_LABEL for class: groovy.lang.Binding at groovy.lang.Binding.getVariable(Binding.java:63) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:270) at org.kohsuke.groovy.sandbox.impl.Checker$6.call(Checker.java:289) at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:293) at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:269) at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:29) at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20) at WorkflowScript.run(WorkflowScript:56) at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.call(ModelInterpreter.groovy:60) at WorkflowScript.run(WorkflowScript:1) at ___cps.transform___(Native Method) at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:74) at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30) at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66) at sun.reflect.GeneratedMethodAccessor314.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72) at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21) at com.cloudbees.groovy.cps.Next.step(Next.java:83) at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174) at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163) at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129) at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268) at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51) at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:174) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:347) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:259) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:247) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Finished: FAILURE
Reply all
Reply to author
Forward
0 new messages