To aid in debugging wierd CI failures we need greater information
about the CI runner environment. It is usually container based
and can have some unexpected characteristics that significantly
differ from a developer's local environment.

This captures the mount list, CPU model, memory information,
device node lists, kernel info, user identity and all environment
variables.

Since this information can get quite large it is not emitted
directly in the logs, rather it is exposed in job artifacts
under the "ci-runner-env" directory.

Signed-off-by: Daniel P. Berrangé <[email protected]>
---
 .gitlab-ci.d/base.yml               | 11 ++++++++++-
 .gitlab-ci.d/buildtest-template.yml |  2 ++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.d/base.yml b/.gitlab-ci.d/base.yml
index a75fb37d61..bec04138fa 100644
--- a/.gitlab-ci.d/base.yml
+++ b/.gitlab-ci.d/base.yml
@@ -141,6 +141,7 @@ variables:
     expire_in: 7 days
     paths:
       - build/meson-logs
+      - ci-runner-env
     reports:
       junit: build/meson-logs/*.junit.xml
   before_script:
@@ -150,7 +151,15 @@ variables:
     # Prevent logs (if any) from prior build job artifacts
     # from being duplicated in the new job artifacts
     - rm -f build/meson-logs/*
-    - test -f /packages.txt && cat /packages.txt
+    - mkdir -p ci-runner-env
+    - test -f /packages.txt && cp /packages.txt ci-runner-env/packages.txt
+    - cp /proc/mounts ci-runner-env/mounts.txt
+    - cp /proc/cpuinfo ci-runner-env/cpuinfo.txt
+    - cp /proc/meminfo ci-runner-env/meminfo.txt
+    - ls -l /dev > ci-runner-env/devices.txt
+    - uname -a > ci-runner-env/kernel.txt
+    - id -a > ci-runner-env/user.txt
+    - printenv | sort > ci-runner-env/environ.txt
     - section_end setup
 
 .base_meson_ccache_job_template:
diff --git a/.gitlab-ci.d/buildtest-template.yml 
b/.gitlab-ci.d/buildtest-template.yml
index 11d7a75667..e62b3f2123 100644
--- a/.gitlab-ci.d/buildtest-template.yml
+++ b/.gitlab-ci.d/buildtest-template.yml
@@ -38,6 +38,7 @@
     paths:
       - build
       - .git-submodule-status
+      - ci-runner-env
     exclude:
       - build/**/*.p
       - build/**/*.a.p
@@ -83,6 +84,7 @@
     paths:
       - build/meson-logs
       - build/tests/functional/*/*/*.log
+      - ci-runner-env
     reports:
       junit: build/meson-logs/*.junit.xml
   after_script:
-- 
2.54.0


Reply via email to