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

System Groovy Choice Parameter stopped

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      After updating the Jenkins to 2.46.2 and the plugin to 1.4.0, it stopped to running the groovy script.

      I was able to run the same script in the scriptlet area of Jenkins.

       

      grupos = []

      grupos << "Selecione uma opção"

      hudson.model.Hudson.instance.slaves.each{
      grupo = it.getLabelString().tokenize().find{
      it.matches("grupo_.*")
      }

      if (grupo != null) {
      grupo = grupo.substring(6)
      if ((grupo in grupos) == false){
      grupos << grupo
      }
      }
      }

      return grupos

        Attachments

          Activity

          Hide
          ikedam ikedam added a comment -

          extensible-choice 1.4.0 works with script-security.
          You should approve scripts to execute.
          Please refer to following pages for more details:

          Some errors should be logged in the system log, and please attach that if the problem isn't resolved even approving the script.

          Show
          ikedam ikedam added a comment - extensible-choice 1.4.0 works with script-security. You should approve scripts to execute. Please refer to following pages for more details: https://jenkins.io/security/advisory/2017-04-10/#extensible-choice-parameter-plugin https://wiki.jenkins-ci.org/display/JENKINS/Script+Security+Plugin Some errors should be logged in the system log, and please attach that if the problem isn't resolved even approving the script.
          Hide
          ricardinho_rio Ricardo Morais added a comment -

          Hi there, this is the groovy script that works fine on http://localhost:8080/script

          grupos = []

          grupos << "Selecione uma opção"

          hudson.model.Hudson.instance.slaves.each {
            grupo = it.getLabelString().tokenize().find {
          {{    it.matches(".inv.") }}
          {{  }}}

            if (grupo != null) {
              if ((grupo in grupos) == false) {
                grupos << grupo
          {{    }}}
          {{  }}}
          }

          return grupos

          I have a bunch of registered machines on Jenkins, through Jenkins Swarm plugin and on its name I specify which type of environment is this. In this particular case of above, we are trying to find the ones that are from INV environment.

          As mentioned, after upgrading the Jenkins and the plugin, it stopped to work.

          Here is the log... Only Warnings!

          log-jenkins.txt

           

          Show
          ricardinho_rio Ricardo Morais added a comment - Hi there, this is the groovy script that works fine on http://localhost:8080/script grupos = [] grupos << "Selecione uma opção" hudson.model.Hudson.instance.slaves.each {   grupo = it.getLabelString().tokenize().find { {{    it.matches(". inv. ") }} {{  }}}   if (grupo != null) {     if ((grupo in grupos) == false) {       grupos << grupo {{    }}} {{  }}} } return grupos I have a bunch of registered machines on Jenkins, through Jenkins Swarm plugin and on its name I specify which type of environment is this. In this particular case of above, we are trying to find the ones that are from INV environment. As mentioned, after upgrading the Jenkins and the plugin, it stopped to work. Here is the log... Only Warnings! log-jenkins.txt  

            People

            Assignee:
            ricardinho_rio Ricardo Morais
            Reporter:
            ricardinho_rio Ricardo Morais
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: