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
Activity
Field | Original Value | New Value |
---|---|---|
Status | Open [ 1 ] | In Progress [ 3 ] |
Status | In Progress [ 3 ] | In Review [ 10005 ] |
Remote Link | This issue links to "PR #79 (Web Link)" [ 15151 ] |
Resolution | Fixed [ 1 ] | |
Status | In Review [ 10005 ] | Resolved [ 5 ] |
Status | Resolved [ 5 ] | Closed [ 6 ] |
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