[JIRA] (JENKINS-61068) Active Choices radio parameter has incorrect default value on parambuild URL

39 views
Skip to first unread message

adam.gabrys@live.com (JIRA)

unread,
Feb 12, 2020, 12:21:03 PM2/12/20
to jenkinsc...@googlegroups.com
Adam Gabryś created an issue
 
Jenkins / Bug JENKINS-61068
Active Choices radio parameter has incorrect default value on parambuild URL
Issue Type: Bug Bug
Assignee: Bruno P. Kinoshita
Attachments: build-with-parameters.png, parambuild.png
Components: active-choices-plugin, build-with-parameters-plugin
Created: 2020-02-12 17:20
Environment: Jenkins 2.204.2
Active Choices Plug-in 2.2.2
Build With Parameters 1.4
Priority: Major Major
Reporter: Adam Gabryś

Active Choice radio parameter on parambuild page is always visible as text box (which is fine). Unfortunately, the default value is set incorrectly. The plugin always fills the text box with the first value from the script and does not remove :selected suffix. It means that for the following script:

['1', '2', '3:selected', '4', '5']

it returns 1, and for:

['1:selected', '2', '3', '4', '5']

it returns 1:selected.

This behavior makes radio button unusable when builds are triggered by Jenkins Pipeline build step or parambuild/buildWithParameters URLs.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

adam.gabrys@live.com (JIRA)

unread,
Feb 12, 2020, 2:39:03 PM2/12/20
to jenkinsc...@googlegroups.com
Adam Gabryś commented on Bug JENKINS-61068
 
Re: Active Choices radio parameter has incorrect default value on parambuild URL

I created a pull request (PR #32) with the fix. Now it works as follow:

Code Result Returns
['1:selected', '2', '3', '4', '5']
"1" the default value
['1', '2', '3:selected', '4', '5']
"3" the default value, no difference if it is first or last
['1', '2', '3', '4'] "1" the first element when (no values are marked as default)
[] "" empty value (Jenkins cannot handle null)
[""] "" the first element (no values are marked as default)
['1:selected', '2', '3:selected', '4'] "1,3" multiple values are checked, so all of them are added (consistent with Build with Parameters behavior)
['1', '2', ':selected', '4'] "" the empty element is marked as selected

brunodepaulak@yahoo.com.br (JIRA)

unread,
Feb 25, 2020, 10:48:03 PM2/25/20
to jenkinsc...@googlegroups.com

brunodepaulak@yahoo.com.br (JIRA)

unread,
Feb 25, 2020, 10:57:03 PM2/25/20
to jenkinsc...@googlegroups.com

brunodepaulak@yahoo.com.br (JIRA)

unread,
Feb 25, 2020, 10:57:03 PM2/25/20
to jenkinsc...@googlegroups.com

brunodepaulak@yahoo.com.br (JIRA)

unread,
Feb 25, 2020, 10:58:02 PM2/25/20
to jenkinsc...@googlegroups.com

Merged and added to the changelog for the next release. Thanks a lot Adam Gabryś!

imoutsatsos@msn.com (JIRA)

unread,
Mar 9, 2020, 3:51:02 PM3/9/20
to jenkinsc...@googlegroups.com

It is not clear what issue this PR is resolving. Using Plugin v 2.1 and 2.2.2 I'm not able to reproduce Jira issue as reported

In each case I get the correct default value selected.

 

 

This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo

imoutsatsos@msn.com (JIRA)

unread,
Mar 9, 2020, 3:51:03 PM3/9/20
to jenkinsc...@googlegroups.com

imoutsatsos@msn.com (JIRA)

unread,
Mar 9, 2020, 3:55:03 PM3/9/20
to jenkinsc...@googlegroups.com
Ioannis Moutsatsos edited a comment on Bug JENKINS-61068
It is not clear what issue this PR is resolving The 2 . Using 2.3 snapshot works. However, using Plugin v 2.1 and 2.2.2 I'm not able to reproduce the Jira issue as reported

. In each case I get the correct default value selected. (see screenshot below)

Nonetheless, I'm using an older version of [Jenkins ver. 2.121.3|https://jenkins.io/]

Is it possible that this could be the difference causing the issue?

!image-2020-03-09-15-50-25-634.png!

 

 

imoutsatsos@msn.com (JIRA)

unread,
Mar 9, 2020, 3:59:02 PM3/9/20
to jenkinsc...@googlegroups.com
Ioannis Moutsatsos edited a comment on Bug JENKINS-61068
The 2.2.3 snapshot works. However, using Plugin v 2.1 and 2.2.2 I'm not able to reproduce the Jira issue as reported . In each case I get the correct default value selected. (see screenshot below)

Nonetheless, I'm using
an older version of [Jenkins ver. 2.121.3 and  |https://jenkins.io/] [Jenkins ver. 2.187|https://jenkins.io/]

Is it possible that this could be the difference causing the issue?

!image-2020-03-09-15-50-25-634.png!

 

 

adam.gabrys@live.com (JIRA)

unread,
Mar 10, 2020, 7:20:03 AM3/10/20
to jenkinsc...@googlegroups.com
Adam Gabryś updated an issue
 
Change By: Adam Gabryś
Attachment: view-build-with-parameters.png

adam.gabrys@live.com (JIRA)

unread,
Mar 10, 2020, 7:22:04 AM3/10/20
to jenkinsc...@googlegroups.com

adam.gabrys@live.com (JIRA)

unread,
Mar 10, 2020, 7:24:03 AM3/10/20
to jenkinsc...@googlegroups.com

adam.gabrys@live.com (JIRA)

unread,
Mar 10, 2020, 7:25:03 AM3/10/20
to jenkinsc...@googlegroups.com
Adam Gabryś commented on Bug JENKINS-61068
 
Re: Active Choices radio parameter has incorrect default value on parambuild URL

Ioannis Moutsatsos you are testing an incorrect page.

You opened Build with Parameters. On it everything looks good.

The problem is that this page can be used only by humans (impossible to set parameters by using POST data or GET parameters). The pages which should be used by robots are:

  • parambuild - takes parameters from GET
  • buildWithParameters - takes parameters from POST

Example for parambuild:

As you can see, the default value is set incorrectly (should be 3, but it is filled with 1).

My parameter configuration:

imoutsatsos@msn.com (JIRA)

unread,
Mar 10, 2020, 9:33:03 AM3/10/20
to jenkinsc...@googlegroups.com

imoutsatsos@msn.com (JIRA)

unread,
Mar 10, 2020, 9:34:02 AM3/10/20
to jenkinsc...@googlegroups.com
Ioannis Moutsatsos commented on Bug JENKINS-61068
 
Re: Active Choices radio parameter has incorrect default value on parambuild URL

Adam Gabryś thank you for the clatification. I missed this point (since I never use the parameters this way).

In this case YES I can reproduce the issue with previous versions of the plugin, and INDEED it is corrected in this version.

 

I would love to see an example where you can set other Active Choices parameters to a value using GET or POST. Does the cascading of other Active Choices still works?

For the plugin documentation we state that this plugin only works and is intended for interactive use by a human and not by API. Has this PR changed that?

See: https://plugins.jenkins.io/uno-choice/

 

adam.gabrys@live.com (JIRA)

unread,
Mar 10, 2020, 12:29:04 PM3/10/20
to jenkinsc...@googlegroups.com

adam.gabrys@live.com (JIRA)

unread,
Mar 10, 2020, 12:36:03 PM3/10/20
to jenkinsc...@googlegroups.com

Does the cascading of other Active Choices still works?

The parambuild and buildWithParameters pages take parameter default values and render them as inputs. No other logic is available or executed. It means that if one field should be changed when another field is changed - the logic won't be executed. Example:

For the plugin documentation we state that this plugin only works and is intended for interactive use by a human and not by API. Has this PR changed that?

All dynamic actions and validations are still able only for the humans (don't allow checking two radio buttons at the same time etc.). The PR only changes the way of setting the default values of the most basic parameter (not support for references). I know it is not perfect, but make the plugin more usable in basic cases. It also partially solves problem mentioned here JENKINS-28735 (set correct default values for basic parameters when jobs are executed by timers).

imoutsatsos@msn.com (JIRA)

unread,
Mar 10, 2020, 2:18:03 PM3/10/20
to jenkinsc...@googlegroups.com

Thank you Adam Gabryś. I've learned something!

Bruno P. Kinoshita it should be safe to incorporate these basic improvements into a new release. Thank you!

Reply all
Reply to author
Forward
0 new messages