Skip to contentSkip to conversation

CI: remove cve.yml and NVDCVE_API_KEY

PATCH New Ross Burton 1 participant 4 messages Jun 17

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 CI: remove cve.yml and NVDCVE_API_KEY

This yml fragment wasn't actually used by our CI, and the cve-check class no longer exists.

---
 .gitlab-ci.yml |  2 --
 ci/cve.yml     | 20 --------------------
 2 files changed, 22 deletions(-)
 delete mode 100644 ci/cve.yml
.gitlab-ci.yml +0 -2
index c5bb96c997..577935366e 100644
@@ -15,8 +15,6 @@ variables:
   MIRROR_GHCR: ghcr.io
   # The list of extra Kas fragments to be used when building
   EXTRA_KAS_FILES: ""
-  # The NVD API key to use when fetching CVEs
-  NVDCVE_API_KEY: ""
 
 stages:
   - prep
ci/cve.yml deleted +0 -20
deleted file mode 100644
index 5ac2e41241..0000000000
@@ -1,20 +0,0 @@
-# yaml-language-server: $schema=https://raw.githubusercontent.com/siemens/kas/master/kas/schema-kas.json
-
-header:
-  version: 14
-
-local_conf_header:
-  cve: |
-    INHERIT += "cve-check"
-
-    # Allow the runner environment to provide an API key
-    NVDCVE_API_KEY = "${@d.getVar('BB_ORIGENV').getVar('NVDCVE_API_KEY') or ''}"
-
-    # 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"
-
-    # Ignore the kernel, we sometime carry kernels in meta-arm
-    CVE_CHECK_SHOW_WARNINGS:pn-linux-yocto = "0"
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/4 CI: default CACHE_DIR to CI_PROJECT_DIR

Set the default cache directory to be the build tree so we don't assume anything about the runner environment by default.

After this change, runners that don't set CACHE_DIR will need to set it explicltly in their variables.

---
 .gitlab-ci.yml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
.gitlab-ci.yml +4 -2
index 577935366e..5861dcf408 100644
@@ -9,8 +9,10 @@ variables:
   CPU_REQUEST: ""
   # The default machine tag for the build jobs
   DEFAULT_TAG: ""
-  # The directory to use as the persistent cache (the root for DL_DIR, SSTATE_DIR, etc)
-  CACHE_DIR: $CI_BUILDS_DIR/persist
+  # The directory to use as the persistent cache (the root for DL_DIR,
+  # SSTATE_DIR, etc). The default is the build tree which will not be
+  # persistent, so this should be set in the runner.
+  CACHE_DIR: $CI_PROJECT_DIR
   # The container mirror to use
   MIRROR_GHCR: ghcr.io
   # The list of extra Kas fragments to be used when building
Signature · 1 line
2.43.0
#2 lore raw

PATCH 3/4 CI: use a single multiline script statement in .build

In reply to Ross Burton

No change to the script, just formatting.

---
 .gitlab-ci.yml | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
.gitlab-ci.yml +7 -7
index 5861dcf408..b285698f47 100644
@@ -61,13 +61,13 @@ stages:
     # Catch all for everything else
     - if: '$KERNEL != "linux-yocto-dev"'
   script:
-    - KASFILES=$(./ci/jobs-to-kas "$CI_JOB_NAME" $EXTRA_KAS_FILES):lockfile.yml
-    - echo KASFILES=$KASFILES
-    - kas dump --update --force-checkout --resolve-refs --resolve-env $KASFILES
-    - kas build $KASFILES
-    - ./ci/check-warnings $KAS_BUILD_DIR/warnings.log
-    - kas shell ci/base.yml:lockfile.yml --command "$CI_PROJECT_DIR/ci/junit.sh $KAS_WORK_DIR/build"
-
+    - |
+      KASFILES=$(./ci/jobs-to-kas "$CI_JOB_NAME" $EXTRA_KAS_FILES):lockfile.yml
+      echo KASFILES=$KASFILES
+      kas dump --update --force-checkout --resolve-refs --resolve-env $KASFILES
+      kas build $KASFILES
+      ./ci/check-warnings $KAS_BUILD_DIR/warnings.log
+      kas shell ci/base.yml:lockfile.yml --command "$CI_PROJECT_DIR/ci/junit.sh $KAS_WORK_DIR/build"
   artifacts:
     name: "logs"
     when: on_failure
Signature · 1 line
2.43.0
#3 lore raw

PATCH 4/4 CI: add option to control whether warnings should be fatal or not

In reply to Ross Burton

Warnings being always fatal is quite anti-social because sometimes there are temporary warnings that we don't want to break the CI.

---
 .gitlab-ci.yml | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
.gitlab-ci.yml +5 -1
index b285698f47..5059699ee5 100644
@@ -17,6 +17,8 @@ variables:
   MIRROR_GHCR: ghcr.io
   # The list of extra Kas fragments to be used when building
   EXTRA_KAS_FILES: ""
+  # Whether warnings should be fatal (0/1)
+  FATAL_WARNINGS: 0
 
 stages:
   - prep
@@ -66,7 +68,9 @@ stages:
       echo KASFILES=$KASFILES
       kas dump --update --force-checkout --resolve-refs --resolve-env $KASFILES
       kas build $KASFILES
-      ./ci/check-warnings $KAS_BUILD_DIR/warnings.log
+      if [ $FATAL_WARNINGS -ne 0 ]; then
+        ./ci/check-warnings $KAS_BUILD_DIR/warnings.log
+      fi
       kas shell ci/base.yml:lockfile.yml --command "$CI_PROJECT_DIR/ci/junit.sh $KAS_WORK_DIR/build"
   artifacts:
     name: "logs"
Signature · 1 line
2.43.0