Skip to content

Commit

Permalink
Store json with the rerun stages
Browse files Browse the repository at this point in the history
  • Loading branch information
v1v committed Jun 30, 2021
1 parent 964460d commit a31a727
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

@Library('apm@current') _


import groovy.transform.Field

/**
This is required to store the rerun stages to generate a file with the details.
*/
@Field def rerunStages = []

pipeline {
agent { label 'ubuntu-18 && immutable' }
environment {
Expand Down Expand Up @@ -184,6 +192,8 @@ VERSION=${env.VERSION}-SNAPSHOT""")
archiveArtifacts artifacts: 'packaging.properties'
}
cleanup {
// Report rerun status
writeJSON(file: 'rerun.json', json: rerunStages)
// Required to enable the flaky test reporting with GitHub. Workspace exists since the post/always runs earlier
dir("${BASE_DIR}"){
notifyBuildResult(prComment: true,
Expand Down Expand Up @@ -544,6 +554,7 @@ def runTargetWithRetry(Map args = [:]) {
try {
target(args)
} catch(e) {
rerunStages[args.context] = args
log(level: 'WARN', text: "${args.context} failed, let's try again and discard any kind of flakiness.")
target(args)
}
Expand Down

0 comments on commit a31a727

Please sign in to comment.