gitlab-ci: share the image version with the child
authorYann E. MORIN <yann.morin.1998@free.fr>
Sun, 6 Sep 2020 20:12:21 +0000 (22:12 +0200)
committerYann E. MORIN <yann.morin.1998@free.fr>
Wed, 9 Sep 2020 07:24:17 +0000 (09:24 +0200)
Currently, the image name and version are duplicated in the main
pipeline and the generated, child pipeline.

This is a condition for a future gaffe, so let's use the image from the
main pipeline when generating the child one.

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>
support/misc/gitlab-ci.yml.in
support/scripts/generate-gitlab-ci-yml

index 0d058bdd9172870efc76b66b3f6f6a29f0c649b5..f00c764aaffefef2cef2b82e2e71306a389556f9 100644 (file)
@@ -1,8 +1,3 @@
-# Configuration for Gitlab-CI.
-# Builds appear on https://gitlab.com/buildroot.org/buildroot/pipelines
-
-image: buildroot/base:20200814.2228
-
 .check_base:
     rules:
         - if: '$CI_COMMIT_REF_NAME =~ /^.*-.*_defconfig$/ || $CI_COMMIT_REF_NAME =~ /^.*-tests\..*$/'
index 51f7de21ddd325560772b4b4bc009c298315f98f..b076b01d0529299b70c0bf01e649b33afb6c2d72 100755 (executable)
@@ -5,7 +5,7 @@ set -o pipefail
 main() {
     local template="${1}"
 
-    cat "${template}"
+    preamble "${template}"
 
     (
         cd configs
@@ -18,4 +18,16 @@ main() {
     | LC_ALL=C sort
 }
 
+preamble() {
+    local template="${1}"
+
+    cat - "${template}" <<-_EOF_
+       # This file is generated; do not edit!
+       # Builds appear on https://gitlab.com/buildroot.org/buildroot/pipelines
+
+       image: ${CI_JOB_IMAGE}
+
+_EOF_
+}
+
 main "${@}"