Skip to content
Snippets Groups Projects
Commit bcdd668f authored by Vincent Massol's avatar Vincent Massol
Browse files

[Misc] Improve docker-latest trigger algorithm

parent 8067c050
No related branches found
No related tags found
No related merge requests found
...@@ -142,11 +142,17 @@ if (!params.type || params.type == 'standard') { ...@@ -142,11 +142,17 @@ if (!params.type || params.type == 'standard') {
} else { } else {
// If the build is docker-latest, only build if the previous build was triggered by some source code changes. // If the build is docker-latest, only build if the previous build was triggered by some source code changes.
// Also always build if triggered manually by a user. // Also always build if triggered manually by a user.
if (params.type == 'docker-latest' && (!currentBuild.rawBuild.getCauses()[0].toString().contains('UserIdCause'))) { def build = currentBuild.rawBuild
if (!currentBuild.rawBuild.getPreviousBuild().getChangeSets().isEmpty()) { def cause = build.getCauses()[0]
if (params.type == 'docker-latest' && (!cause.toString().contains('UserIdCause'))) {
// We trigger the build under two conditions:
// - The previous build has a non empty changeset (ie. there was some commit)
// - This build was triggered by an upstream job (like rendering triggering platform)
if (!build.getPreviousBuild().getChangeSets().isEmpty() || cause.toString().contains('UpstreamCause')) {
buildDocker(params.type) buildDocker(params.type)
} else { } else {
echoXWiki "No changeset found in previous build, thus not executing the docker latest tests." echoXWiki "No changeset found in previous build and build not triggered by an upstream job, thus not executing \
the docker latest tests."
// Aborting so that the build isn't displayed as successful without doing anything. // Aborting so that the build isn't displayed as successful without doing anything.
currentBuild.result = 'ABORTED' currentBuild.result = 'ABORTED'
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment