From 992d9c3cfaa7334e4428ab81c02fa6f3e7bf88a0 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 15 Oct 2020 10:17:27 +0100 Subject: [PATCH] [CI] Support skip-ci label (#21377) (#21784) --- Jenkinsfile | 14 +++++++++----- Jenkinsfile.yml | 9 ++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 70e3519e9096..08abbe40e3c9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -104,13 +104,17 @@ pipeline { script { def mapParallelTasks = [:] def content = readYaml(file: 'Jenkinsfile.yml') - content['projects'].each { projectName -> - generateStages(project: projectName, changeset: content['changeset']).each { k,v -> - mapParallelTasks["${k}"] = v + if (content?.disabled?.when?.labels && beatsWhen(project: 'top-level', content: content?.disabled?.when)) { + error 'Pull Request has been configured to be disabled when there is a skip-ci label match' + } else { + content['projects'].each { projectName -> + generateStages(project: projectName, changeset: content['changeset']).each { k,v -> + mapParallelTasks["${k}"] = v + } } + notifyBuildReason() + parallel(mapParallelTasks) } - notifyBuildReason() - parallel(mapParallelTasks) } } } diff --git a/Jenkinsfile.yml b/Jenkinsfile.yml index 2278ea93735a..f7b21e1cbdfa 100644 --- a/Jenkinsfile.yml +++ b/Jenkinsfile.yml @@ -40,10 +40,9 @@ changeset: - "^testing/.*" - "^x-pack/libbeat/.*" -## Proposal -## TBC: This will allow to configure what to do based on the PR configuration disabled: when: - labels: ## Skip the GitHub Pull Request builds if there is a GitHub label match - - "skip-ci" - draft: true ## Skip the GitHub Pull Request builds with Draft PRs. + labels: ## Skip the GitHub Pull Request builds if any of the given GitHub labels match with the assigned labels in the PR. + - skip-ci + ## TODO: This will allow to configure what to do based on the PR configuration + draft: true ## Skip the GitHub Pull Request builds with Draft PRs. \ No newline at end of file