Skip to contentSkip to conversation

CI: Add variables needed for k8s runners

PATCH In review Peter Hoyes 2 participants 6 messages Dec 16, 2022 – Jan 15, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 CI: Add variables needed for k8s runners

From: Peter Hoyes <[email protected]>

The Kas container needs to use the entrypoint as that is where the user changes from root to a normal user.

Also set the KUBERNETES_CPU_REQUEST to the variable CPU_REQUEST as this needs to be tuned per-deployment.

CPU_REQUEST has no value outside of Arm Corp. Gitlab CI allows for variables to be overridden by default. So, we can give it a default value of NULL/empty and have everything work internally and externally by default.

---
 .gitlab-ci.yml | 9 +++++++++
 1 file changed, 9 insertions(+)
.gitlab-ci.yml +9 -0
index 3f0e319..616626a 100644
@@ -1,5 +1,12 @@
 image: ghcr.io/siemens/kas/kas:latest-release
 
+variables:
+  CPU_REQUEST: ""
+  # These are needed as the k8s executor doesn't respect the container
+  # entrypoint by default
+  FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY: 0
+  FF_KUBERNETES_HONOR_ENTRYPOINT: 1
+
 stages:
   - prep
   - build
@@ -24,6 +31,8 @@ stages:
 # Generalised fragment to do a Kas build
 .build:
   extends: .setup
+  variables:
+    KUBERNETES_CPU_REQUEST: $CPU_REQUEST
   script:
     - KASFILES=$(./ci/jobs-to-kas "$CI_JOB_NAME")
     - kas shell --update --force-checkout $KASFILES -c 'cat conf/*.conf'
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/5 CI: add tags to all jobs

From: Peter Hoyes <[email protected]>

Tag all jobs with the DEFAULT_TAG variable so each instance can control what tags the jobs have.

---
 .gitlab-ci.yml | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
.gitlab-ci.yml +5 -1
index 616626a..7ec0bd0 100644
@@ -2,6 +2,7 @@ image: ghcr.io/siemens/kas/kas:latest-release
 
 variables:
   CPU_REQUEST: ""
+  DEFAULT_TAG: ""
   # These are needed as the k8s executor doesn't respect the container
   # entrypoint by default
   FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY: 0
@@ -13,6 +14,8 @@ stages:
 
 # Common job fragment to get a worker ready
 .setup:
+  tags:
+    - $DEFAULT_TAG
   stage: build
   interruptible: true
   variables:
@@ -65,7 +68,8 @@ machine-coverage:
   script:
     - ./ci/check-machine-coverage
   coverage: '/Coverage: \d+/'
-
+  tags:
+    - $DEFAULT_TAG
 
 #
 # Build stage, the actual build jobs
Signature · 1 line
2.25.1
#3 lore raw

PATCH 4/5 zephyr-core/zephyr-kernel: Use layer-relative require for version file

In reply to Peter Hoyes

From: Peter Hoyes <[email protected]>

The inclusion of the Zephyr version-specific .inc file is currently using a local include. Change to be layer-relative to support including files in other layers.

Change to use 'require' instead of 'include' so that an earlier error is printed if the file does not exist.

---
 .../recipes-kernel/zephyr-kernel/zephyr-kernel-src.inc          | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-src.inc +1 -1
index f28d1d4..3383894 100644
@@ -13,4 +13,4 @@ S = "${WORKDIR}/git"
 
 # Default to a stable version
 PREFERRED_VERSION_zephyr-kernel ??= "3.1.0"
-include zephyr-kernel-src-${PREFERRED_VERSION_zephyr-kernel}.inc
+require recipes-kernel/zephyr-kernel/zephyr-kernel-src-${PREFERRED_VERSION_zephyr-kernel}.inc
Signature · 1 line
2.25.1
#4 lore raw

PATCH 5/5 zephyr-core/zephyr-kernel: Inhibit packaging steps with the Zephyr SDK

In reply to Peter Hoyes

From: Peter Hoyes <[email protected]>

The packaging step includes post-processing of elf files using objcopy and strip from the Yocto toolchain. When using the Zephyr SDK, the Yocto toolchain is explicitly not built so it is not possible to run these steps. Therefore, inhibit them in zephyr-toolchain-zephyr.inc

---
 .../recipes-kernel/zephyr-kernel/zephyr-toolchain-zephyr.inc  | 4 ++++
 1 file changed, 4 insertions(+)
meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-toolchain-zephyr.inc +4 -0
index 9987e3c..a193314 100644
@@ -13,3 +13,7 @@ deltask generate_toolchain_file
 # Provide a suitable location to store the toolchain capabilites cache
 ZEPHYR_USER_CACHE_DIR = "${B}/.cache"
 EXTRA_OECMAKE:append = " -DUSER_CACHE_DIR=${ZEPHYR_USER_CACHE_DIR}"
+
+# Inhibit packaging steps that require the Yocto toolchain
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+INHIBIT_PACKAGE_STRIP = "1"
Signature · 1 line
2.25.1
Tested-by on v1 1/5
#5 lore raw
In reply to Peter Hoyes
Quoted 8 lines · Peter Hoyes

From: Peter Hoyes <[email protected]>

The Kas container needs to use the entrypoint as that is where the user changes from root to a normal user.

Also set the KUBERNETES_CPU_REQUEST to the variable CPU_REQUEST as this needs to be tuned per-deployment.

Quoted 8 lines

CPU_REQUEST has no value outside of Arm Corp. Gitlab CI allows for variables to be overridden by default. So, we can give it a default value of NULL/empty and have everything work internally and externally by default.

I ran this series (batched with the other patches destined for the langdale branch) through CI and it passes. See:
https://gitlab.com/jonmason00/meta-zephyr/-/pipelines/747805268

Quoted 34 lines
---
 .gitlab-ci.yml | 9 +++++++++
 1 file changed, 9 insertions(+)
.gitlab-ci.yml +9 -0
index 3f0e319..616626a 100644
@@ -1,5 +1,12 @@
 image: ghcr.io/siemens/kas/kas:latest-release
 
+variables:
+  CPU_REQUEST: ""
+  # These are needed as the k8s executor doesn't respect the container
+  # entrypoint by default
+  FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY: 0
+  FF_KUBERNETES_HONOR_ENTRYPOINT: 1
+
 stages:
   - prep
   - build
@@ -24,6 +31,8 @@ stages:
 # Generalised fragment to do a Kas build
 .build:
   extends: .setup
+  variables:
+    KUBERNETES_CPU_REQUEST: $CPU_REQUEST
   script:
     - KASFILES=$(./ci/jobs-to-kas "$CI_JOB_NAME")
     - kas shell --update --force-checkout $KASFILES -c 'cat conf/*.conf'
Signature · 1 line
2.25.1