Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
Description
Converting JSON to Jenkinsfile where parallel branch names contain non-identifier characters, the Jenkinsfile is invalid, the names are not quoted.
E.g. this JSON:
{"pipeline":{"agent":{"isLiteral":true,"value":"any"},"stages":[{"name":"parallel","branches":[{"name":"parallel 1","steps":[{"name":"echo","arguments":[{"key":"message","value":{"isLiteral":true,"value":"1"}}]}]},{"name":"parallel 2","steps":[{"name":"echo","arguments":[{"key":"message","value":{"isLiteral":true,"value":"2"}}]}]}]}]}}
Generates this invalid Jenkinsfile:
pipeline { agent any stages { stage('parallel') { steps { parallel( parallel 1: { echo(message: '1') }, parallel 2: { echo(message: '2') } ) } } } }
Sorry for the ugly formatting.
Attachments
Issue Links
- links to
Yup, needed to quote at least parallel branch names that aren't valid identifiers in Groovy. I decided to just quote all of them on toGroovy() serialization, 'cos why not.
PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/79