gitlab CI: make the qemu selection automatic
authorPeter Hutterer <peter.hutterer@who-t.net>
Wed, 19 May 2021 00:25:19 +0000 (10:25 +1000)
committerJihoon Kim <jihoon48.kim@samsung.com>
Fri, 17 Nov 2023 10:41:23 +0000 (19:41 +0900)
Generate the snippet for whichever is the last version in the list for the
want_qemu tag.

And move the want_qemu tag up so it's more obvious in the config file.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
.gitlab-ci.yml
.gitlab-ci/ci.template
.gitlab-ci/config.yml

index 0373ffad7547962870c48137c6f726b067697d91..0cb1cab442170d66294cc816d80277ecde379a87 100644 (file)
@@ -225,29 +225,6 @@ check-merge-request:
     FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkgconfig python3 check-dev valgrind binutils doxygen xz linux-headers'
 
 
-# Pulls in the qemu container from upstream or rebuilds it if missing
-.fedora:33@qemu-prep:
-  extends:
-    - .fedora:33
-    - .fedora.packages
-    - .fdo.qemu-build@fedora
-  stage: prep
-  tags:
-    - kvm
-  variables:
-    GIT_STRATEGY: none
-    FDO_DISTRIBUTION_TAG: qemu-2021-01-04.1
-  allow_failure: true
-
-# Always rebuilds the container
-.fedora:33@qemu-forced-rebuild:
-  extends:
-    - .fedora:33@qemu-prep
-  variables:
-    FDO_FORCE_REBUILD: 1
-  only:
-    - schedules
-
 # Pulls in the qemu container from upstream or rebuilds it if missing
 .fedora:32@qemu-prep:
   extends:
@@ -271,7 +248,6 @@ check-merge-request:
   only:
     - schedules
 
-
 # This is the actual job
 fedora:32@qemu-prep:
   extends: .fedora:32@qemu-prep
index cfeeb0ecf81143748373111ccd688eb450da208d..de4c6b8f7dc312ecef7aca5a431761dcdc91234d 100644 (file)
@@ -144,9 +144,8 @@ check-merge-request:
 
 {% endfor %}
 
-{% for distro in distributions %}
-{% if distro.want_qemu %}
-{% for version in distro.versions %}
+{% for distro in distributions if distro.want_qemu %}
+{% set version = "{}".format(distro.versions|last()) %}
 # Pulls in the qemu container from upstream or rebuilds it if missing
 .{{ distro.name }}:{{ version }}@qemu-prep:
   extends:
@@ -170,16 +169,13 @@ check-merge-request:
   only:
     - schedules
 
-{% endfor %}
-{% endif %}
-{% endfor %}
-
 # This is the actual job
-fedora:32@qemu-prep:
-  extends: .fedora:32@qemu-prep
+{{distro.name}}:{{version}}@qemu-prep:
+  extends: .{{distro.name}}:{{version}}@qemu-prep
 
-fedora:32@qemu-forced-rebuild:
-  extends: .fedora:32@qemu-forced-rebuild
+{{distro.name}}:{{version}}@qemu-forced-rebuild:
+  extends: .{{distro.name}}:{{version}}@qemu-forced-rebuild
+{% endfor %}
 
 {% for distro in distributions %}
 {% for version in distro.versions %}
@@ -438,9 +434,11 @@ soname:
     exit 1 ;
   fi
 
-.qemu@fedora:32:
+{% for distro in distributions if distro.want_qemu %}
+{% set version = "{}".format(distro.versions|last()) %}
+.qemu@{{distro.name}}:{{version}}:
   extends:
-    - .fedora:32
+    - .{{distro.name}}:{{version}}
   stage: VM
   image: $CI_REGISTRY_IMAGE/$FDO_DISTRIBUTION_NAME/$FDO_DISTRIBUTION_VERSION:qemu-$FDO_DISTRIBUTION_TAG
   tags:
@@ -485,15 +483,16 @@ soname:
   retry:
     max: 2
     when: script_failure
-  needs: ['fedora:32@qemu-prep']
+  needs: ['{{distro.name}}:{{version}}@qemu-prep']
 
 qemu:meson:
-  extends: .qemu@fedora:32
+  extends: .qemu@{{distro.name}}:{{version}}
 
 qemu:meson:valgrind:
-  extends: .qemu@fedora:32
+  extends: .qemu@{{distro.name}}:{{version}}
   variables:
     MESON_TEST_ARGS: '--setup=valgrind'
+{% endfor %}
 
 meson-from-tarball:
   extends:
index f49fd1ec8a91fb5066f815aa41d6e6c08687cb36..720385a5017f58249e7ae9cc3b4e76954cafb644 100644 (file)
@@ -8,6 +8,7 @@
 distributions:
   - name: fedora
     tag: *default_tag
+    want_qemu: true
     versions:
       - '33'
       - '32'
@@ -28,7 +29,6 @@ distributions:
       - doxygen
       - xz
       - clang-analyzer
-    want_qemu: true
   - name: ubuntu
     tag: *default_tag
     versions: