Allow for Multiple Inputs to Be Passed to Pipelines with ET_FORMATTED_HTML Type

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      I have a use case where I would like to create a DynamicReferenceParameter that based on a suite chosen in a dropdown creates inputs for all of the known parameters in that suite and then passes it down to the pipeline.  I believe this could be converted into a JSON string of some sort and passed in that way.  Right now, ET_FORMATTED_HTML only passes for one input element.  

      I have this form working, but setting the inputs doesn't do anything as expected.

       [
                              $class: 'DynamicReferenceParameter',
                              description: 'All parameters shown are needed for the chosen playbook.',
                              name: 'Parameters',
                              referencedParameters:'playbook',
                              choiceType: "ET_FORMATTED_HTML",
                              script: [
                                      $class: 'GroovyScript',
                                      script: [
                                              sandbox: false,
                                              script: """
      import org.yaml.snakeyaml.Yaml
      def file = new File("/var/lib/jenkins/userContent/${jenkins.env.JOB_BASE_NAME}-manifest.yaml")
      def input = new Yaml().load(file.text)
      def selectedPlaybook = playbook
      def inputs = ""
      input[selectedPlaybook]["variables"].each{ param ->
          inputs += \"\"\"
              <div name="parameter" class="jenkins-form-item">
                  <div class="jenkins-form-label">
                      <label class="jenkins-label" for=\$param>\${param}:</label>
                  </div>
                  <div class="jenkins-form-control">
                      <input name=\$param id=\$param class="jenkins-input">
                  </div>
              </div>
          \"\"\"
      }

      def html = \"\"\"
              <div class="jenkins-form-item tr">
              <div class="jenkins-form-label"></div>
                  <div class="jenkins-form-control">
                      <div id="parameter-container">
                          \${inputs}
                      </div>
              </div>
              </div>
              \"\"\"
      return html
                                  """
                                      ]
                              ]
                      ]

            Assignee:
            Bruno P. Kinoshita
            Reporter:
            Kurt
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: