From 6ae91663b44eca3a883608774815da223e2d39bd Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 5 Sep 2024 11:12:47 -0400 Subject: [PATCH] [JENKINS-73726] Reproduced error in test --- .../modeldefinition/ParallelTest.java | 9 +++++ .../parallel/parallelErrorPost.groovy | 33 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 pipeline-model-definition/src/test/resources/parallel/parallelErrorPost.groovy diff --git a/pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ParallelTest.java b/pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ParallelTest.java index 94956e03a..4687881aa 100644 --- a/pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ParallelTest.java +++ b/pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ParallelTest.java @@ -444,4 +444,13 @@ public void parallelInput() throws Exception { j.assertLogContains("Two Continues", b); } + @Issue("JENKINS-73726") + @Test + public void parallelErrorPost() throws Exception { + expect(Result.FAILURE, "parallel/parallelErrorPost") + .logContains("the final failure block") + .hasFailureCase() + .go(); + } + } diff --git a/pipeline-model-definition/src/test/resources/parallel/parallelErrorPost.groovy b/pipeline-model-definition/src/test/resources/parallel/parallelErrorPost.groovy new file mode 100644 index 000000000..21f4c69aa --- /dev/null +++ b/pipeline-model-definition/src/test/resources/parallel/parallelErrorPost.groovy @@ -0,0 +1,33 @@ +pipeline { + options { + parallelsAlwaysFailFast() + skipDefaultCheckout() + } + agent none + stages { + stage('fails') { + steps { + error 'some problem' + } + } + stage('parallels') { + parallel { + stage('branch-1') { + steps { + echo 'branch 1' + } + } + stage('branch-2') { + steps { + echo 'branch 2' + } + } + } + } + } + post { + failure { + echo 'the final failure block' + } + } +}