Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-72549

Not able to create active choice plugin in jenkins pipeline

      We are not able to create an active choice parameter in jenkins pipeline job after upgrading the Jenkins even though it is giving it as an option in parameter dropdown.

      Current Jenkins Version: Jenkins 2.426.1
      Active Choice plugin version: 2.6.4

          [JENKINS-72549] Not able to create active choice plugin in jenkins pipeline

          Saurabh created issue -
          Saurabh made changes -
          Description Original: We are not able to create an active choice parameter in jenkins pipeline job after upgrading the Jenkins even though it is giving it as an option in parameters.

          Current Jenkins Version: Jenkins 2.426.1
          Active Choice plugin version: 2.6.4
          New: We are not able to create an active choice parameter in jenkins pipeline job after upgrading the Jenkins even though it is giving it as an option in parameter dropdown.

          Current Jenkins Version: Jenkins 2.426.1
          Active Choice plugin version: 2.6.4

          Hi, can you provide a minimal reproducible example, please?

          Bruno P. Kinoshita added a comment - Hi, can you provide a minimal reproducible example, please?

          Brian Hinz added a comment -

          I'm seeing the same thing.  I think it's because of Prototype removed from Jenkins because I'm seeing "Uncaught ReferenceError: Ajax is not defined ..." in the Chrome developer console.  I've been holding off upgrading the plugin because something in v2.7.2 creates conflicts with the custom javascript that I'm using to render a jQuery DataTables table.  Is there any advice you can offer about invoking jQuery from an external script with v2.7.2+?  BTW this is one of the very best Jenkins plugins, Thanks for creating & supporting it!

          Brian Hinz added a comment - I'm seeing the same thing.  I think it's because of Prototype removed from Jenkins because I'm seeing "Uncaught ReferenceError: Ajax is not defined ..." in the Chrome developer console.  I've been holding off upgrading the plugin because something in v2.7.2 creates conflicts with the custom javascript that I'm using to render a jQuery DataTables table.  Is there any advice you can offer about invoking jQuery from an external script with v2.7.2+?  BTW this is one of the very best Jenkins plugins, Thanks for creating & supporting it!

          Ah, that's helpful bphinz ! I will take a look at that after I finish working on TAP plugin (some users are having the red-daemon-face image of Jenkins crashing there, and there's a security issue to be fixed in TAP too). Will try to run from Jenkins LTS, installing the plug-in first. And then if that works will try poking Jenkins around, installing/uninstalling some plug-ins, and see what could cause this issue.

          >Is there any advice you can offer about invoking jQuery from an external script with v2.7.2+? 

          Tricky question. In the past we allowed users to load extra JS files (ioannis uses that feature a lot but I suspect he is using an older version) but I think we had a security issue that forced us to disable that. I would have to check what Jenkins offers as an alternative to plug-in developers, or if the they prefer to prohibit users from loading extra JS files due to security (which to me doesn't sound like the best answer to the problem – there ought to be a way to give users freedom to customize their jobs, IMO).

          >BTW this is one of the very best Jenkins plugins, Thanks for creating & supporting it!

          Thank you a lot! I don't have much time these days to work on this plug-in, unfortunately, so some issues end up unattended for a long time. Some times users get very frustrated with me for not responding very quickly, and do not understand that it is done on volunteer basis, on spare time.

          Comments like yours, and help with issues like this, trying to help to move forward, are what keeps me using my spare time to try to fix and release new versions of this plugin!

          Cheers

          Bruno P. Kinoshita added a comment - Ah, that's helpful bphinz ! I will take a look at that after I finish working on TAP plugin (some users are having the red-daemon-face image of Jenkins crashing there, and there's a security issue to be fixed in TAP too). Will try to run from Jenkins LTS, installing the plug-in first. And then if that works will try poking Jenkins around, installing/uninstalling some plug-ins, and see what could cause this issue. >Is there any advice you can offer about invoking jQuery from an external script with v2.7.2+?  Tricky question. In the past we allowed users to load extra JS files ( ioannis uses that feature a lot but I suspect he is using an older version) but I think we had a security issue that forced us to disable that. I would have to check what Jenkins offers as an alternative to plug-in developers, or if the they prefer to prohibit users from loading extra JS files due to security (which to me doesn't sound like the best answer to the problem – there ought to be a way to give users freedom to customize their jobs, IMO). >BTW this is one of the very best Jenkins plugins, Thanks for creating & supporting it! Thank you a lot! I don't have much time these days to work on this plug-in, unfortunately, so some issues end up unattended for a long time. Some times users get very frustrated with me for not responding very quickly, and do not understand that it is done on volunteer basis, on spare time. Comments like yours, and help with issues like this, trying to help to move forward, are what keeps me using my spare time to try to fix and release new versions of this plugin! Cheers

          Brian Hinz added a comment -

          > Will try to run from Jenkins LTS, installing the plug-in first

          I had some more time to debug this and the Ajax error goes away after upgrading the plugin 

          > In the past we allowed users to load extra JS files (ioannis uses that feature a lot but I suspect he is using an older version) but I think we had a security issue that forced us to disable that.

          Ugh.  That explains why it stopped working at 2.7.2 - I'm using groovy to dynamically generate a snippet of html that pulls in jQuery DataTables in order to present the users with a table full of checkboxes, and then updates a string parameter based on the selected checkboxes.  It's an elegant way to present a huge number of possible items.

          There is an existing Jenkins plugin that is meant to expose jQuery DataTables to other plugins but when I looked at it previously it wasn't clear to me how I could leverage it.  I guess I'll have a second look.  While I'm at it, I'll see if there's anything that I can do to try restore the previous capabilities of this plugin without sacrificing security.

          Brian Hinz added a comment - > Will try to run from Jenkins LTS, installing the plug-in first I had some more time to debug this and the Ajax error goes away after upgrading the plugin  > In the past we allowed users to load extra JS files ( ioannis uses that feature a lot but I suspect he is using an older version) but I think we had a security issue that forced us to disable that. Ugh.  That explains why it stopped working at 2.7.2 - I'm using groovy to dynamically generate a snippet of html that pulls in jQuery DataTables in order to present the users with a table full of checkboxes, and then updates a string parameter based on the selected checkboxes.  It's an elegant way to present a huge number of possible items. There is an existing Jenkins plugin that is meant to expose jQuery DataTables to other plugins but when I looked at it previously it wasn't clear to me how I could leverage it.  I guess I'll have a second look.  While I'm at it, I'll see if there's anything that I can do to try restore the previous capabilities of this plugin without sacrificing security.

          Hi bphinz 

          >I had some more time to debug this and the Ajax error goes away after upgrading the plugin 

          Does that mean the issue is gone with the latest version? Just asking to make sure I know what I need to test when trying to reproduce the issue.

          >There is an existing Jenkins plugin that is meant to expose jQuery DataTables to other plugins but when I looked at it previously it wasn't clear to me how I could leverage it.  I guess I'll have a second look.  While I'm at it, I'll see if there's anything that I can do to try restore the previous capabilities of this plugin without sacrificing security.

          Good idea! Feel free to share any ideas or examples from things we can use as reference. Let's also give some days to Ioannis to see if he will join the discussion (for context, he is the one who had the idea, concept, and designed the features of the plug-in – I just wrote the Java code after we chatted a couple of times).

          Cheers

          Bruno P. Kinoshita added a comment - Hi bphinz   >I had some more time to debug this and the Ajax error goes away after upgrading the plugin  Does that mean the issue is gone with the latest version? Just asking to make sure I know what I need to test when trying to reproduce the issue. >There is an existing Jenkins plugin that is meant to expose jQuery DataTables to other plugins but when I looked at it previously it wasn't clear to me how I could leverage it.  I guess I'll have a second look.  While I'm at it, I'll see if there's anything that I can do to try restore the previous capabilities of this plugin without sacrificing security. Good idea! Feel free to share any ideas or examples from things we can use as reference. Let's also give some days to Ioannis to see if he will join the discussion (for context, he is the one who had the idea, concept, and designed the features of the plug-in – I just wrote the Java code after we chatted a couple of times). Cheers

          Brian Hinz added a comment -

          > Does that mean the issue is gone with the latest version? Just asking to make sure I know what I need to test when trying to reproduce the issue.

          The Ajax error is gone, yes but while the plugin 2.6.4 version of the plugin appears to work, it actually does not.  With versions 2.7.2+ the Ajax error goes away but at least in my case the configuration that worked with v2.6.4 no longer works because it was using external javascript.  I'm not sure if that was the case for the OP as well.

          I spent some time looking through the commit history from 2.6.4 to present and haven't yet found where the change that removed support for external javascript happened.

          Brian Hinz added a comment - > Does that mean the issue is gone with the latest version? Just asking to make sure I know what I need to test when trying to reproduce the issue. The Ajax error is gone, yes but while the plugin 2.6.4 version of the plugin appears to work, it actually does not.  With versions 2.7.2+ the Ajax error goes away but at least in my case the configuration that worked with v2.6.4 no longer works because it was using external javascript.  I'm not sure if that was the case for the OP as well. I spent some time looking through the commit history from 2.6.4 to present and haven't yet found where the change that removed support for external javascript happened.

          I am trying to recall about when that changed (it might have been some time ago). I think it might have been a change in Jenkins, filtering something in Jelly perhaps. I looked at the plug-in changelog and I couldn't find the entry for that. Will keep looking.

          Bruno P. Kinoshita added a comment - I am trying to recall about when that changed (it might have been some time ago). I think it might have been a change in Jenkins, filtering something in Jelly perhaps. I looked at the plug-in changelog and I couldn't find the entry for that. Will keep looking.

          Had to search the web for that.

          https://stackoverflow.com/a/34372607

          > We were using this content HTML in a Jenkins userContent directory. We recently upgraded to the latest Jenkins 1.625 LTS version & it seems they've introduced new Content security policy which adds the below header to the response headers & the browsers simply decline to execute anything like stylesheets / Javascripts.

          Maybe you are using a newer version of Jenkins? If so, loading external JavaScript files is blocked by Jenkins. There might be some setting to turn that off, and that probably comes with a big warning or something to make sure you will take responsibility for doing so.

          You can reach out to others in their forums (I think Jenkins now has a discourse or some other discussion panel?) and ask about it. I stopped following the development of Jenkins some years ago after I started working more with Python in HPC (behind firewalls, limited Internet) and GitLab and GitHub pipelines/actions.

          Bruno P. Kinoshita added a comment - Had to search the web for that. https://stackoverflow.com/a/34372607 > We were using this content HTML in a Jenkins userContent directory. We recently upgraded to the latest Jenkins 1.625 LTS version & it seems they've introduced new Content security policy which adds the below header to the response headers & the browsers simply decline to execute anything like stylesheets / Javascripts. Maybe you are using a newer version of Jenkins? If so, loading external JavaScript files is blocked by Jenkins. There might be some setting to turn that off, and that probably comes with a big warning or something to make sure you will take responsibility for doing so. You can reach out to others in their forums (I think Jenkins now has a discourse or some other discussion panel?) and ask about it. I stopped following the development of Jenkins some years ago after I started working more with Python in HPC (behind firewalls, limited Internet) and GitLab and GitHub pipelines/actions.

            kinow Bruno P. Kinoshita
            saurabhjaiswal Saurabh
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: