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

groovy script can not run on node specified for the job

      script can not run on node specified for the job
      when trying to use the groovy script option for active choice plugin, the script run only on master. need to add ability to distinguish the machine on which the job will run and run the groovy script on that machine.

      point to consider:
      jobs can run on several machines so adding just a checkbox to run script on remote like the implementation on dynamic paramter plugin is probably not enough. instead it would be better to specify the node tag on which you want to run the script.

          [JENKINS-29969] groovy script can not run on node specified for the job

          doron zukerman created issue -

          Including for the next development cycle. Depending on the number of changes in the other issues, I may suggest that we cut a release with the other issues, and then another release with the fix for this issue; given the risk of changes, since we will be playing with master/slave and classloaders I think.

          Bruno P. Kinoshita added a comment - Including for the next development cycle. Depending on the number of changes in the other issues, I may suggest that we cut a release with the other issues, and then another release with the fix for this issue; given the risk of changes, since we will be playing with master/slave and classloaders I think.

          Ioannis Moutsatsos added a comment - - edited

          Could you please,give a more specific use case on how this is important for generating UI parameters? The AC groovy scripts are only used for the generation of the UI parameters and not for the build itself. I can see cases where you need to get build information from a slave node to present to the user, but I wanted to check with you to better understand how you use AC from slaves. Thanks!

          Ioannis Moutsatsos added a comment - - edited Could you please,give a more specific use case on how this is important for generating UI parameters? The AC groovy scripts are only used for the generation of the UI parameters and not for the build itself. I can see cases where you need to get build information from a slave node to present to the user, but I wanted to check with you to better understand how you use AC from slaves. Thanks!

          doron zukerman added a comment - - edited

          ioannis i will give my specific usage.
          i have a slave machine used for automation testing.
          this machine has some android and ios devices connected to it.
          the list of devices changes from time to time according to our needs.
          in my case, i want to list all devices that are connected to my slave machine.

          i was able to find a bypass to this issue just today using "hudson.model.Hudson.instance.slaves" list and "RemotingDiagnostics.executeGroovy" mothod

          doron zukerman added a comment - - edited ioannis i will give my specific usage. i have a slave machine used for automation testing. this machine has some android and ios devices connected to it. the list of devices changes from time to time according to our needs. in my case, i want to list all devices that are connected to my slave machine. i was able to find a bypass to this issue just today using "hudson.model.Hudson.instance.slaves" list and "RemotingDiagnostics.executeGroovy" mothod

          Your scenario is very specific. By default, at parameter configuration phase, you don't know which slave will be used to run your test so you cannot select slave automatically.

          Oleksandr Kulychok added a comment - Your scenario is very specific. By default, at parameter configuration phase, you don't know which slave will be used to run your test so you cannot select slave automatically.
          Bikas Anand made changes -
          Attachment New: screenshot-1.png [ 32954 ]

          Bikas Anand added a comment -

          I have my use case as below...
          I want to populate Active Choice Parameter values from a file in workspace residing on a slave/node.

          In other words I just want a feature like "Remote Script" present in Dynamic Choice Parameter plugin.
          Please take a look at the line in the url
          https://wiki.jenkins-ci.org/display/JENKINS/Dynamic+Parameter+Plug-in
          Note: if the "Remote Script" check-box is checked, then the script will be executed on the slave where the build is started.

          Bikas Anand added a comment - I have my use case as below... I want to populate Active Choice Parameter values from a file in workspace residing on a slave/node. In other words I just want a feature like "Remote Script" present in Dynamic Choice Parameter plugin. Please take a look at the line in the url https://wiki.jenkins-ci.org/display/JENKINS/Dynamic+Parameter+Plug-in Note: if the "Remote Script" check-box is checked, then the script will be executed on the slave where the build is started.
          Bikas Anand made changes -
          Priority Original: Major [ 3 ] New: Critical [ 2 ]

          Ioannis Moutsatsos added a comment - - edited

          Unlike Dynamic Parameters, Active Choice parameters are used interactively by a user to provide parameters for a build. However, it is trivial to read a remote file to populate a Active Choice parameter option list. Something like:

          def url = "http://yourJenkinsServer/job/ws/fileToRead".toURL()
          def choices = []
          url.eachLine {
                  choices << it
          }
          return choices

          You can then make a selection that will be used as a build parameter. As a result the issue is not in scope and hardly qualifies as 'critical'.

          Ioannis Moutsatsos added a comment - - edited Unlike Dynamic Parameters, Active Choice parameters are used interactively by a user to provide parameters for a build. However, it is trivial to read a remote file to populate a Active Choice parameter option list. Something like: def url = "http: //yourJenkinsServer/job/ws/fileToRead" .toURL() def choices = [] url.eachLine { choices << it } return choices You can then make a selection that will be used as a build parameter. As a result the issue is not in scope and hardly qualifies as 'critical'.
          Ioannis Moutsatsos made changes -
          Priority Original: Critical [ 2 ] New: Minor [ 4 ]

            kinow Bruno P. Kinoshita
            doronz doron zukerman
            Votes:
            6 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated: