Skip to contentSkip to conversation

CI: support extra kas files from environment

PATCH Applied [email protected] 2 participants 3 messages Jan 26, 2024 – Jan 27, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 CI: support extra kas files from environment

From: Ross Burton <[email protected]>

Extend jobs-to-kas so the first argument is still the GitLab job name, but allow further arguments to specify extra Kas files to use in addition.

Then add a variable EXTRA_KAS_FILES to the CI configuration that defaults to the empty string and pass this to jobs-to-kas.

This lets specific pipeline runs add extra Kas files, for example to use experimental branches or enable extra features without touching the CI directly.

---
 .gitlab-ci.yml |  3 ++-
 ci/jobs-to-kas | 26 +++++++++++++++++++++-----
 2 files changed, 23 insertions(+), 6 deletions(-)
.gitlab-ci.yml +2 -1
index 22ecfd71..4c6ce14a 100644
@@ -11,6 +11,7 @@ variables:
   FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY: 0
   ACS_TEST: 0
   ACS_TAG: ""
+  EXTRA_KAS_FILES: ""
 
 stages:
   - prep
@@ -61,7 +62,7 @@ stages:
     # Catch all for everything else
     - if: '$KERNEL != "linux-yocto-dev"'
   script:
-    - KASFILES=$(./ci/jobs-to-kas "$CI_JOB_NAME"):lockfile.yml
+    - KASFILES=$(./ci/jobs-to-kas "$CI_JOB_NAME" $EXTRA_KAS_FILES):lockfile.yml
     - kas dump --update --force-checkout --resolve-refs --resolve-env $KASFILES
     - kas build $KASFILES
     - ./ci/check-warnings $KAS_WORK_DIR/build/warnings.log
ci/jobs-to-kas +21 -5
index eea6e463..df81c2e3 100755
@@ -3,17 +3,28 @@
 # This script is expecting an input of machine name, optionally followed by a
 # colon and a list of one or more parameters separated by commas between
 # brackets.  For example, the following are acceptable:
-# corstone1000-mps3
-# fvp-base: [testimage]
-# qemuarm64-secureboot: [clang, glibc, testimage]
+#   corstone1000-mps3
+#   fvp-base: [testimage]
+#   qemuarm64-secureboot: [clang, glibc, testimage]
+# This argument should be quoted to avoid expansion and to be handled
+# as a single value.
+#
+# Any further arguments will be handled as further yml file basenames.
 #
 # Turn this list into a series of yml files separated by colons to pass to kas
 
 set -e -u
 
-FILES="ci/$(echo $1 | cut -d ':' -f 1).yml"
+# First, parse the GitLab CI job name (CI_JOB_NAME via $1) and accumulate a list
+# of Kas files.
+JOBNAME="$1"
+shift
+
+# The base name of the job
+FILES="ci/$(echo $JOBNAME | cut -d ':' -f 1).yml"
 
-for i in $(echo $1 | cut -s -d ':' -f 2 | sed 's/[][,]//g'); do
+# The list of matrix variations
+for i in $(echo $JOBNAME | cut -s -d ':' -f 2 | sed 's/[][,]//g'); do
 	# Given that there are no yml files for gcc or glibc, as those are the
 	# defaults, we can simply ignore those parameters.  They are necessary
 	# to pass in so that matrix can correctly setup all of the permutations
@@ -24,4 +35,9 @@ for i in $(echo $1 | cut -s -d ':' -f 2 | sed 's/[][,]//g'); do
 	FILES+=":ci/$i.yml"
 done
 
+# Now pick up any further names
+for i in $*; do
+	FILES+=":ci/$i.yml"
+done
+
 echo $FILES
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 CI/cve.yml: add a CVE-checking Kas fragment

From: Ross Burton <[email protected]>

Add a Kas fragment to enable the CVE checker. Disable warnings by default but show them for the layers in meta-arm, because we only care about meta-arm issues in this CI.

Explicitly hide kernel warnings as the kernel typically has tens of open CVEs, and if we're carrying a kernel explicitly then it's typically an interim kernel between releases.

---
 ci/cve.yml | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 ci/cve.yml
ci/cve.yml new file +16 -0
new file mode 100644
index 00000000..381f8557
@@ -0,0 +1,16 @@
+header:
+  version: 14
+
+local_conf_header:
+  cve: |
+    INHERIT += "cve-check"
+
+    # Just show the warnings for our layers
+    CVE_CHECK_SHOW_WARNINGS = "0"
+    CVE_CHECK_SHOW_WARNINGS:layer-arm-toolchain = "1"
+    CVE_CHECK_SHOW_WARNINGS:layer-meta-arm = "1"
+    CVE_CHECK_SHOW_WARNINGS:layer-meta-arm-bsp = "1"
+    CVE_CHECK_SHOW_WARNINGS:layer-meta-arm-systemready = "1"
+
+    # Ignore the kernel, we sometime carry kernels in meta-arm
+    CVE_CHECK_SHOW_WARNINGS:pn-linux-yocto = "0"
Signature · 1 line
2.34.1
Applied
#2 lore raw
In reply to [email protected]
Quoted 8 lines · On Fri, 26 Jan 2024 16:43:40 +0000, [email protected] wrote:

Extend jobs-to-kas so the first argument is still the GitLab job name, but allow further arguments to specify extra Kas files to use in addition.

Then add a variable EXTRA_KAS_FILES to the CI configuration that defaults to the empty string and pass this to jobs-to-kas.

[...]

Applied, thanks!

[1/2] CI: support extra kas files from environment

      commit: 827129b05b22ba4dc305cd23ec71cb2387dfdc22
[2/2] CI/cve.yml: add a CVE-checking Kas fragment
      commit: a91ddf4869806cbe92758f528afe4e51329e9ae0

Best regards,

Signature · 1 line
Jon Mason <[email protected]>