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

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

XMLWordPrintable

    • 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.

            Assignee:
            Jon Sten
            Reporter:
            Jon Sten
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: