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

Jenkinsfile Active Choice Parameter

XMLWordPrintable

      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
            rashminair90 Rashmi Nair
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: