From f809d49183e94d267d5ec0a71ffd6c4ff328adfb Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Tue, 5 Feb 2019 16:02:13 -0700 Subject: [PATCH] [CI]: add Jenkins.mark Add a separate Jenkins pipeline that runs in a few seconds to set the commit status to pending. This is needed as Jenkins only starts setting a commit status when the normal jobs start running and not when they are in the queue. This can lead to a) accidental merges before we test things and b) repeated /rebuild triggers. --- Jenkinsfile | 3 +++ contrib/ci/Jenkinsfile.mark | 51 +++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 contrib/ci/Jenkinsfile.mark diff --git a/Jenkinsfile b/Jenkinsfile index 09370d793b..9e3e48848f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -42,6 +42,9 @@ pipeline { steps { + // we are finally running, so we can mark the 'ready' context from Jenkinsfile.mark as success: + githubNotify context: 'ready', description: ':-)', status: 'SUCCESS' + // We can not use 'indent' because we are missing the master branch: // "fatal: ambiguous argument 'master': unknown revision or path" sh ''' diff --git a/contrib/ci/Jenkinsfile.mark b/contrib/ci/Jenkinsfile.mark new file mode 100644 index 0000000000..c10638a513 --- /dev/null +++ b/contrib/ci/Jenkinsfile.mark @@ -0,0 +1,51 @@ +#!groovy + +// This Jenkinsfile is used to mark jobs as "pending" as quickly as +// possible. The other longer running jobs only set the status to pending once +// they start running. +// +// See https://jenkins.tjhei.info/job/dealii-mark/ for details. + +/* +Settings to apply inside Jenkins: + - discover pull requests (remove branches/master) + - Strategy: merged PR + - enable "Disable GitHub Multibranch Status Plugin" + - trigger build on pull request comment: .* /rebuild.* (without space) + - Jenkinsfile: choose contrib/ci/Jenkinsfile.mark + - scan: every 4 hours + - discard: 5+ items + - docker label: small +*/ + +pipeline +{ + agent none + + stages + { + stage("check") + { + steps + { + githubNotify context: 'ready', description: 'please be patient, testers are spinning up...', status: 'PENDING' + sh ''' + wget -q -O - https://api.github.com/repos/dealii/dealii/issues/${CHANGE_ID}/labels | grep 'ready to test' || \ + { echo "This commit will only be tested when it has the label 'ready to test'. Trigger a rebuild by adding a comment that contains '/rebuild'..."; exit 1; } + ''' + } + post + { + failure + { + githubNotify context: 'ready', description: 'need ready to test label and /rebuild', status: 'PENDING' + script + { + currentBuild.result='NOT_BUILT' + } + } + } + } + + } +} -- 2.39.5