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

Active Choices Reactive Reference Parameter triggering the groovy script twice

XMLWordPrintable

      I am trying to fetch a list of branches from git in the active choice reactive reference parameter.I am using the run groovy script option.

      But the script is ran twice when I check the tomcat logs.

      Because of which the drop down is rendered twice.

      Please find the below script

      def html=
       '''
       <div style="padding-top:-2em;margin-left:1em;">
       <select id="module" style="height:2.2em;width:10.8em" name="value">
       <option value="">Select...</option>
       '''
       def cmd = ["/bin/bash", "-c","sudo sh /home/centos/JenkinScripts/dynamicChoices/getBranchesFromGit.sh https://KGJenkins@bitbucket.org/vtakru/escloudadmin.git"]
       def sout = new StringBuffer()
       def serr = new StringBuffer()
       // Run the command
       println "running "+cmd
       def proc = cmd.execute()
       proc.consumeProcessOutput ( sout, serr )
       proc.waitFor() 
       def options=""
       sout.tokenize().each{ branch->
       if(branch.contains("refs/heads/")){
       branch=branch.minus("refs/heads/")
       println "Branch "+branch
       options+="<option value=$branch>$branch</option>"
       }
       }
       html+=options
       return html

       

      Please help me with this issue

       

            kinow Bruno P. Kinoshita
            akash0092 Akash Muduli
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: