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

No support for failFast with new-style parallel

    Details

    • Similar Issues:
    • Sprint:
      Blue Ocean 1.3

      Description

      Summary:
      I have a Jenkinsfile has a stage which includes a pair of parallel branches (note that this is the "old way" of doing parallel in Declarative). This stage also includes the failFast: false setting.
      After making a trivial edit to this Jenkinsfile in the editor, and saving it to a new branch, the failFast: false line gets deleted from the Jenkinsfile.

      Steps to recreate:
      1. Create a new branch in an existing repo, and use a Jenkinsfile which includes both parallel branches (the "old way"), and parallel stages (the "new way"). Both are still supported according to Andrew Bayer. The stage with the parallel branches in it should also include the failFast: false setting.

      Sample:

              stage('Parallel Steps As Before') {
                  steps {
                      parallel firstBranch: {
                          node('master') {
                              build 'ten-parallels'
                          }
                      },
                      secondBranch: {
                          node('master') {
                              build 'ten-parallels'
                          }
                      },
                      failFast: false
                  }
              }
      

      2. Build this pipeline successfully.

      3. Load this pipeline into the editor, and make a trivial change. In my particular case, I changed the name of the "new style" parallel block with a trivial name change.

      4. Save this Pipeline to a new branch. It will build successfully:

      5. Now do a git pull to load your Jenkinsfile into a text editor. Notice that in the new branch, the failFast: false setting has been removed from the Jenkinsfile entirely.

      I'll attach before and after Jenkinsfiles shortly, along with some git command that show me verifying the presence of failFast: false in the first branch, and its removal in the second.

        Attachments

        1. 47109-after-Jenkinsfile
          0.8 kB
          Karl Shultz
        2. 47109-before-Jenkinsfile
          1 kB
          Karl Shultz
        3. image-2017-09-25-15-55-24-574.png
          364 kB
          Karl Shultz
        4. image-2017-09-25-15-55-50-850.png
          368 kB
          Karl Shultz

          Issue Links

            Activity

            Hide
            kshultz Karl Shultz added a comment -

            Here we're sitting on the original branch:

            ✔ ~/Documents/CloudBees/Work/Declarative/parser-rewrite/ghe/declarative-parser-rewrite [failFast-gets-deleted|✔] 
            15:58 $ git branch | grep '*'
            * failFast-gets-deleted
            

            Now look for the line in the Jenkinsfile:

            15:50 $ cat Jenkinsfile | grep Fast
                            failFast: false
            

            Make the edit in the editor, and save to the new branch. This is steps 3-4 in the steps to recreate. Now, do a git pull to pull down the branch you created with the editor. Mine was called new-parallel-name:

            ✔ ~/Documents/CloudBees/Work/Declarative/parser-rewrite/ghe/declarative-parser-rewrite [failFast-gets-deleted|✔] 
            15:51 $ git pull
            Username for 'https://github.beescloud.com': dev1
            Password for 'https://dev1@github.beescloud.com': 
            remote: Counting objects: 3, done.
            remote: Compressing objects: 100% (3/3), done.
            remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
            Unpacking objects: 100% (3/3), done.
            From https://github.beescloud.com/dev1/declarative-parser-rewrite
             * [new branch]      new-parallel-name -> origin/new-parallel-name
            Already up-to-date.
            
            

            Do a git checkout new-parallel-name to check out the branch you created in the editor:

            ✔ ~/Documents/CloudBees/Work/Declarative/parser-rewrite/ghe/declarative-parser-rewrite [failFast-gets-deleted|✔] 
            16:01 $ git checkout new-parallel-name
            Branch new-parallel-name set up to track remote branch new-parallel-name from origin.
            Switched to a new branch 'new-parallel-name'
            

            And finally, search this Jenkinsfile for the failFast: none line, and note that it's gone:

            ✔ ~/Documents/CloudBees/Work/Declarative/parser-rewrite/ghe/declarative-parser-rewrite [new-parallel-name|✔] 
            16:01 $ !cat
            cat Jenkinsfile | grep Fast
            

            If you look closely at the two Jenkinsfiles, notice that there's a blank line where the failFast: false used to be.

            Show
            kshultz Karl Shultz added a comment - Here we're sitting on the original branch: ✔ ~/Documents/CloudBees/Work/Declarative/parser-rewrite/ghe/declarative-parser-rewrite [failFast-gets-deleted|✔] 15:58 $ git branch | grep '*' * failFast-gets-deleted Now look for the line in the Jenkinsfile: 15:50 $ cat Jenkinsfile | grep Fast failFast: false Make the edit in the editor, and save to the new branch. This is steps 3-4 in the steps to recreate. Now, do a git pull to pull down the branch you created with the editor. Mine was called new-parallel-name : ✔ ~/Documents/CloudBees/Work/Declarative/parser-rewrite/ghe/declarative-parser-rewrite [failFast-gets-deleted|✔] 15:51 $ git pull Username for 'https://github.beescloud.com': dev1 Password for 'https://dev1@github.beescloud.com': remote: Counting objects: 3, done. remote: Compressing objects: 100% (3/3), done. remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (3/3), done. From https://github.beescloud.com/dev1/declarative-parser-rewrite * [new branch] new-parallel-name -> origin/new-parallel-name Already up-to-date. Do a git checkout new-parallel-name to check out the branch you created in the editor: ✔ ~/Documents/CloudBees/Work/Declarative/parser-rewrite/ghe/declarative-parser-rewrite [failFast-gets-deleted|✔] 16:01 $ git checkout new-parallel-name Branch new-parallel-name set up to track remote branch new-parallel-name from origin. Switched to a new branch 'new-parallel-name' And finally, search this Jenkinsfile for the failFast: none line, and note that it's gone: ✔ ~/Documents/CloudBees/Work/Declarative/parser-rewrite/ghe/declarative-parser-rewrite [new-parallel-name|✔] 16:01 $ !cat cat Jenkinsfile | grep Fast If you look closely at the two Jenkinsfiles, notice that there's a blank line where the failFast: false used to be.
            Hide
            kzantow Keith Zantow added a comment -

            Karl Shultz good find, we need to handle this properly, but it will be output in the 'new style' by the editor (I'm not sure how to do it offhand, need guidance from Andrew Bayer)

            Show
            kzantow Keith Zantow added a comment - Karl Shultz good find, we need to handle this properly, but it will be output in the 'new style' by the editor (I'm not sure how to do it offhand, need guidance from Andrew Bayer )
            Hide
            kshultz Karl Shultz added a comment -

            For what it's worth, I tried a simpler case, which only uses the "old style" parallel branches. Sample Jenkinsfile:

            pipeline {
                agent any
                stages {
                    stage('Parallel Steps As Before') {
                        steps {
                            parallel firstBranch: {
                                node('master') {
                                    build 'ten-parallels'
                                }
                            },
                            secondBranch: {
                                node('master') {
                                    build 'ten-parallels'
                                }
                            },
                            failFast: false
                        }
                    }
                }
            }
            

            Then I used the editor to change the name of Parallel Steps As Before to Old Style Parallel. The failFast: false line was still removed from the Jenkinsfile, with a blank line put in its place. It's easy to miss that blank line if you don't know to look for it, but it's there.

            pipeline {
              agent any
              stages {
                stage('Old Style Parallel') {
                  parallel {
                    stage('firstBranch') {
                      steps {
                        node(label: 'master') {
                          build 'ten-parallels'
                        }
            
                      }
                    }
                    stage('secondBranch') {
                      steps {
                        node(label: 'master') {
                          build 'ten-parallels'
                        }
            
                      }
                    }
                  }
                }
              }
            }
            
            Show
            kshultz Karl Shultz added a comment - For what it's worth, I tried a simpler case, which only uses the "old style" parallel branches. Sample Jenkinsfile: pipeline { agent any stages { stage('Parallel Steps As Before') { steps { parallel firstBranch: { node('master') { build 'ten-parallels' } }, secondBranch: { node('master') { build 'ten-parallels' } }, failFast: false } } } } Then I used the editor to change the name of Parallel Steps As Before to Old Style Parallel . The failFast: false line was still removed from the Jenkinsfile, with a blank line put in its place. It's easy to miss that blank line if you don't know to look for it, but it's there. pipeline { agent any stages { stage('Old Style Parallel') { parallel { stage('firstBranch') { steps { node(label: 'master') { build 'ten-parallels' } } } stage('secondBranch') { steps { node(label: 'master') { build 'ten-parallels' } } } } } } }
            Hide
            kzantow Keith Zantow added a comment -

            Assigning to Andrew Bayer as it sounds like there is no way to support this in "new-style" parallel at this time; probably the editor would just work at that point, but perhaps not, at which point just assign this back to me.

            Show
            kzantow Keith Zantow added a comment - Assigning to Andrew Bayer as it sounds like there is no way to support this in "new-style" parallel at this time; probably the editor would just work at that point, but perhaps not, at which point just assign this back to me.
            Hide
            abayer Andrew Bayer added a comment -
            Show
            abayer Andrew Bayer added a comment - https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/201  is up - I think it does the trick.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            pipeline-model-api/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStage.java
            pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Stage.groovy
            pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/JSONParser.groovy
            pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ModelParser.groovy
            pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/RuntimeASTTransformer.groovy
            pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy
            pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java
            pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java
            pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ExecuteConvertedTest.java
            pipeline-model-definition/src/test/resources/json/parallelStagesFailFast.json
            pipeline-model-definition/src/test/resources/parallelStagesFailFast.groovy
            http://jenkins-ci.org/commit/pipeline-model-definition-plugin/1a7baae6efcc0358a0ff2ec46e8141cafcee5f5c
            Log:
            [FIXED JENKINS-47109] stage-level failFast w/ parallel stages

            Might want to also reject if you use failFast in a non-parallel-parent
            stage, but it's pretty much harmless, so...eh.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pipeline-model-api/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStage.java pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Stage.groovy pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/JSONParser.groovy pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ModelParser.groovy pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/RuntimeASTTransformer.groovy pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ExecuteConvertedTest.java pipeline-model-definition/src/test/resources/json/parallelStagesFailFast.json pipeline-model-definition/src/test/resources/parallelStagesFailFast.groovy http://jenkins-ci.org/commit/pipeline-model-definition-plugin/1a7baae6efcc0358a0ff2ec46e8141cafcee5f5c Log: [FIXED JENKINS-47109] stage-level failFast w/ parallel stages Might want to also reject if you use failFast in a non-parallel-parent stage, but it's pretty much harmless, so...eh.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            pipeline-model-api/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStage.java
            pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Stage.groovy
            pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/JSONParser.groovy
            pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ModelParser.groovy
            pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/RuntimeASTTransformer.groovy
            pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy
            pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java
            pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java
            pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ExecuteConvertedTest.java
            pipeline-model-definition/src/test/resources/json/parallelStagesFailFast.json
            pipeline-model-definition/src/test/resources/parallelStagesFailFast.groovy
            http://jenkins-ci.org/commit/pipeline-model-definition-plugin/f02fe0998c48f8957b3f13160ebd407842d5d2c9
            Log:
            Merge pull request #201 from abayer/jenkins-47109

            [FIXED JENKINS-47109] stage-level failFast w/ parallel stages

            Compare: https://github.com/jenkinsci/pipeline-model-definition-plugin/compare/3fb4fad7482e...f02fe0998c48

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pipeline-model-api/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStage.java pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Stage.groovy pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/JSONParser.groovy pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ModelParser.groovy pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/RuntimeASTTransformer.groovy pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ExecuteConvertedTest.java pipeline-model-definition/src/test/resources/json/parallelStagesFailFast.json pipeline-model-definition/src/test/resources/parallelStagesFailFast.groovy http://jenkins-ci.org/commit/pipeline-model-definition-plugin/f02fe0998c48f8957b3f13160ebd407842d5d2c9 Log: Merge pull request #201 from abayer/jenkins-47109 [FIXED JENKINS-47109] stage-level failFast w/ parallel stages Compare: https://github.com/jenkinsci/pipeline-model-definition-plugin/compare/3fb4fad7482e...f02fe0998c48

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                kshultz Karl Shultz
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: