CI: rely on b2c to start qemu tests
authorBenjamin Tissoires <benjamin.tissoires@gmail.com>
Fri, 30 Jul 2021 09:30:32 +0000 (11:30 +0200)
committerBenjamin Tissoires <benjamin.tissoires@gmail.com>
Fri, 2 Sep 2022 06:39:42 +0000 (08:39 +0200)
This allows us to not have to create a specific image, and also
should be more reliable because we don't have to boot a full distribution
each time we just start our test suite.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
.gitlab-ci.yml
.gitlab-ci/ci.template
.gitlab-ci/config.yml

index 7a7770a8856c6374839ff4dd1165fa4f9d41e34b..0fd2475b1df18519debde70ae88d6ab51e973640 100644 (file)
@@ -34,7 +34,7 @@
 # <distribution>:<version>@activity:
 #  e.g. fedora:31@build-default
 
-.templates_sha: &template_sha 0c312d9c7255f46e741d43bcd1930f09cd12efe7
+.templates_sha: &template_sha 25459a8d343961918a7398e4b3c147e450926569
 
 include:
   - project: 'freedesktop/ci-templates'
@@ -94,7 +94,6 @@ variables:
   ARCH_TAG:    '2022-06-10.0'
   ALPINE_TAG:  '2022-06-10.0'
   FREEBSD_TAG: '2022-06-10.0'
-  FEDORA_QEMU_TAG:     'fedora-qemu-vm-2022-06-10.0'
 
   FDO_UPSTREAM_REPO: libinput/libinput
 
@@ -197,20 +196,6 @@ check-commit:
 # Note: images are rebuilt weekly with a scheduled pipeline with FDO_FORCE_REBUILD set
 #
 #
-fedora:36@qemu-prep:
-  extends:
-    - .fdo.qemu-build@fedora
-    - .policy
-  stage: prep
-  tags:
-    - kvm
-  variables:
-    GIT_STRATEGY: none
-    FDO_DISTRIBUTION_VERSION: "36"
-    FDO_DISTRIBUTION_TAG: $FEDORA_QEMU_TAG
-    FDO_DISTRIBUTION_PACKAGES: $FEDORA_PACKAGES
-
-
 fedora:35@container-prep:
   extends:
     - .fdo.container-build@fedora
@@ -407,6 +392,27 @@ freebsd:13.0@container-clean:
   script:
     - .gitlab-ci/meson-build.sh
 
+
+# Run meson and meson test in the container image through qemu
+.build-in-b2c@template:
+  extends:
+    - .policy
+    - .fdo.b2c-image@fedora
+    - .default_artifacts
+  tags:
+    - kvm
+  variables:
+    MESON_BUILDDIR: build_dir
+    B2C_KERNEL: https://gitlab.freedesktop.org/api/v4/projects/libevdev%2Fhid-tools/packages/generic/kernel-x86_64/v5.19/bzImage
+    B2C_VERSION: v0.9.8
+    B2C_IMAGE: $FDO_DISTRIBUTION_IMAGE
+    B2C_COMMAND: .gitlab-ci/meson-build.sh
+  script:
+    # pull b2c
+    - curl -L -o /app/boot2container https://gitlab.freedesktop.org/mupuf/boot2container/-/raw/v0.9.8/vm2c.py
+    - chmod +x /app/boot2container
+    - /app/boot2container
+
 #
 # Fedora
 #
@@ -471,7 +477,7 @@ freebsd:13.0@container-clean:
 # Set one or the other, not both.
 .test-suite-vm:
   extends:
-    - .build-in-qemu@template
+    - .build-in-b2c@template
   stage: test-suite
   variables:
     # remove the global --no-suite=hardware
@@ -487,9 +493,9 @@ freebsd:13.0@container-clean:
     - .test-suite-vm
   variables:
     FDO_DISTRIBUTION_VERSION: 36
-    FDO_DISTRIBUTION_TAG: $FEDORA_QEMU_TAG
+    FDO_DISTRIBUTION_TAG: $FEDORA_TAG
   needs:
-    - "fedora:36@qemu-prep"
+    - "fedora:36@container-prep"
 
 
 vm-touchpad:
index d75226389bc80e79ab01055ba507b759149ac4f4..1542b663c053db741f17f1c6dc7205d9a3570bd1 100644 (file)
@@ -36,7 +36,7 @@
 # <distribution>:<version>@activity:
 #  e.g. fedora:31@build-default
 
-.templates_sha: &template_sha 0c312d9c7255f46e741d43bcd1930f09cd12efe7
+.templates_sha: &template_sha 25459a8d343961918a7398e4b3c147e450926569
 
 include:
   - project: 'freedesktop/ci-templates'
@@ -81,11 +81,6 @@ variables:
   # libinput version
 {% for distro in distributions %}
   {{"%-13s"| format(distro.name.upper() + '_TAG:')}}'{{distro.tag}}'
-{% endfor %}
-{% for distro in distributions %}
-{% if distro.want_qemu %}
-  {{"%-20s"| format(distro.name.upper() + '_QEMU_TAG:')}} '{{distro.name}}-qemu-vm-{{distro.tag}}'
-{% endif %}
 {% endfor %}
 
   FDO_UPSTREAM_REPO: libinput/libinput
@@ -189,24 +184,6 @@ check-commit:
 # Note: images are rebuilt weekly with a scheduled pipeline with FDO_FORCE_REBUILD set
 #
 #
-{# qemu builds are only done for the latest version of any distribution #}
-{% for distro in distributions if distro.want_qemu %}
-{% set version = "{}".format(distro.versions|last()) %}
-{{distro.name}}:{{version}}@qemu-prep:
-  extends:
-    - .fdo.qemu-build@{{distro.name}}
-    - .policy
-  stage: prep
-  tags:
-    - kvm
-  variables:
-    GIT_STRATEGY: none
-    FDO_DISTRIBUTION_VERSION: "{{version}}"
-    FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_QEMU_TAG
-    FDO_DISTRIBUTION_PACKAGES: ${{distro.name.upper()}}_PACKAGES
-
-{% endfor %}
-
 {% for distro in distributions %}
 {% for version in distro.versions %}
 {{distro.name}}:{{version}}@container-prep:
@@ -291,6 +268,27 @@ check-commit:
   script:
     - .gitlab-ci/meson-build.sh
 
+
+# Run meson and meson test in the container image through qemu
+.build-in-b2c@template:
+  extends:
+    - .policy
+    - .fdo.b2c-image@fedora
+    - .default_artifacts
+  tags:
+    - kvm
+  variables:
+    MESON_BUILDDIR: build_dir
+    B2C_KERNEL: {{ b2c.kernel }}
+    B2C_VERSION: {{ b2c.version }}
+    B2C_IMAGE: $FDO_DISTRIBUTION_IMAGE
+    B2C_COMMAND: .gitlab-ci/meson-build.sh
+  script:
+    # pull b2c
+    - curl -L -o /app/boot2container https://gitlab.freedesktop.org/mupuf/boot2container/-/raw/{{b2c.version}}/vm2c.py
+    - chmod +x /app/boot2container
+    - /app/boot2container
+
 #
 # Fedora
 #
@@ -355,7 +353,7 @@ check-commit:
 # Set one or the other, not both.
 .test-suite-vm:
   extends:
-    - .build-in-qemu@template
+    - .build-in-b2c@template
   stage: test-suite
   variables:
     # remove the global --no-suite=hardware
@@ -374,9 +372,9 @@ check-commit:
     - .test-suite-vm
   variables:
     FDO_DISTRIBUTION_VERSION: {{version}}
-    FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_QEMU_TAG
+    FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
   needs:
-    - "{{distro.name}}:{{version}}@qemu-prep"
+    - "{{distro.name}}:{{version}}@container-prep"
 
 
 {% for suite in test_suites %}
index 4d5b28510d719da457649680c6ed41039f4c491f..d86f9f558cbe04984dcb952efa7b251d62547a24 100644 (file)
@@ -10,8 +10,7 @@ distributions:
     tag: *default_tag
     versions:
       - '35'
-      - '36' # last is picked for qemu
-    want_qemu: true
+      - '36'
     use_for_custom_build_tests: true
     use_for_qemu_tests: true
     packages:
@@ -195,3 +194,7 @@ test_suites:
   - name: pointer
     suites:
       - pointer
+
+b2c:
+  version: v0.9.8
+  kernel: https://gitlab.freedesktop.org/api/v4/projects/libevdev%2Fhid-tools/packages/generic/kernel-x86_64/v5.19/bzImage