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

DynamicReferenceParameter doesn't generate html when from pipeline script.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • active-choices-plugin
    • None
    • Jenkins 2.277.4

      A multibranch Pipeline with Jenkins pipeline script.

      After Running build and opening Build With parameters page,  the bellow falls to fallbackScript

       

      this is my code:

      (one note, if I add via Jenkins UI (Configure-> Add parameter -> Active Choice sReactive Reference Parameter ->  put script there, it works fine. but not from pipeline script.)

      stage ('Parameters'){
        steps {
         script {
          properties([                                                              
           parameters([         	       
            [$class: 'DynamicReferenceParameter',
                     choiceType: 'ET_FORMATTED_HTML',	                                    
      	             name: 'TYPE',                                    
      	                                   
      	             script: [
      	             $class: 'GroovyScript',
      	             fallbackScript: [
      	             classpath: [],
      	             sandbox: false,
      	             script: '''
                           return """
                             <p>FallbackScript. Error in main script</p>
                           """ 
                           '''
      	             ],
      				 script: [
      				classpath: [],
      				sandbox: false,
      				script: '''
      				return """
      <head>
         <script>
            function foo(val){		
              alert(val.value);      
            }
         </script>
      </head>
      
         <select  onchange='foo(this);'>
            <option value='X'>X</option>
            <option value='Y'>Y</option>
         </select>
      
      				  """    
      				'''
      			]
      	    ]
           ]) 
          ])
         }
        }
      } 	
      	....		
      
      
      

            Unassigned Unassigned
            yevsh yev
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: