summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Draebing <thomas.draebing@sap.com>2019-11-15 12:36:21 +0100
committerThomas Dräbing <thomas.draebing@sap.com>2019-11-16 05:58:18 +0000
commitbf79cd73eb88db2c8cf752e975343051c97bfd54 (patch)
treed1fbbfb567df8ccfed05c6cf7ffda63f3139468e
parent1a134ba6d492c928e2664cfdab20468538fb8442 (diff)
Fix reporting for flaky builds in Jenkinsfile
The verification pipeline was not properly reporting the results of builds that were suspect to being flaky. This happened, because the build did not save the results in a variable, if the propagate option was used, which had to be done for the pipeline plugin's retry command to work. Instead of using the retry-command provided by the pipeline plugin, the Jenkinsfile implements this behaviour manually. Bug: Issue 11927 Change-Id: I419a20f69cabc4c54d7f57fd04ad354563eafd71
-rw-r--r--Jenkinsfile14
1 files changed, 9 insertions, 5 deletions
diff --git a/Jenkinsfile b/Jenkinsfile
index ebf2136b4b..e09b0f0bef 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -154,18 +154,19 @@ def collectBuildModes() {
}
def prepareBuildsForMode(buildName, mode="reviewdb", retryTimes = 1) {
- def propagate = retryTimes == 1 ? false : true
return {
stage("${buildName}/${mode}") {
- catchError{
- retry(retryTimes){
- def slaveBuild = build job: "${buildName}", parameters: [
+ def slaveBuild = null
+ for (int i = 1; i <= retryTimes; i++) {
+ try {
+ slaveBuild = build job: "${buildName}", parameters: [
string(name: 'REFSPEC', value: Change.ref),
string(name: 'BRANCH', value: Change.sha1),
string(name: 'CHANGE_URL', value: Change.url),
string(name: 'MODE', value: mode),
string(name: 'TARGET_BRANCH', value: Change.branch)
- ], propagate: propagate
+ ], propagate: false
+ } finally {
if (buildName == "Gerrit-codestyle"){
Builds.codeStyle = new Build(
slaveBuild.getAbsoluteUrl(), slaveBuild.getResult())
@@ -173,6 +174,9 @@ def prepareBuildsForMode(buildName, mode="reviewdb", retryTimes = 1) {
Builds.verification[mode] = new Build(
slaveBuild.getAbsoluteUrl(), slaveBuild.getResult())
}
+ if (slaveBuild.getResult() == "SUCCESS") {
+ break
+ }
}
}
}