[JIRA] [active-choices-plugin] (JENKINS-29407) Active Choices plugin doesn't work with Workflow Plugin

19 views
Skip to first unread message

jk17@ualberta.ca (JIRA)

unread,
Jul 13, 2015, 6:24:02 PM7/13/15
to jenkinsc...@googlegroups.com
Jason Kulatunga created an issue
 
Jenkins / Bug JENKINS-29407
Active Choices plugin doesn't work with Workflow Plugin
Issue Type: Bug Bug
Assignee: Bruno P. Kinoshita
Components: active-choices-plugin
Created: 13/Jul/15 10:23 PM
Priority: Minor Minor
Reporter: Jason Kulatunga

When configuring a workflow job and adding a active-choices parameter to the job, the script section is blank/empty. This also seems to happen when the active-choices plugin is used with another plugin that has a groovy script textarea.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

brunodepaulak@yahoo.com.br (JIRA)

unread,
Jul 14, 2015, 6:21:01 AM7/14/15
to jenkinsc...@googlegroups.com
Bruno P. Kinoshita commented on Bug JENKINS-29407
 
Re: Active Choices plugin doesn't work with Workflow Plugin

Hi Jason

It is a known issue (see JENKINS-28735), and I haven't found a way to fix it yet.

Currently, the parameter uses the Jenkins UI, read and parsing the HTML DOM to find other parameters. When used in scripts or from other plug-ins, if the Jenkins UI is not used, it will simply evaluate the Groovy script with no parameters.

jk17@ualberta.ca (JIRA)

unread,
Jul 14, 2015, 12:26:01 PM7/14/15
to jenkinsc...@googlegroups.com

jk17@ualberta.ca (JIRA)

unread,
Jul 14, 2015, 12:27:01 PM7/14/15
to jenkinsc...@googlegroups.com
Jason Kulatunga updated an issue

Configure page.

Change By: Jason Kulatunga
Attachment: Screen Shot 2015-07-14 at 9.24.35 AM.png

jk17@ualberta.ca (JIRA)

unread,
Jul 14, 2015, 12:28:01 PM7/14/15
to jenkinsc...@googlegroups.com
Jason Kulatunga edited a comment on Bug JENKINS-29407
 
Re: Active Choices plugin doesn't work with Workflow Plugin
Configure I've added an attachment with the issue i'm referencing. Its different than the link you provided. The error is happening in the Job configure  page.    

!Screen Shot 2015-07-14 at 9.24.35 AM.png|thumbnail!

brunodepaulak@yahoo.com.br (JIRA)

unread,
Jul 16, 2015, 3:12:01 AM7/16/15
to jenkinsc...@googlegroups.com

Oh, sorry Jason, I misunderstood your problem. I'm debugging the plug-in in Eclipse and will give it a try. I'm on Jenkins 1.580.1, 1.1-SNAPSHOT (ignore that, it is supposed to be 1.2-SNAPSHOT, but pom.xml is wrong).

brunodepaulak@yahoo.com.br (JIRA)

unread,
Jul 16, 2015, 4:39:01 AM7/16/15
to jenkinsc...@googlegroups.com

Hmmm, issue reproduced. But really weird. Tried to put a breakpoint where the script is created in the Java code, but that part of the code was never called. No errors in the JS console.

scm_issue_link@java.net (JIRA)

unread,
Jul 16, 2015, 5:35:02 AM7/16/15
to jenkinsc...@googlegroups.com
SCM/JIRA link daemon resolved as Fixed
 
Change By: SCM/JIRA link daemon
Status: Open Resolved
Resolution: Fixed

scm_issue_link@java.net (JIRA)

unread,
Jul 16, 2015, 5:35:03 AM7/16/15
to jenkinsc...@googlegroups.com
SCM/JIRA link daemon commented on Bug JENKINS-29407
 
Re: Active Choices plugin doesn't work with Workflow Plugin

Code changed in jenkins
User: Bruno P. Kinoshita
Path:
src/main/resources/org/biouno/unochoice/CascadeChoiceParameter/config.jelly
src/main/resources/org/biouno/unochoice/ChoiceParameter/config.jelly
src/main/resources/org/biouno/unochoice/DynamicReferenceParameter/config.jelly
http://jenkins-ci.org/commit/active-choices-plugin/a099c893b572279c80d09e3264350fe1de3e5a99
Log:
[FIXED JENKINS-29407] Use instance instead of it in order to get active-choices to work with the workflow plugin

scm_issue_link@java.net (JIRA)

unread,
Jul 22, 2015, 5:50:01 AM7/22/15
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Bruno P. Kinoshita
Path:
src/main/resources/org/biouno/unochoice/CascadeChoiceParameter/config.jelly
src/main/resources/org/biouno/unochoice/ChoiceParameter/config.jelly
src/main/resources/org/biouno/unochoice/DynamicReferenceParameter/config.jelly

http://jenkins-ci.org/commit/active-choices-plugin/2e53bed2aeb88e5cb83e759f5d9a8f055af32931
Log:

JENKINS-29407 Double check before using instance! Check if the it variable is available, or the configuration scripts can be emptied!

edward.lucius@gmail.com (JIRA)

unread,
Nov 27, 2015, 1:15:02 AM11/27/15
to jenkinsc...@googlegroups.com

Hi Bruno,

I'm currently using Workflow that populates dynamically 2 parameters.
This is similar to the 2nd example "Active Choices Reactive Parameter: Configuration Options (Example 02)" where we select site and then the list of cities will be populated.

This still does not work in Jenkins Workflow as Jason reported. Can you prioritise to fix this problem?
Thanks alot for your help, kind of need this urgently.

I'm using Jenkins ver. 1.632, and Active choice ver 1.2

Edward

edward.lucius@gmail.com (JIRA)

unread,
Nov 27, 2015, 1:23:01 AM11/27/15
to jenkinsc...@googlegroups.com
Edward Wijaya started work on Bug JENKINS-29407
 
Change By: Edward Wijaya
Resolution: Fixed
Status: Resolved In Progress

edward.lucius@gmail.com (JIRA)

unread,
Nov 27, 2015, 1:23:02 AM11/27/15
to jenkinsc...@googlegroups.com
Edward Wijaya stopped work on Bug JENKINS-29407
 
Change By: Edward Wijaya
Status: In Progress Open

edward.lucius@gmail.com (JIRA)

unread,
Nov 27, 2015, 1:26:01 AM11/27/15
to jenkinsc...@googlegroups.com

Sorry if i hijacked this issue, i dont know if there is a rule to open a new issue for discovered problem OR it is ok to reopen.
Let me know if you want me to open a new issue, for the moment i reopened the issue.

brunodepaulak@yahoo.com.br (JIRA)

unread,
Nov 30, 2015, 12:52:01 AM11/30/15
to jenkinsc...@googlegroups.com

That's all right to reopen it I'm starting a cycle to work on the plug-in, but have other issues to tackle first. Not sure if I will be able to include this one in the next release. In case you have a pull request let me know and I'll try to review/merge it.

Bruno

edward.lucius@gmail.com (JIRA)

unread,
Dec 1, 2015, 10:17:01 PM12/1/15
to jenkinsc...@googlegroups.com

Thanks for your reply. May i ask what is the issue in this ticket?
I saw your reply to Jason, but it seems that it does not relate to the issue he is describing.
What i'm seeing in the Jenkins is that the script section is totally gone. I tried to create a Freestyle job and write the dynamic parameters which works.
Then i tried to copy the job config.xml section which contain the script to the workflow, but it does not work. It didnt recognize the script nor it shows the UI.

If you can point out the issue, let me try to check on it if i can give a pull request. Else if its too complex, i will have to find other way to implement it.

Edward

imoutsatsos@msn.com (JIRA)

unread,
Jun 11, 2016, 12:37:01 PM6/11/16
to jenkinsc...@googlegroups.com

brunodepaulak@yahoo.com.br (JIRA)

unread,
Oct 23, 2016, 9:37:02 PM10/23/16
to jenkinsc...@googlegroups.com
Bruno P. Kinoshita commented on Bug JENKINS-29407
 
Re: Active Choices plugin doesn't work with Workflow Plugin

Hi Edward Wijaya

If memory serves well, the issue here is that the plug-in uses the HTML DOM, to retrieve other parameters' values.

I don't know the pipelines plug-in API well enough, but I believe you don't always get parameters rendered on the UI.

If you have one step calling the other, and there's no DOM, the plug-in will simply display empty values, or whatever fall back you have configured in your job configuration.

So the challenge is to find a way that we can run a pipeline, and have some way to tell the plug-in about other parameters' values in the pipeline. Perhaps we could add an abstraction layer, before the DOM interaction.

If the DOM is available, then we use it. Otherwise, we have an alternative mechanism that will either read the job configuration, or receive some context from the pipeline runner, or something along this line.

Hope that helps

This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

brunodepaulak@yahoo.com.br (JIRA)

unread,
Apr 14, 2018, 5:38:02 AM4/14/18
to jenkinsc...@googlegroups.com
Bruno P. Kinoshita started work on Bug JENKINS-29407
 
Change By: Bruno P. Kinoshita
Status: Open In Progress
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

scm_issue_link@java.net (JIRA)

unread,
Apr 14, 2018, 6:03:05 AM4/14/18
to jenkinsc...@googlegroups.com

Code changed in jenkins


User: Bruno P. Kinoshita
Path:

src/main/java/org/biouno/unochoice/AbstractScriptableParameter.java
src/main/java/org/biouno/unochoice/util/Utils.java
http://jenkins-ci.org/commit/active-choices-plugin/766aa42860491aedab12b72f366d472826798576
Log:
JENKINS-29407: make helper variables visible to pipelines jobs

brunodepaulak@yahoo.com.br (JIRA)

unread,
Apr 14, 2018, 6:13:03 AM4/14/18
to jenkinsc...@googlegroups.com

Started working on this issue today after a long time (it's quite a storm outside anyway). Alas I couldn't find a good solution yet. Branch: https://github.com/jenkinsci/active-choices-plugin/tree/pipeline-support

Started by fixing the variables jenkinsBuild and jenkinsProject for pipeline builds (which also removes one deprecated method call at least).

Then created a few pipeline jobs to test the plug-in. As expected, when you add "This build is parameterized", everything works as expected.

But if you call another job, the cascaded parameters do not receive updates from other parameters. The behaviour is the same you would see by scheduling a job with AC cascaded parameters.

When a job is scheduled without the UI, we could - in theory - still create the values for parameters, and then notify other parameters about the update, or read the value of the referenced parameters. These are the two options we have I think.

Alternative 1) notify other parameters about the update

When the UI is available, and we have JavaScript and the DOM, what we created in Active Choices is a push based parameters update. Where one parameter is changed, and then kindly goes to each of its children parameters and tells them that there is an update available.

We are able to do that, because we basically hijack each parameter in the UI that we need, and add event listeners to notify parameters. But in the Java side, there is no option for doing the same.

We could modify our parameters in Active Choices to notify other parameters in the "default value" method, or even check what was the "Cause" that triggered the job, and identify when the UI/DOM is not available... but we don't have an option to update other parameters such as String Parameter. Nor we have any extension point in Jenkins for that.

Alternative 2) read the value of the referenced parameters

In this case, you have something like PARAM1 – is referenced by – > PARAM2. In the UI, you must have PARAM1 configured before PARAM2, so that PARAM1 is executed first.

The order is kept in timer scheduled builds. So PARAM1 is executed fine. But when PARAM2 (which is either a HTML referenced parameter, or a cascade choice parameter) is executed, the value of its referenced parameters is not updated.

When you have the UI, this update happens via JavaScript.

Inside the PARAM2 execution, you can retrieve the project (we already do that, to put the jenkinsProject variable in the context for Groovy). And via the project, you can retrieve the other parameters. Amongst these parameters, you can find the one that is referenced by PARAM2, i.e. PARAM1.

However, there is no value associated with PARAM1. The value is never stored in some context or session that can be accessed by other parameters. I believe because Jenkins was not designed for that, which makes sense I think.

 

brunodepaulak@yahoo.com.br (JIRA)

unread,
Apr 14, 2018, 6:15:04 AM4/14/18
to jenkinsc...@googlegroups.com

Previous comment was also a memory note, as I tend to forget things after a while but if you've read it and have another alternative, please let me know. So far the only other ways I can think of fixing it is by modifying the Jenkins core, which would require a longer time to design the change and get its approval (if approved) by core-devs.

brunodepaulak@yahoo.com.br (JIRA)

unread,
Apr 14, 2018, 6:15:04 AM4/14/18
to jenkinsc...@googlegroups.com
Change By: Bruno P. Kinoshita
Status: In Progress Open

KMOmarovich@gmail.com (JIRA)

unread,
Sep 24, 2019, 5:45:04 AM9/24/19
to jenkinsc...@googlegroups.com

Started by fixing the variables jenkinsBuild and jenkinsProject for pipeline builds (which also removes one deprecated method call at least). Then created a few pipeline jobs to test the plug-in. As expected, when you add "This build is parameterized", everything works as expected.

This doesn't match my experience — groovy.lang.Binding only has the jenkinsParameter variable for any pipeline job that I test, "This build is parameterized" option is checked on each one. Is this fix not included in the official releases yet? I'm using Active Choices plugin version 2.2.1

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

brunodepaulak@yahoo.com.br (JIRA)

unread,
Sep 24, 2019, 6:17:05 AM9/24/19
to jenkinsc...@googlegroups.com

Hi , once released the issue will be marked as closed or fixed here. I have no bandwidth to work on this right now, but happy to review/merge pull requests.

Bruno

imoutsatsos@msn.com (JIRA)

unread,
Oct 25, 2019, 6:51:07 AM10/25/19
to jenkinsc...@googlegroups.com

Bruno P. Kinoshita thanks for the interesting comment/memory dump above! As of now (OCT-25-2019), there are at least 13 different active-choice Jira related tickets referencing the use of this plugin in pipeline jobs/Jenkinsfile. Given that this plugin was designed to be used interactively on freestyle job build forms (clearly stated in the plugin documentation) is there a point to keep looking for solutions in this space especially if there are no convenient Jenkins extension points to support this approach?  Should we just close all these issues as will not be done. It seems no-one is reading the plugin documentation any longer.

imoutsatsos@msn.com (JIRA)

unread,
Oct 25, 2019, 6:52:02 AM10/25/19
to jenkinsc...@googlegroups.com
Ioannis Moutsatsos edited a comment on Bug JENKINS-29407
[~kinow] thanks for the interesting comment/memory dump above! As of now (OCT-25-2019), there are at least 13 different active-choice Jira related tickets referencing the use of this plugin in pipeline jobs/Jenkinsfile. Given that this plugin was designed to be used interactively on freestyle job build forms (clearly stated in the plugin documentation) is there a point to keep looking for solutions in this space especially if there are no convenient Jenkins extension points to support this approach?  Should we just close all these issues as will not be done. It seems no-one is reading the plugin documentation any longer. Perhaps these AC shortcomings could be addressed in a different plugin designed specifically for pipeline jobs.
Reply all
Reply to author
Forward
0 new messages