1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

.murdock: adapt bors to merge queue

This commit is contained in:
MrKevinWeiss 2023-11-08 08:03:14 +01:00 committed by Kaspar Schleiser
parent edf47f6f60
commit 1e7f488448

View File

@ -178,19 +178,27 @@ check_label() {
return $? return $?
} }
# this function returns 0 when this is build is building one of the two bors # true if "$2" starts with "$1", false otherwise
# branches ("staging" or "trying", 1 otherwise. startswith() {
is_bors_build() { case "${2}" in
test "${CI_BUILD_BRANCH}" = "staging" || test "${CI_BUILD_BRANCH}" = "trying" ${1}*) true ;;
*) false ;;
esac
} }
# Set CI_BASE_COMMIT in case of a bors build. # this function returns 0 when this is build is building one of the two merge
# This assumes that bors always adds a single merge commit (possibly itself # queue branches ("staging" or "trying", 1 otherwise.
is_merge_queue_build() {
startswith "gh-readonly-queue/" "${CI_BUILD_BRANCH}"
}
# Set CI_BASE_COMMIT in case of a merge queue build.
# This assumes that merge queue always adds a single merge commit (possibly itself
# including multiple merges for PRs) on the base branch. # including multiple merges for PRs) on the base branch.
# That git command outputs the hash of the second merge commit (the one before # That git command outputs the hash of the second merge commit (the one before
# the topmost merge), which should be the base branch HEAD. # the topmost merge), which should be the base branch HEAD.
# (CI_BASE_COMMIT is used by `can_fast_ci_run.py` to only build changes.) # (CI_BASE_COMMIT is used by `can_fast_ci_run.py` to only build changes.)
if test -z "${CI_BASE_COMMIT}" && is_bors_build ; then if test -z "${CI_BASE_COMMIT}" && is_merge_queue_build; then
previous_merge="$(git log --merges --max-count 1 --skip 1 --pretty=format:%H)" previous_merge="$(git log --merges --max-count 1 --skip 1 --pretty=format:%H)"
export CI_BASE_COMMIT="${previous_merge}" export CI_BASE_COMMIT="${previous_merge}"
fi fi
@ -216,8 +224,8 @@ fi
# configurations. # configurations.
if [ -z "${QUICK_BUILD}" ]; then if [ -z "${QUICK_BUILD}" ]; then
export QUICK_BUILD=0 export QUICK_BUILD=0
if is_bors_build ; then if is_merge_queue_build; then
# always do full build for bors' branches # always do full build for merge queue' branches
true true
elif [ ${FULL_BUILD} -eq 1 ]; then elif [ ${FULL_BUILD} -eq 1 ]; then
# full build if building nightly or full build requested by label # full build if building nightly or full build requested by label
@ -323,14 +331,6 @@ error() {
exit 1 exit 1
} }
# true if "$2" starts with "$1", false otherwise
startswith() {
case "${2}" in
${1}*) true ;;
*) false ;;
esac
}
# if MURDOCK_HOOK is set, this function will execute it and pass on all it's # if MURDOCK_HOOK is set, this function will execute it and pass on all it's
# parameters. should the hook script exit with negative exit code, hook() makes # parameters. should the hook script exit with negative exit code, hook() makes
# this script exit with error, too. # this script exit with error, too.