Skip to content
Permalink
Browse files

[FIXED JENKINS-45270] Properly throw errors so wrappers can catch them.

Specifically this will make retry from the options directive actually work.
  • Loading branch information...
abayer committed Jul 3, 2017
1 parent c62b5e0 commit a826a300e47c2c45856f5224300ba3bfb7062caa
@@ -128,6 +128,11 @@ public class ModelInterpreter implements Serializable {
}
}
}
// Throw any error we might have here to make sure that it gets caught and handled by
// wrappers.
if (firstError != null) {
throw firstError
}
}
}
}
@@ -238,4 +238,12 @@ public void duplicateExternalPropsCleaned() throws Exception {

assertEquals(1, externalPropCount);
}

@Issue("TBD")
@Test
public void retryOptions() throws Exception {
expect(Result.FAILURE, "retryOptions")
.logContains("Retrying")
.go();
}
}
@@ -0,0 +1,41 @@
/*
* The MIT License
*
* Copyright (c) 2017, CloudBees, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

pipeline {
agent none
options {
retry(3)
}
stages {
stage("foo") {
steps {
echo "hello"
error "Explode now"
}
}
}
}



0 comments on commit a826a30

Please sign in to comment.
You can’t perform that action at this time.