gitlab-ci: only check defconfigs for known branches

Currently, the check of defconfigs is run for all branches, even those
that are pushed only to run runtime tests. This is very inconvenient.

In fact, we only want to check the defconfigs on standard branches, that
is master, next, and the maintenance branches.

This will also decrease drastically the number gitlab-ci minutes used
when one pushes their repo to gitlab.com, where the number of CI minutes
are now going to be pretty severely restricted.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Romain Naour <romain.naour@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
Reviewed-by: Romain Naour <romain.naour@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
Yann E. MORIN
2020-09-06 22:12:29 +02:00
parent 05d7559615
commit 8fb49636d6

View File

@@ -42,37 +42,40 @@ gen_basics() {
gen_defconfigs() { gen_defconfigs() {
local -a defconfigs local -a defconfigs
local build_defconfigs cfg local template cfg ext
defconfigs=( $(cd configs; LC_ALL=C ls -1 *_defconfig) ) defconfigs=( $(cd configs; LC_ALL=C ls -1 *_defconfig) )
build_defconfigs=false
if [ -n "${CI_COMMIT_TAG}" ]; then if [ -n "${CI_COMMIT_TAG}" ]; then
# For tags, create a pipeline. # For tags, create a pipeline.
build_defconfigs=true template=base
fi fi
if [ -n "${CI_PIPELINE_TRIGGERED}" ]; then if [ -n "${CI_PIPELINE_TRIGGERED}" ]; then
# For pipeline created by using a trigger token. # For pipeline created by using a trigger token.
build_defconfigs=true template=base
fi fi
case "${CI_COMMIT_REF_NAME}" in 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. # For the branch or tag name named *-defconfigs, create a pipeline.
(*-defconfigs) (*-defconfigs)
build_defconfigs=true template=base
;; ;;
(*-*_defconfig) (*-*_defconfig)
defconfigs=( "${CI_COMMIT_REF_NAME##*-}" ) defconfigs=( "${CI_COMMIT_REF_NAME##*-}" )
build_defconfigs=true template=base
;; ;;
esac esac
for cfg in "${defconfigs[@]}"; do if [ -n "${template}" ]; then
if ${build_defconfigs}; then for cfg in "${defconfigs[@]}"; do
printf '%s: { extends: .defconfig_base }\n' "${cfg}" printf '%s%s: { extends: .defconfig_%s }\n' \
else "${cfg}" "${ext}" "${template}"
printf '%s_check: { extends: .defconfig_check }\n' "${cfg}" done
fi fi
done
} }
gen_tests() { gen_tests() {