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

'View selected script option' in build configuration displays wrong scriptler script

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      When a project configuration contains a Dynamic Parameter (Scriptler) parameter and uses one or more Scriptler script build steps the 'View Selected Script' link displayed in the build steps, link to the wrong script. It appears that the script displayed is the previous one used in the configuration sequence. Since the Dynamic Parameter (Scriptler) does not have a 'View selected script' option (which it should have!) we are dealing with a 'one-off' type of error due to the introduction of a Dynamic Parameter Scriptlet whose link is not tracked.

      To clarify here is an example configuration file
      Parameters
      --Dynamic Parameter (Scriptler)
      ----uses Script_A

      Build
      --Scriptler Script: Step 1
      ----Uses Script_B
      ------'View' links to Script_A (instead of Script_B)

      --Scriptler Script: Step 2
      ----Uses Script_C
      ------'View' links to Script_B (instead of Script_C)

        Attachments

          Issue Links

            Activity

            Hide
            danielbeck Daniel Beck added a comment -

            I can reproduce the issue. While the parameter does not offer a 'view script' link, it uses the same form field name, confusing any Scriptler JavaScript. As the DP plugin is 'downstream' from Scriptler, it should fix this naming collision.

            Unfortunately, the Dynamic Parameter plugin seems to be largely abandoned, and it being hosted on a different GitHub org means we cannot fix it.

            Show
            danielbeck Daniel Beck added a comment - I can reproduce the issue. While the parameter does not offer a 'view script' link, it uses the same form field name , confusing any Scriptler JavaScript . As the DP plugin is 'downstream' from Scriptler, it should fix this naming collision. Unfortunately, the Dynamic Parameter plugin seems to be largely abandoned, and it being hosted on a different GitHub org means we cannot fix it.
            Hide
            domi Dominik Bartholdi added a comment -

            placed a PR: https://github.com/jenkinsci/dynamicparameter-plugin/pull/3

            Daniel Beck why do you think its hosted on a different GHOrg?

            Show
            domi Dominik Bartholdi added a comment - placed a PR: https://github.com/jenkinsci/dynamicparameter-plugin/pull/3 Daniel Beck why do you think its hosted on a different GHOrg?
            Hide
            danielbeck Daniel Beck added a comment -

            Dominik Bartholdi It was true when I wrote that comment, see the wiki page edit a month later, or the commit history.

            Show
            danielbeck Daniel Beck added a comment - Dominik Bartholdi It was true when I wrote that comment, see the wiki page edit a month later , or the commit history .
            Hide
            domi Dominik Bartholdi added a comment -

            ok thanks - seems easier now

            Show
            domi Dominik Bartholdi added a comment - ok thanks - seems easier now
            Hide
            kinow Bruno P. Kinoshita added a comment -

            I've also successfully reproduced this issue, but with another plug-in, the active-choices.

            Then started fixing it by copying what was in the pull request (thanks, that saved a lot of time )

            But later realized that it prevented from being able to display the link to view source code for groovy scriptler scripts in the parameter.

            That's because even though I was using a different ID (in my case activeChoicesScriptlerScriptId), the scriptler_initDetailLink function would still use the old ID value.

            So the solution for the active-choices plug-in was to keep the old script ID, but fix the jelly code.

            Here's the code in the dynamic parameter plug-in that calls some JS code in scriptler:

            https://github.com/jenkinsci/dynamicparameter-plugin/blob/378aa3860d42ec8f92bdf7858e52d51e7de29943/src/main/resources/com/seitenbau/jenkins/plugins/dynamicparameter/scriptler/ScriptlerStringParameterDefinition/config.jelly#L96

            Now compare with

            https://github.com/jenkinsci/scriptler-plugin/blob/5308c27816ed8da5924eedcc6cb12c5655a7e5b3/src/main/resources/org/jenkinsci/plugins/scriptler/builder/ScriptlerBuilder/config.jelly#L71

            I was also seeing a JS error message in the browser console, because of the second parameter, that was missing (undefined in JS).

            Hope that helps
            Bruno

            Show
            kinow Bruno P. Kinoshita added a comment - I've also successfully reproduced this issue, but with another plug-in, the active-choices. Then started fixing it by copying what was in the pull request (thanks, that saved a lot of time ) But later realized that it prevented from being able to display the link to view source code for groovy scriptler scripts in the parameter. That's because even though I was using a different ID (in my case activeChoicesScriptlerScriptId), the scriptler_initDetailLink function would still use the old ID value. So the solution for the active-choices plug-in was to keep the old script ID, but fix the jelly code. Here's the code in the dynamic parameter plug-in that calls some JS code in scriptler: https://github.com/jenkinsci/dynamicparameter-plugin/blob/378aa3860d42ec8f92bdf7858e52d51e7de29943/src/main/resources/com/seitenbau/jenkins/plugins/dynamicparameter/scriptler/ScriptlerStringParameterDefinition/config.jelly#L96 Now compare with https://github.com/jenkinsci/scriptler-plugin/blob/5308c27816ed8da5924eedcc6cb12c5655a7e5b3/src/main/resources/org/jenkinsci/plugins/scriptler/builder/ScriptlerBuilder/config.jelly#L71 I was also seeing a JS error message in the browser console, because of the second parameter, that was missing (undefined in JS). Hope that helps Bruno

              People

              • Assignee:
                domi Dominik Bartholdi
                Reporter:
                ioannis Ioannis Moutsatsos
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: