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

Non-identifier characters in parallel names unquoted

XMLWordPrintable

      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.

            abayer Andrew Bayer
            kzantow Keith Zantow
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: