Able to generate invalid declarative Jenkinsfiles

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

XMLWordPrintable

      In certain cases, it is possible to generate invalid Jenkinsfiles.

      For one thing, we need to escape backslashes.

      Additionally, I suggest during the JSON validation, we convert to declarative, and then also validate the declarative file, just to prevent invalid files from ever being created, since we can't actually load them into the editor again.

      An example JSON request that generates invalid declarative:

      {"pipeline":{"agent":{"type":"any"},"stages":[{"name":"Build","branches":[{"name":"default","steps":[{"name":"sh","arguments":[{"key":"script","value":{"isLiteral":true,"value":"echo 'hello\\'"}}]}]}]}]}}

       

            Assignee:
            Andrew Bayer
            Reporter:
            Keith Zantow
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: