* [Buildroot] [PATCH 1/2] support/scripts: prioritize conditions for pipeline creation
2020-09-21 21:08 [Buildroot] [PATCH 0/2] gitlab-ci: fix and handle the weekly scheduled pipeline (branch yem/gitlab-ci-schedule) Yann E. MORIN
@ 2020-09-21 21:08 ` Yann E. MORIN
2020-09-22 19:30 ` Thomas Petazzoni
2020-09-21 21:08 ` [Buildroot] [PATCH 2/2] support/scripts: handle scheduled pipelines Yann E. MORIN
1 sibling, 1 reply; 4+ messages in thread
From: Yann E. MORIN @ 2020-09-21 21:08 UTC (permalink / raw)
To: buildroot
When multiple conditions match simultaneously, even though that should
not happen in practice, we want the more "important" one to win over
the less "important" ones. For example, a tag is more important than a
branch name or a trigger.
Currently, the latest condition to match takes precendence over any
previous one, while we want the exact opposite.
Fix that with proper fallbacks in else-blocks.
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
support/scripts/generate-gitlab-ci-yml | 58 +++++++++++++-------------
1 file changed, 29 insertions(+), 29 deletions(-)
diff --git a/support/scripts/generate-gitlab-ci-yml b/support/scripts/generate-gitlab-ci-yml
index e42943953c..faa52e85b2 100755
--- a/support/scripts/generate-gitlab-ci-yml
+++ b/support/scripts/generate-gitlab-ci-yml
@@ -49,26 +49,26 @@ gen_defconfigs() {
if [ -n "${CI_COMMIT_TAG}" ]; then
# For tags, create a pipeline.
template=base
- fi
- if [ -n "${CI_PIPELINE_TRIGGERED}" ]; then
+ elif [ -n "${CI_PIPELINE_TRIGGERED}" ]; then
# For pipeline created by using a trigger token.
template=base
+ else
+ case "${CI_COMMIT_REF_NAME}" in
+ # For master, next, and maintenance branches, only check the defconfigs
+ (master|next|????.??.x)
+ template=check
+ ext=_check
+ ;;
+ # For the branch or tag name named *-defconfigs, create a pipeline.
+ (*-defconfigs)
+ template=base
+ ;;
+ (*-*_defconfig)
+ defconfigs=( "${CI_COMMIT_REF_NAME##*-}" )
+ template=base
+ ;;
+ esac
fi
- case "${CI_COMMIT_REF_NAME}" in
- # For master, next, and maintenance branches, only check the defconfigs
- (master|next|????.??.x)
- template=check
- ext=_check
- ;;
- # For the branch or tag name named *-defconfigs, create a pipeline.
- (*-defconfigs)
- template=base
- ;;
- (*-*_defconfig)
- defconfigs=( "${CI_COMMIT_REF_NAME##*-}" )
- template=base
- ;;
- esac
if [ -n "${template}" ]; then
for cfg in "${defconfigs[@]}"; do
@@ -91,21 +91,21 @@ gen_tests() {
if [ -n "${CI_COMMIT_TAG}" ]; then
# For tags, create a pipeline.
run_tests=true
- fi
- if [ -n "${CI_PIPELINE_TRIGGERED}" ]; then
+ elif [ -n "${CI_PIPELINE_TRIGGERED}" ]; then
# For pipeline created by using a trigger token.
run_tests=true
+ else
+ case "${CI_COMMIT_REF_NAME}" in
+ # For the branch or tag name named *-runtime-tests, create a pipeline.
+ (*-runtime-tests)
+ run_tests=true
+ ;;
+ (*-tests.*)
+ tests=( "${CI_COMMIT_REF_NAME##*-}" )
+ run_tests=true
+ ;;
+ esac
fi
- case "${CI_COMMIT_REF_NAME}" in
- # For the branch or tag name named *-runtime-tests, create a pipeline.
- (*-runtime-tests)
- run_tests=true
- ;;
- (*-tests.*)
- tests=( "${CI_COMMIT_REF_NAME##*-}" )
- run_tests=true
- ;;
- esac
if ${run_tests}; then
printf '%s: { extends: .runtime_test_base }\n' "${tests[@]}"
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [Buildroot] [PATCH 2/2] support/scripts: handle scheduled pipelines
2020-09-21 21:08 [Buildroot] [PATCH 0/2] gitlab-ci: fix and handle the weekly scheduled pipeline (branch yem/gitlab-ci-schedule) Yann E. MORIN
2020-09-21 21:08 ` [Buildroot] [PATCH 1/2] support/scripts: prioritize conditions for pipeline creation Yann E. MORIN
@ 2020-09-21 21:08 ` Yann E. MORIN
1 sibling, 0 replies; 4+ messages in thread
From: Yann E. MORIN @ 2020-09-21 21:08 UTC (permalink / raw)
To: buildroot
We currently only handle triggerred pipelines, i.e. pipelines that
have been created via the PAI with a token.
However, the weekly trigger is not a trigger, it is a schedule.
Unbeknownst to us, it seems the behaviour of scheduled pipeline has
changed, and they are no longer treated as a triggerred pipeline, and
the corresponding variable is not set; instead, the scheduled property
is reflected in the CI_PIPELINE_SOURCE variable, that is aptly set to
'schedule'.
Use that to recognise our weekly scheduled pipeline.
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
support/scripts/generate-gitlab-ci-yml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/support/scripts/generate-gitlab-ci-yml b/support/scripts/generate-gitlab-ci-yml
index faa52e85b2..01d850d09c 100755
--- a/support/scripts/generate-gitlab-ci-yml
+++ b/support/scripts/generate-gitlab-ci-yml
@@ -52,6 +52,9 @@ gen_defconfigs() {
elif [ -n "${CI_PIPELINE_TRIGGERED}" ]; then
# For pipeline created by using a trigger token.
template=base
+ elif [ "${CI_PIPELINE_SOURCE}" = "schedule" ]; then
+ # For scheduled pipelines
+ template=base
else
case "${CI_COMMIT_REF_NAME}" in
# For master, next, and maintenance branches, only check the defconfigs
@@ -94,6 +97,9 @@ gen_tests() {
elif [ -n "${CI_PIPELINE_TRIGGERED}" ]; then
# For pipeline created by using a trigger token.
run_tests=true
+ elif [ "${CI_PIPELINE_SOURCE}" = "schedule" ]; then
+ # For scheduled pipelines
+ run_tests=true
else
case "${CI_COMMIT_REF_NAME}" in
# For the branch or tag name named *-runtime-tests, create a pipeline.
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread