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

Blank value is selected by default in global choices

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      So, when you have a blank line in the choice parameter, then even with a default value in the job configuration, this (or one) blank line will be selected by default. In my use-case, the blank line was created by the last \n of the configuration.


      Currently, the plugin is keeping all empty lines from the textarea. I do understand from the unit-test class TextareaStringListUtilityTest that it is a desired behavior but it is breaking the build even when the "empty line" is just the end of the choices.

      I created the PR-10 to change this behavior.

        Attachments

          Activity

          Hide
          ikedam ikedam added a comment -

          > it is breaking the build even when the "empty line" is just the end of the choices.

          What does that mean?
          You mean you cannot build a project if that project has a global choice with an empty line at the end?

          Show
          ikedam ikedam added a comment - > it is breaking the build even when the "empty line" is just the end of the choices. What does that mean? You mean you cannot build a project if that project has a global choice with an empty line at the end?
          Hide
          alecharp Adrien Lecharpentier added a comment -

          Sorry I haven't been verify clear about the issue.

          So, when you have a blank line in the choice parameter, then even with a default value in the job configuration, this (or one) blank line will be selected by default. In my use-case, the blank line was created by the last \n of the configuration.

          Removing this blank line was the best way to be able to still have the default value selected in the "build with parameter" screen.

          Show
          alecharp Adrien Lecharpentier added a comment - Sorry I haven't been verify clear about the issue. So, when you have a blank line in the choice parameter, then even with a default value in the job configuration, this (or one) blank line will be selected by default. In my use-case, the blank line was created by the last \n of the configuration. Removing this blank line was the best way to be able to still have the default value selected in the "build with parameter" screen.
          Hide
          ikedam ikedam added a comment -

          Could not reproduce in my environment. Tested with Jenkins 1.580.1 and Firefox 36.0.1.

          1. Install extensible-choice-parameter-1.2.2.
          2. Go to Manage Jenkins > Configure System.
          3. Define a globel choice parameter "GLOBAL_PARAM1" with its choices
            value1
            (blank line)
            value2
            (blank line)
            value3
            
          4. Create a new free style project "test"
            • Check "This build is parameterized" and add an "Extensible Choice":
              • Name: PARAM1
              • Choice Provider: Global Choice Parameter
                • Name: GLOBAL_PARAM1
                • Default Choice: value2
            • Add "Execute shell"
              echo ${PARAM1}
              
          5. Click "Build with Parameters"
            • Result: "value2" is selected for "PARAM1"
          6. Run the build
            • Result: "value2" is output in its build log.
          Show
          ikedam ikedam added a comment - Could not reproduce in my environment. Tested with Jenkins 1.580.1 and Firefox 36.0.1. Install extensible-choice-parameter-1.2.2. Go to Manage Jenkins > Configure System. Define a globel choice parameter "GLOBAL_PARAM1" with its choices value1 (blank line) value2 (blank line) value3 Create a new free style project "test" Check "This build is parameterized" and add an "Extensible Choice": Name: PARAM1 Choice Provider: Global Choice Parameter Name: GLOBAL_PARAM1 Default Choice: value2 Add "Execute shell" echo ${PARAM1} Click "Build with Parameters" Result: "value2" is selected for "PARAM1" Run the build Result: "value2" is output in its build log.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            alecharp Adrien Lecharpentier
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: