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

Incorrect Jenkinsfile with >1 steps section produces unclear error about `default` branch name

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Labels:
      None
    • Environment:
      Jenkins:
      Core 2.126
      Experimental level plugins all up to date
      Plus Declarative running not-even-merged PR 228 level code
    • Similar Issues:

      Description

      Summary
      I made a mistake and ended up with a stage containing two steps blocks. When it ran, I got two error messages. The first made total sense, but the second error barked at me about Duplicate parallel branch name: "default". It looked out of place, since there's no stage called default.

      Steps to recreate
      1. Fire up your favorite Jenkins instance

      2. Build this fork/branch of Declarative (PR 228) and pop it on. I did it via

      • git checkout abayer/jenkins-45455
      • mvn clean install -DskipTests=true
      • Upload the resulting .hpi files to my instance
      • Restart

      3. Run the following Pipeline. This will recreate via actually running it, or by using the CLI.

      pipeline {
      
          agent any
      
          stages {
              stage('Only the duplicate steps problem') {
                  steps {
                      echo "NOT SEQUENTIAL"
                  }
                  steps {
                      echo "NOT SEQUENTIAL"
                  }
              } 
          } 
      }
      

      Results
      Error messages as follows:

      Branch indexing
      Obtained Jenkinsfile from fb470cf3daecb279f90f1b07b459bd7fd8ce8468
      Running in Durability level: MAX_SURVIVABILITY
      [Bitbucket] Notifying commit build result
      [Bitbucket] Build result notified
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      WorkflowScript: 6: Multiple occurrences of the steps section @ line 6, column 9.
                 stage('Only the duplicate steps problem') {
                 ^
      
      WorkflowScript: 6: Duplicate parallel branch name: "default" @ line 6, column 9.
                 stage('Only the duplicate steps problem') {
                 ^
      
      2 errors
      
      	at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
      	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085)
      	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
      	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
      	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
      	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
      	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
      	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
      	at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
      	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:131)
      	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:125)
      	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:560)
      	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:521)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:325)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:429)
      Finished: FAILURE
      

      It's the second of the two errors that looked strange, since there's no branch called default.

        Attachments

          Activity

          Show
          kshultz Karl Shultz added a comment - PR is up! And already approved, actually .
          Hide
          kshultz Karl Shultz added a comment -

          Merged and closed.

          Show
          kshultz Karl Shultz added a comment - Merged and closed.
          Hide
          bitwiseman Liam Newman added a comment -

          Bulk closing resolved issues.

          Show
          bitwiseman Liam Newman added a comment - Bulk closing resolved issues.

            People

            Assignee:
            kshultz Karl Shultz
            Reporter:
            kshultz Karl Shultz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: