Skip to contentSkip to conversation

ci: Run qemu jobs only for the latest supported kernel version

PATCH In review Florian Bezdeka 2 participants 4 messages Feb 28, 2023 – Mar 22, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ci: Run qemu jobs only for the latest supported kernel version

Each branch (represented by the xenomai_<branch>.yml files) can now define the latest kernel version that is supported by this branch. The qemu build and test jobs will only be run for this kernel version.

Note: The stable/v3.0.x and stable/v3.1.x branches do not define a latest kernel version. For those branches no qemu build and test jobs will be scheduled. For stable/v3.0.x the situation is unchanged, for stable/v3.1.x no qemu tasks will be scheduled anymore.

All qemu jobs can be re-enabled on pipeline creation time when the env variale named ALL_QEMU_JOBS is set to "true". CI documentation has been updated.

ALL_QEMU_JOBS and LAVA_TESTS_ENABLED might be feeded in by the gitlab UI to limit the number of CI jobs.

We have to forward this variables to the downstream pipelines. Previously they were defined with their default values in downstream pipelines which made it impossible to overwrite the default from outside.

---
 .gitlab-ci.yml        |  7 +++++++
 ci/gitlab-ci-base.yml | 25 ++++++++++++++++++-------
 ci/xenomai_3_2_x.yml  |  1 +
 ci/xenomai_next.yml   |  1 +
 tests/README.md       |  4 ++++
 5 files changed, 31 insertions(+), 7 deletions(-)
.gitlab-ci.yml +7 -0
index 58398fc..58d61b1 100644
@@ -9,6 +9,10 @@
 # SPDX-License-Identifier: MIT
 #
 
+variables:
+  LAVA_TESTS_ENABLED: "true"
+  ALL_QEMU_JOBS: "false"
+
 stages:
   - parent
 
@@ -16,6 +20,9 @@ stages:
   stage: parent
   trigger:
     strategy: depend
+  variables:
+    LAVA_TESTS_ENABLED: "${LAVA_TESTS_ENABLED}" 
+    ALL_QEMU_JOBS: "${ALL_QEMU_JOBS}"
   rules:
     - if: '$ONLY_RUN == null || $ONLY_RUN == $CI_JOB_NAME'
 
ci/gitlab-ci-base.yml +18 -7
index ee71ea3..f1980b6 100644
@@ -20,7 +20,6 @@ variables:
   no_proxy: "$NO_PROXY"
   ISAR_IMAGE: demo-image
   ISAR_DISTRIBUTION: xenomai-demo
-  LAVA_TESTS_ENABLED: "true"
   BUILD_IDENTIFIER: "xenomai-${XENOMAI_VERSION}_kernel-${KERNEL_VERSION}"
 
 default:
@@ -45,6 +44,12 @@ default:
     - kas build kas.yml:board-${TARGET}.yml${XENOMAI_BUILD_OPTION}${LINUX_BUILD_OPTION}${BUILD_OPTIONS}:opt-ci.yml
     - if [ -n "${USE_S3_BUCKET}" ]; then scripts/deploy_to_aws.sh ${TARGET}; fi
 
+.build-qemu:
+  extends: .build
+  rules:
+    - if: '$KERNEL_VERSION == $LATEST_KERNEL_VERSION'
+    - if: '$ALL_QEMU_JOBS == "true"'
+
 .test:
   extends: .common-config
   stage: test
@@ -62,33 +67,39 @@ default:
   rules:
     - if: '$LAVA_TESTS_ENABLED == "true"'
 
+.test-qemu:
+  extends: .test
+  rules:
+    - if: '$KERNEL_VERSION == $LATEST_KERNEL_VERSION'
+    - if: '$ALL_QEMU_JOBS == "true"'
+
 .build:qemu-amd64:
-  extends: .build
+  extends: .build-qemu
   variables:
     TARGET: qemu-amd64
 
 .lava-test:qemu-amd64:
-  extends: .test
+  extends: .test-qemu
   variables:
     TARGET: qemu-amd64
 
 .build:qemu-armhf:
-  extends: .build
+  extends: .build-qemu
   variables:
     TARGET: qemu-armhf
 
 .lava-test:qemu-armhf:
-  extends: .test
+  extends: .test-qemu
   variables:
     TARGET: qemu-armhf
 
 .build:qemu-arm64:
-  extends: .build
+  extends: .build-qemu
   variables:
     TARGET: qemu-arm64
 
 .lava-test:qemu-arm64:
-  extends: .test
+  extends: .test-qemu
   variables:
     TARGET: qemu-arm64
 
ci/xenomai_3_2_x.yml +1 -0
index 3ee0b7d..781eec8 100644
@@ -20,3 +20,4 @@ include:
 variables:
   XENOMAI_BUILD_OPTION: ":opt-xenomai-3.2.x.yml"
   XENOMAI_VERSION: "3.2.x"
+  LATEST_KERNEL_VERSION: "5.15"
ci/xenomai_next.yml +1 -0
index 3e4d513..b611e60 100644
@@ -19,3 +19,4 @@ include:
 variables:
   XENOMAI_BUILD_OPTION: ":opt-xenomai-next.yml"
   XENOMAI_VERSION: "next"
+  LATEST_KERNEL_VERSION: "6.1"
tests/README.md +4 -0
index 50942df..c092d54 100644
@@ -106,6 +106,10 @@ The following variables are used and set by the ci system:
   - `ALT_DNS_SERVER`: optional, can be set to something like "8.8.8.8" to use a specific DNS server
   - `DISTRO_APT_PREMIRRORS`: optional, can be set to something like "deb\.debian\.org cdn-aws.deb.debian.org\n" to use a specific Debian mirror
 
+- CI job "filers":
+  - `ALL_QEMU_JOBS`: Default is false. Set to true to enable all qemu based jobs
+  - `LAVA_TESTS_ENABLED`: Default is true. Set to false to disable all LAVA jobs
+
 - LAVA settings:
   - `LAVA_MASTER_ACCOUNT`: lava master account name to register lavacli for test execution
   - `LAVA_MASTER_TOKEN`: token to connect with the lava master
Signature · 1 line
2.39.2
#1 lore raw

PATCH 2/2 ci: Limit ci jobs, remove qemu compat jobs

One more optimization to narrow down the number of CI jobs that we spawn for each CI run.

---
 ci/compat_jobs.yml | 16 ----------------
 1 file changed, 16 deletions(-)
ci/compat_jobs.yml +0 -16
index 9308679..d8ee86b 100644
@@ -9,22 +9,6 @@
 # SPDX-License-Identifier: MIT
 #
 
-build-5.15-compat:qemu-amd64:
-  extends:
-    - .build:qemu-amd64
-    - .compat-vars
-  variables:
-    LINUX_BUILD_OPTION: ":opt-linux-latest-5.15.yml"
-    KERNEL_VERSION: "5.15"
-
-lava-test-5.15-compat:qemu-amd64:
-  needs: [ "build-5.15-compat:qemu-amd64" ]
-  extends:
-    - .lava-test:qemu-amd64
-    - .compat-vars
-  variables:
-    KERNEL_VERSION: "5.15"
-
 build-5.15-compat:x86-64-efi:
   extends:
     - .build:x86-64-efi
Signature · 1 line
2.39.2
#2 lore raw

Re: [xenomai-images][PATCH 2/2] ci: Limit ci jobs, remove qemu compat jobs

Quoted 25 lines · Florian Bezdeka

One more optimization to narrow down the number of CI jobs that we spawn for each CI run.

---
 ci/compat_jobs.yml | 16 ----------------
 1 file changed, 16 deletions(-)
ci/compat_jobs.yml +0 -9
index 9308679..d8ee86b 100644
@@ -9,22 +9,6 @@
 # SPDX-License-Identifier: MIT
 #
 
-build-5.15-compat:qemu-amd64:
-  extends:
-    - .build:qemu-amd64
-    - .compat-vars
-  variables:
-    LINUX_BUILD_OPTION: ":opt-linux-latest-5.15.yml"
-    KERNEL_VERSION: "5.15"
-
-lava-test-5.15-compat:qemu-amd64:

ci/compat_jobs.yml line 14

Quoted 10 lines
ci/compat_jobs.yml +0 -7
-  needs: [ "build-5.15-compat:qemu-amd64" ]
-  extends:
-    - .lava-test:qemu-amd64
-    - .compat-vars
-  variables:
-    KERNEL_VERSION: "5.15"
-
 build-5.15-compat:x86-64-efi:
   extends:
     - .build:x86-64-efi

Thanks, both applied (with trailing whitespace fix for patch 1)

Jan

Signature · 2 lines
Siemens AG, Technology
Competence Center Embedded Linux
#3 lore raw
In reply to Florian Bezdeka
Quoted 148 lines · Florian Bezdeka

Each branch (represented by the xenomai_<branch>.yml files) can now define the latest kernel version that is supported by this branch. The qemu build and test jobs will only be run for this kernel version.

Note: The stable/v3.0.x and stable/v3.1.x branches do not define a latest kernel version. For those branches no qemu build and test jobs will be scheduled. For stable/v3.0.x the situation is unchanged, for stable/v3.1.x no qemu tasks will be scheduled anymore.

All qemu jobs can be re-enabled on pipeline creation time when the env variale named ALL_QEMU_JOBS is set to "true". CI documentation has been updated.

ALL_QEMU_JOBS and LAVA_TESTS_ENABLED might be feeded in by the gitlab UI to limit the number of CI jobs.

We have to forward this variables to the downstream pipelines. Previously they were defined with their default values in downstream pipelines which made it impossible to overwrite the default from outside.

---
 .gitlab-ci.yml        |  7 +++++++
 ci/gitlab-ci-base.yml | 25 ++++++++++++++++++-------
 ci/xenomai_3_2_x.yml  |  1 +
 ci/xenomai_next.yml   |  1 +
 tests/README.md       |  4 ++++
 5 files changed, 31 insertions(+), 7 deletions(-)
.gitlab-ci.yml +7 -0
index 58398fc..58d61b1 100644
@@ -9,6 +9,10 @@
 # SPDX-License-Identifier: MIT
 #
 
+variables:
+  LAVA_TESTS_ENABLED: "true"
+  ALL_QEMU_JOBS: "false"
+
 stages:
   - parent
 
@@ -16,6 +20,9 @@ stages:
   stage: parent
   trigger:
     strategy: depend
+  variables:
+    LAVA_TESTS_ENABLED: "${LAVA_TESTS_ENABLED}" 
+    ALL_QEMU_JOBS: "${ALL_QEMU_JOBS}"
   rules:
     - if: '$ONLY_RUN == null || $ONLY_RUN == $CI_JOB_NAME'
 
ci/gitlab-ci-base.yml +18 -7
index ee71ea3..f1980b6 100644
@@ -20,7 +20,6 @@ variables:
   no_proxy: "$NO_PROXY"
   ISAR_IMAGE: demo-image
   ISAR_DISTRIBUTION: xenomai-demo
-  LAVA_TESTS_ENABLED: "true"
   BUILD_IDENTIFIER: "xenomai-${XENOMAI_VERSION}_kernel-${KERNEL_VERSION}"
 
 default:
@@ -45,6 +44,12 @@ default:
     - kas build kas.yml:board-${TARGET}.yml${XENOMAI_BUILD_OPTION}${LINUX_BUILD_OPTION}${BUILD_OPTIONS}:opt-ci.yml
     - if [ -n "${USE_S3_BUCKET}" ]; then scripts/deploy_to_aws.sh ${TARGET}; fi
 
+.build-qemu:
+  extends: .build
+  rules:
+    - if: '$KERNEL_VERSION == $LATEST_KERNEL_VERSION'
+    - if: '$ALL_QEMU_JOBS == "true"'
+
 .test:
   extends: .common-config
   stage: test
@@ -62,33 +67,39 @@ default:
   rules:
     - if: '$LAVA_TESTS_ENABLED == "true"'
 
+.test-qemu:
+  extends: .test
+  rules:
+    - if: '$KERNEL_VERSION == $LATEST_KERNEL_VERSION'
+    - if: '$ALL_QEMU_JOBS == "true"'
+
 .build:qemu-amd64:
-  extends: .build
+  extends: .build-qemu
   variables:
     TARGET: qemu-amd64
 
 .lava-test:qemu-amd64:
-  extends: .test
+  extends: .test-qemu
   variables:
     TARGET: qemu-amd64
 
 .build:qemu-armhf:
-  extends: .build
+  extends: .build-qemu
   variables:
     TARGET: qemu-armhf
 
 .lava-test:qemu-armhf:
-  extends: .test
+  extends: .test-qemu
   variables:
     TARGET: qemu-armhf
 
 .build:qemu-arm64:
-  extends: .build
+  extends: .build-qemu
   variables:
     TARGET: qemu-arm64
 
 .lava-test:qemu-arm64:
-  extends: .test
+  extends: .test-qemu
   variables:
     TARGET: qemu-arm64
 
ci/xenomai_3_2_x.yml +1 -0
index 3ee0b7d..781eec8 100644
@@ -20,3 +20,4 @@ include:
 variables:
   XENOMAI_BUILD_OPTION: ":opt-xenomai-3.2.x.yml"
   XENOMAI_VERSION: "3.2.x"
+  LATEST_KERNEL_VERSION: "5.15"
ci/xenomai_next.yml +1 -0
index 3e4d513..b611e60 100644
@@ -19,3 +19,4 @@ include:
 variables:
   XENOMAI_BUILD_OPTION: ":opt-xenomai-next.yml"
   XENOMAI_VERSION: "next"
+  LATEST_KERNEL_VERSION: "6.1"
tests/README.md +0 -0
index 50942df..c092d54 100644

tests/README.md The following variables are used and set by the ci system: · line 115

Quoted 10 lines
tests/README.md +4 -0
@@ -106,6 +106,10 @@ The following variables are used and set by the ci system:
   - `ALT_DNS_SERVER`: optional, can be set to something like "8.8.8.8" to use a specific DNS server
   - `DISTRO_APT_PREMIRRORS`: optional, can be set to something like "deb\.debian\.org cdn-aws.deb.debian.org\n" to use a specific Debian mirror
 
+- CI job "filers":
+  - `ALL_QEMU_JOBS`: Default is false. Set to true to enable all qemu based jobs
+  - `LAVA_TESTS_ENABLED`: Default is true. Set to false to disable all LAVA jobs
+
 - LAVA settings:
   - `LAVA_MASTER_ACCOUNT`: lava master account name to register lavacli for test execution
   - `LAVA_MASTER_TOKEN`: token to connect with the lava master

This or patch 2 cause some overfiltering, only noticed now, see e.g.

https://source.denx.de/Xenomai/xenomai-images/-/pipelines/15462

Jan

Signature · 2 lines
Siemens AG, Technology
Competence Center Embedded Linux