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

Omitting text parameters when calling buildWithParameters API results incorrect parameter value types

    XMLWordPrintable

    Details

    • Similar Issues:
    • Released As:
      2.311

      Description

      For a job with a text parameter defined, if the job is triggered through the API endpoint buildWithParameters and the text parameter isn't defined, then the parameter value becomes the wrong type and is visualized incorrectly in build parameter view. Even worse, if the rebuild plugin is used, then the input form for the parameter will be a one-line input box and not a text area, which causes new lines to be stripped.
      Job config:

      Build parameters view:

      Rebuild view:

      So what goes wrong; when buildWithParameters is called, it goes through parameter definitions and offer them to contribute parameters. For text parameters (TextParameterDefinition), it eventually ends up in
      ParameterDefinition#getDefaultParameterValue() when no value is supplied for the parameter. It then relies on the implementation in StringParameterDefinition()#getDefaultParameterValue(). Unfortunately that implementation returns StringParameterValue class instances and not instances of type TextParameterValue. This is then incorrectly used to visualize the parameter value.

        Attachments

          Issue Links

            Activity

            Hide
            basil Basil Crow added a comment -

            Fixed in jenkinsci/jenkins#5704. Released in 2.311.

            Show
            basil Basil Crow added a comment - Fixed in jenkinsci/jenkins#5704 . Released in 2.311 .

              People

              Assignee:
              jons Jon Sten
              Reporter:
              jons Jon Sten
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: