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

Jenkinsfile Active Choice Parameter

    Details

    • Similar Issues:

      Description

      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("\\^ \{\\}

      ", '')

        }

        Attachments

          Issue Links

            Activity

            rashminair90 Rashmi Nair created issue -
            rashminair90 Rashmi Nair made changes -
            Field Original Value New Value
            Description 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("\\^\\{\\}", '')|
            | |}|
            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("\\^
             \{\\}
            ", '')|
            | |}|
            kinow Bruno P. Kinoshita made changes -
            Link This issue duplicates JENKINS-63284 [ JENKINS-63284 ]
            kinow Bruno P. Kinoshita made changes -
            Status Open [ 1 ] Fixed but Unreleased [ 10203 ]
            Resolution Fixed [ 1 ]

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: