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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Trivial Trivial
    • core
    • 2.303.1
    • 2.311

      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.

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

              Created:
              Updated:
              Resolved: