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

Build form value different than parameter passed to the build

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Major
    • Resolution: Not A Defect
    • active-choices-plugin
    • None
    • Active Choices v1.5.3, Jenkins 2.19.2

    Description

      Using an AC Reference parameter rendered as a complex HTML element. The value of this parameter when passed to the build is different than the value when user is interacting with the build form.

      I'm attaching an example project for testing. The complex HTML element generated from the interaction with the form is displayed and is also passed to the build.

      You can easily see the disrepancy between these two values after the build is performed by reviewing the build parameters

      config[1].xml

      Attachments

        Activity

          This issue is surfacing again in some of my complex builds. Kindly asking kinow to review possible fixes. Currently the workaround is to pass this parameter to another Active Choices Reactive Reference (as in the example shown) and use that value in the build. Already complex job configuration become even more so (and features are build on bugs )

          ioannis Ioannis Moutsatsos added a comment - This issue is surfacing again in some of my complex builds. Kindly asking kinow to review possible fixes. Currently the workaround is to pass this parameter to another Active Choices Reactive Reference (as in the example shown) and use that value in the build. Already complex job configuration become even more so (and features are build on bugs )

          Hi Ioannis!

          Little un-documented feature from Jenkins UI: check boxes values need a JSON value

          That's why we do it here: https://github.com/jenkinsci/active-choices-plugin/blob/2b542d2fee641efa445ac4aed1c8cda597ef850d/src/main/resources/org/biouno/unochoice/common/checkboxContent.jelly#L23

          Just tested your example after updating the checkbox used, and it seemed to have worked.

          def choices=['DNA','RNA','Protein']
          def color=['#ff0000','#00ff00','#0000ff','#0000ff','#0000ff','#0000ff']
          def html=''
          idx=0
          choices.each{
          html=html+"""
          <input type="checkbox" json=":${it}" name="value" value=":${it}">
          <input type="range" name="value" min="0" max="10">
          <input type="color" id="html5colorpicker"  name="value" value="${color[idx]}">---:${it as String}
          <br>
          """
          idx++
          }
          return html

          Could you give it a try, and if that works mark this issue as Not an issue or similar, please?

          Cheers

          Bruno

          kinow Bruno P. Kinoshita added a comment - Hi Ioannis! Little un-documented feature from Jenkins UI: check boxes values need a JSON value That's why we do it here: https://github.com/jenkinsci/active-choices-plugin/blob/2b542d2fee641efa445ac4aed1c8cda597ef850d/src/main/resources/org/biouno/unochoice/common/checkboxContent.jelly#L23 Just tested your example after updating the checkbox used, and it seemed to have worked. def choices=['DNA','RNA','Protein'] def color=['#ff0000','#00ff00','#0000ff','#0000ff','#0000ff','#0000ff'] def html='' idx=0 choices.each{ html=html+""" <input type="checkbox" json=":${it}" name="value" value=":${it}"> <input type="range" name="value" min="0" max="10"> <input type="color" id="html5colorpicker"  name="value" value="${color[idx]}">---:${it as String} <br> """ idx++ } return html Could you give it a try, and if that works mark this issue as Not an issue or similar, please? Cheers Bruno

          kinow Excellent catch! Thank you!

          With this change the form value is now passed correctly to the build!

          Got to make a note about how checkboxes must be defined using the json attribute.

          <input type="checkbox" json=":${it}" name="value" value=":${it}">

          Do you think that there are other such 'features from the Jenkins UI' that we need to note?

          ioannis Ioannis Moutsatsos added a comment - kinow Excellent catch! Thank you! With this change the form value is now passed correctly to the build! Got to make a note about how checkboxes must be defined using the json attribute. <input type= "checkbox" json= ":${it}" name= "value" value= ":${it}" > Do you think that there are other such 'features from the Jenkins UI' that we need to note?

          As it was pointed out by kinow checkboxes in Jenkins UI must have a json attribute. Once this was introduced in the dynamic HTML of the ACtive Choice parameter the build parameter matches the form value.

          ioannis Ioannis Moutsatsos added a comment - As it was pointed out by kinow checkboxes in Jenkins UI must have a json attribute. Once this was introduced in the dynamic HTML of the ACtive Choice parameter the build parameter matches the form value.

          Perfect! Thanks for updating the ticket.

          >Do you think that there are other such 'features from the Jenkins UI' that we need to note?

          Definitely, though my memory... and the Jenkins core API has changed a lot since pipelines, blue ocean, etc... so probably more things have changed since the last I checked it.

          kinow Bruno P. Kinoshita added a comment - Perfect! Thanks for updating the ticket. >Do you think that there are other such 'features from the Jenkins UI' that we need to note? Definitely, though my memory... and the Jenkins core API has changed a lot since pipelines, blue ocean, etc... so probably more things have changed since the last I checked it.

          People

            kinow Bruno P. Kinoshita
            ioannis Ioannis Moutsatsos
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: