I am using jenkinsfile active choice reactive parameter as below:

       

      properties([ parameters([ [$class: 'ChoiceParameter', choiceType: 'PT_SINGLE_SELECT', description: 'Select code branch name', name: 'code_release_branch', script: [$class: 'GroovyScript', fallbackScript: [classpath: [], sandbox: false, script: 'return ["ERROR"]'], script: [classpath: [], sandbox: false, script: '6cd2a674-c02d-44b0-87cb-b32f1fcdc0c3']]], ]) ])

       

      So in the script, I am passing the managed files id of the below groovy script. This works fine when I pass it as a parameter and pass this groovy script but when I pass it in jenkins file as mentioned above, it just populates "ERROR" in code_branch_name.

       

      def gettags = ("git ls-remote -t -h https://USER:PASS@bitbucket.org/project_name.git").execute()
        return gettags.text.readLines().collect {| | |it.split()[1].replaceAll('refs/heads/', '').replaceAll('refs/tags/', '').replaceAll("\\^ \{\\}

      ", '')

        }

          [JENKINS-59033] Jenkinsfile Active Choice Parameter

          Rashmi Nair created issue -
          Rashmi Nair made changes -
          Description Original: I am using jenkinsfile active choice reactive parameter as below:

           

          properties([ parameters([ [$class: 'ChoiceParameter', choiceType: 'PT_SINGLE_SELECT', description: 'Select templo branch name', name: 'code_release_branch', script: [$class: 'GroovyScript', fallbackScript: [classpath: [], sandbox: false, script: 'return ["ERROR"]'], script: [classpath: [], sandbox: false, script: '6cd2a674-c02d-44b0-87cb-b32f1fcdc0c3']]], ]) ])

           

          So in the script, I am passing the managed files id of the below groovy script. This works fine when I pass it as a parameter and pass this groovy script but when I pass it in jenkins file as mentioned above, it just populates "ERROR" in code_branch_name.

           
          |def gettags = ("git ls-remote -t -h https://USER:PASS@bitbucket.org/project_name.git").execute()|
          | |return gettags.text.readLines().collect {|
          | |it.split()[1].replaceAll('refs/heads/', '').replaceAll('refs/tags/', '').replaceAll("\\^\\{\\}", '')|
          | |}|
          New: I am using jenkinsfile active choice reactive parameter as below:

           

          properties([ parameters([ [$class: 'ChoiceParameter', choiceType: 'PT_SINGLE_SELECT', description: 'Select code branch name', name: 'code_release_branch', script: [$class: 'GroovyScript', fallbackScript: [classpath: [], sandbox: false, script: 'return ["ERROR"]'], script: [classpath: [], sandbox: false, script: '6cd2a674-c02d-44b0-87cb-b32f1fcdc0c3']]], ]) ])

           

          So in the script, I am passing the managed files id of the below groovy script. This works fine when I pass it as a parameter and pass this groovy script but when I pass it in jenkins file as mentioned above, it just populates "ERROR" in code_branch_name.

           
          |def gettags = ("git ls-remote -t -h [https://USER:PASS@bitbucket.org/project_name.git]").execute()|
          | |return gettags.text.readLines().collect {|
          | |it.split()[1].replaceAll('refs/heads/', '').replaceAll('refs/tags/', '').replaceAll("\\^
           \{\\}
          ", '')|
          | |}|
          Bruno P. Kinoshita made changes -
          Link New: This issue duplicates JENKINS-63284 [ JENKINS-63284 ]
          Bruno P. Kinoshita made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Fixed but Unreleased [ 10203 ]

            kinow Bruno P. Kinoshita
            rashminair90 Rashmi Nair
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: