Skip to contentSkip to conversation

CI: Misc improvements

PATCH In review Andrew Cooper 5 participants 13 messages May 29, 2024 – May 31, 2024

lore
Share & tools
lore
#0 lore raw

cover CI: Misc improvements

All found while making extensive use of Gitlab CI for the bitops boot testing.

For 4.19. It's all very low risk, and improves the utility/useability of our testing.

Andrew Cooper (3):
CI: Remove CI_COMMIT_REF_PROTECTED requirement for HW jobs
CI: Use a debug build of Xen for the Xilinx HW tests
CI: Improve serial handling in qemu-smoke-ppc64le.sh

 automation/gitlab-ci/test.yaml           |  8 ++++----
 automation/scripts/qemu-smoke-ppc64le.sh | 13 +++++++------
 2 files changed, 11 insertions(+), 10 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/3 CI: Remove CI_COMMIT_REF_PROTECTED requirement for HW jobs

This restriction doesn't provide any security because anyone with suitable permissions on the HW runners can bypass it with this local patch.

Requiring branches to be protected hampers usability of transient testing branches (specifically, can't delete branches except via the Gitlab UI).

Drop the requirement.

Fixes 746774cd1786 ("automation: introduce a dom0less test run on Xilinx hardware")
Fixes 0ab316e7e15f ("automation: add a smoke and suspend test on an Alder Lake system")

---
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>
CC: Oleksii Kurochko <[email protected]>

Fixes because this wants backporting, but it also needs acks from both Marek and Stefano as the owners of the hardware in question.

---
 automation/gitlab-ci/test.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
automation/gitlab-ci/test.yaml +2 -2
index ad249fa0a5d9..efd3ad46f08e 100644
@@ -92,7 +92,7 @@
     when: always
   only:
     variables:
-      - $XILINX_JOBS == "true" && $CI_COMMIT_REF_PROTECTED == "true"
+      - $XILINX_JOBS == "true"
   tags:
     - xilinx
 
@@ -112,7 +112,7 @@
     when: always
   only:
     variables:
-      - $QUBES_JOBS == "true" && $CI_COMMIT_REF_PROTECTED == "true"
+      - $QUBES_JOBS == "true"
   tags:
     - qubes-hw2
 
Signature · 1 line
2.30.2
#2 lore raw

Re: [PATCH 1/3] CI: Remove CI_COMMIT_REF_PROTECTED requirement for HW jobs

Quoted 11 lines · Andrew Cooper

This restriction doesn't provide any security because anyone with suitable permissions on the HW runners can bypass it with this local patch.

Requiring branches to be protected hampers usability of transient testing branches (specifically, can't delete branches except via the Gitlab UI).

Drop the requirement.

Fixes 746774cd1786 ("automation: introduce a dom0less test run on Xilinx hardware")
Fixes 0ab316e7e15f ("automation: add a smoke and suspend test on an Alder Lake system")

Runners used to be set to run only on protected branches. I think it isn't the case anymore from what I see, but it needs checking (I don't see specific settings in all the projects). If it were still the case, removing variable check would result in jobs forever pending.

Other than that, I'm okay with this change, since the hw runners are added only to select projects. You can interpret this as Acked-by, if you verify if indeed runners are not limited to protected branches only.

I will need to adjust setting of my project, to set "QUBES_JOBS" only to some branches - I used to use branch protection rules as a proxy to selecting on which branch to run hw tests...

Quoted 38 lines

---
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>
CC: Oleksii Kurochko <[email protected]>

Fixes because this wants backporting, but it also needs acks from both Marek and Stefano as the owners of the hardware in question.

---
 automation/gitlab-ci/test.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
automation/gitlab-ci/test.yaml +2 -2
index ad249fa0a5d9..efd3ad46f08e 100644
@@ -92,7 +92,7 @@
     when: always
   only:
     variables:
-      - $XILINX_JOBS == "true" && $CI_COMMIT_REF_PROTECTED == "true"
+      - $XILINX_JOBS == "true"
   tags:
     - xilinx
 
@@ -112,7 +112,7 @@
     when: always
   only:
     variables:
-      - $QUBES_JOBS == "true" && $CI_COMMIT_REF_PROTECTED == "true"
+      - $QUBES_JOBS == "true"
   tags:
     - qubes-hw2
 
Signature · 1 line
2.30.2
Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
#3 lore raw

Re: [PATCH 1/3] CI: Remove CI_COMMIT_REF_PROTECTED requirement for HW jobs

Quoted 9 lines · Marek Marczykowski-Górecki
Quoted 8 lines · Andrew Cooper

This restriction doesn't provide any security because anyone with suitable permissions on the HW runners can bypass it with this local patch.

Requiring branches to be protected hampers usability of transient testing branches (specifically, can't delete branches except via the Gitlab UI).

Drop the requirement.

Quoted 8 lines
Quoted 3 lines
Fixes 746774cd1786 ("automation: introduce a dom0less test run on Xilinx hardware")
Fixes 0ab316e7e15f ("automation: add a smoke and suspend test on an Alder Lake system")

Runners used to be set to run only on protected branches. I think it isn't the case anymore from what I see, but it needs checking (I don't see specific settings in all the projects). If it were still the case, removing variable check would result in jobs forever pending.

Andrew, thank you so much for pointing this out.

I think the idea was that we can specify the individual users with access to protected branches. We cannot add restrictions for unprotected branches. So if we set the gitlab runner to only run protected jobs, then the $CI_COMMIT_REF_PROTECTED check makes sense. Not for security, but to prevent the jobs from getting stuck waiting for a runner that will never arrive.

However, like Marek said, now the gitlab runners don't have the "Protected" check set, so it is all useless :-(

I would prefer to set "Protected" in the gitlab runners settings so that it becomes easier to specify users that can and cannot trigger the jobs.

Then, we'll need the $CI_COMMIT_REF_PROTECTED check, not for security, but to avoid pipelines getting stuck for unprotected branches.

It is really difficult to restrict users from triggering jobs in other way because they are all automatically added to all subprojects.

Would you guys be OK if I set "Protected" in the Xilinx and Qubes gitlab runners as soon as possible?

#4 lore raw

Re: [PATCH 1/3] CI: Remove CI_COMMIT_REF_PROTECTED requirement for HW jobs

Quoted 28 lines · Stefano Stabellini
Quoted 9 lines · Marek Marczykowski-Górecki
Quoted 8 lines · Andrew Cooper

This restriction doesn't provide any security because anyone with suitable permissions on the HW runners can bypass it with this local patch.

Requiring branches to be protected hampers usability of transient testing branches (specifically, can't delete branches except via the Gitlab UI).

Drop the requirement.

Quoted 8 lines
Quoted 3 lines
Fixes 746774cd1786 ("automation: introduce a dom0less test run on Xilinx hardware")
Fixes 0ab316e7e15f ("automation: add a smoke and suspend test on an Alder Lake system")

Runners used to be set to run only on protected branches. I think it isn't the case anymore from what I see, but it needs checking (I don't see specific settings in all the projects). If it were still the case, removing variable check would result in jobs forever pending.

Andrew, thank you so much for pointing this out.

I think the idea was that we can specify the individual users with access to protected branches. We cannot add restrictions for unprotected branches. So if we set the gitlab runner to only run protected jobs, then the $CI_COMMIT_REF_PROTECTED check makes sense. Not for security, but to prevent the jobs from getting stuck waiting for a runner that will never arrive.

Quoted 5 lines

However, like Marek said, now the gitlab runners don't have the "Protected" check set, so it is all useless :-(

I would prefer to set "Protected" in the gitlab runners settings so that it becomes easier to specify users that can and cannot trigger the jobs.

Owners of subprojects can control branch protection rules, so this feature doesn't help with limiting access to runners added to the whole group. Qubes runners are not group runners, they are project runners added only to select projects.

I don't remember why exactly runners got "protected" disabled, but AFAIR there was some issue with that setting.

Quoted 9 lines

Then, we'll need the $CI_COMMIT_REF_PROTECTED check, not for security, but to avoid pipelines getting stuck for unprotected branches.

It is really difficult to restrict users from triggering jobs in other way because they are all automatically added to all subprojects.

Would you guys be OK if I set "Protected" in the Xilinx and Qubes gitlab runners as soon as possible?

Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
#5 lore raw

PATCH 2/3 CI: Use a debug build of Xen for the Xilinx HW tests

In reply to Andrew Cooper

... like the other hardware tests. This gets more value out of the testing.

---
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>
CC: Oleksii Kurochko <[email protected]>

---
 automation/gitlab-ci/test.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
automation/gitlab-ci/test.yaml +2 -2
index efd3ad46f08e..e96ccdfad54c 100644
@@ -149,7 +149,7 @@ xilinx-smoke-dom0less-arm64-gcc:
     - ./automation/scripts/xilinx-smoke-dom0less-arm64.sh 2>&1 | tee ${LOGFILE}
   needs:
     - *arm64-test-needs
-    - alpine-3.18-gcc-arm64
+    - alpine-3.18-gcc-debug-arm64
 
 xilinx-smoke-dom0less-arm64-gcc-gem-passthrough:
   extends: .xilinx-arm64
@@ -157,7 +157,7 @@ xilinx-smoke-dom0less-arm64-gcc-gem-passthrough:
     - ./automation/scripts/xilinx-smoke-dom0less-arm64.sh gem-passthrough 2>&1 | tee ${LOGFILE}
   needs:
     - *arm64-test-needs
-    - alpine-3.18-gcc-arm64
+    - alpine-3.18-gcc-debug-arm64
 
 adl-smoke-x86-64-gcc-debug:
   extends: .adl-x86-64
Signature · 1 line
2.30.2
Reviewed-by on v1 2/3
#6 lore raw

Re: [PATCH 2/3] CI: Use a debug build of Xen for the Xilinx HW tests

Hi Andrew,

Quoted 20 lines · Andrew Cooper

... like the other hardware tests. This gets more value out of the testing.

---
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>
CC: Oleksii Kurochko <[email protected]>

---
 automation/gitlab-ci/test.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
automation/gitlab-ci/test.yaml +0 -0
index efd3ad46f08e..e96ccdfad54c 100644

automation/gitlab-ci/test.yaml xilinx-smoke-dom0less-arm64-gcc: · line 152

Quoted 5 lines
automation/gitlab-ci/test.yaml +1 -1
@@ -149,7 +149,7 @@ xilinx-smoke-dom0less-arm64-gcc:
     - ./automation/scripts/xilinx-smoke-dom0less-arm64.sh 2>&1 | tee ${LOGFILE}
   needs:
     - *arm64-test-needs
-    - alpine-3.18-gcc-arm64
+    - alpine-3.18-gcc-debug-arm64

This change should be reflected in the name of the test changed (here and below), so that it contains -debug suffix just like every other debug job. With that done:

~Michal

#7 lore raw

Re: [PATCH 2/3] CI: Use a debug build of Xen for the Xilinx HW tests

Quoted 29 lines · Michal Orzel

Hi Andrew,

Quoted 19 lines · Andrew Cooper

... like the other hardware tests. This gets more value out of the testing.

---
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>
CC: Oleksii Kurochko <[email protected]>

---
 automation/gitlab-ci/test.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
automation/gitlab-ci/test.yaml +0 -0
index efd3ad46f08e..e96ccdfad54c 100644

automation/gitlab-ci/test.yaml xilinx-smoke-dom0less-arm64-gcc: · line 152

Quoted 5 lines
automation/gitlab-ci/test.yaml +1 -1
@@ -149,7 +149,7 @@ xilinx-smoke-dom0less-arm64-gcc:
     - ./automation/scripts/xilinx-smoke-dom0less-arm64.sh 2>&1 | tee ${LOGFILE}
   needs:
     - *arm64-test-needs
-    - alpine-3.18-gcc-arm64
+    - alpine-3.18-gcc-debug-arm64

This change should be reflected in the name of the test changed (here and below), so that it contains -debug suffix just like every other debug job. With that done:

Quoted 1 line

Wow, this is a giant mess.  There's no consistency anywhere.

I've got a debug suffix for this one, and a debug infix for the other one, but I'm seriously tempted to sed over the whole config and clean this up for once and for all.

~Andrew

#8 lore raw

Re: [PATCH 2/3] CI: Use a debug build of Xen for the Xilinx HW tests

In reply to Michal Orzel
Quoted 30 lines · Michal Orzel

Hi Andrew,

Quoted 20 lines · Andrew Cooper

... like the other hardware tests. This gets more value out of the testing.

---
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>
CC: Oleksii Kurochko <[email protected]>

---
 automation/gitlab-ci/test.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
automation/gitlab-ci/test.yaml +0 -0
index efd3ad46f08e..e96ccdfad54c 100644

automation/gitlab-ci/test.yaml xilinx-smoke-dom0less-arm64-gcc: · line 152

Quoted 5 lines
automation/gitlab-ci/test.yaml +1 -1
@@ -149,7 +149,7 @@ xilinx-smoke-dom0less-arm64-gcc:
     - ./automation/scripts/xilinx-smoke-dom0less-arm64.sh 2>&1 | tee ${LOGFILE}
   needs:
     - *arm64-test-needs
-    - alpine-3.18-gcc-arm64
+    - alpine-3.18-gcc-debug-arm64

This change should be reflected in the name of the test changed (here and below), so that it contains -debug suffix just like every other debug job. With that done:

Quoted 1 line

Ops, good catch! I missed it

Acked-by on v1 2/3
#9 lore raw

Re: [PATCH 2/3] CI: Use a debug build of Xen for the Xilinx HW tests

In reply to Andrew Cooper
Quoted 3 lines · Andrew Cooper

... like the other hardware tests. This gets more value out of the testing.

Quoted 35 lines

---
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>
CC: Oleksii Kurochko <[email protected]>

---
 automation/gitlab-ci/test.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
automation/gitlab-ci/test.yaml +2 -2
index efd3ad46f08e..e96ccdfad54c 100644
@@ -149,7 +149,7 @@ xilinx-smoke-dom0less-arm64-gcc:
     - ./automation/scripts/xilinx-smoke-dom0less-arm64.sh 2>&1 | tee ${LOGFILE}
   needs:
     - *arm64-test-needs
-    - alpine-3.18-gcc-arm64
+    - alpine-3.18-gcc-debug-arm64
 
 xilinx-smoke-dom0less-arm64-gcc-gem-passthrough:
   extends: .xilinx-arm64
@@ -157,7 +157,7 @@ xilinx-smoke-dom0less-arm64-gcc-gem-passthrough:
     - ./automation/scripts/xilinx-smoke-dom0less-arm64.sh gem-passthrough 2>&1 | tee ${LOGFILE}
   needs:
     - *arm64-test-needs
-    - alpine-3.18-gcc-arm64
+    - alpine-3.18-gcc-debug-arm64
 
 adl-smoke-x86-64-gcc-debug:
   extends: .adl-x86-64
Signature · 1 line
2.30.2
#10 lore raw

PATCH 3/3 CI: Improve serial handling in qemu-smoke-ppc64le.sh

In reply to Andrew Cooper

Have PPC put serial to stdout like all other tests, so it shows up in the main job log.

---
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>
CC: Oleksii Kurochko <[email protected]>

---
 automation/scripts/qemu-smoke-ppc64le.sh | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
automation/scripts/qemu-smoke-ppc64le.sh +7 -6
index 2adbdac87ef5..701d81107d18 100755
@@ -2,15 +2,15 @@
 
 set -ex
 
+serial_log="$(pwd)/smoke.serial"
+
 # machine type from first arg passed directly to qemu -M
 machine=$1
 
 # Run the test
-rm -f smoke.serial
+rm -f ${serial_log}
 set +e
 
-touch smoke.serial
-
 timeout -k 1 20 \
 binaries/qemu-system-ppc64 \
     -bios binaries/skiboot.lid \
@@ -20,9 +20,10 @@ binaries/qemu-system-ppc64 \
     -vga none \
     -monitor none \
     -nographic \
-    -serial file:smoke.serial \
-    -kernel binaries/xen
+    -serial stdio \
+    -kernel binaries/xen \
+    |& tee ${serial_log} | sed 's/\r//'
 
 set -e
-(grep -q "Hello, ppc64le!" smoke.serial) || exit 1
+(grep -q "Hello, ppc64le!" ${serial_log}) || exit 1
 exit 0
Signature · 1 line
2.30.2
Reviewed-by on v1 3/3
#11 lore raw

Re: [PATCH 3/3] CI: Improve serial handling in qemu-smoke-ppc64le.sh

Quoted 4 lines · Andrew Cooper

Have PPC put serial to stdout like all other tests, so it shows up in the main job log.

Quoted 50 lines

---
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>
CC: Oleksii Kurochko <[email protected]>

---
 automation/scripts/qemu-smoke-ppc64le.sh | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
automation/scripts/qemu-smoke-ppc64le.sh +7 -6
index 2adbdac87ef5..701d81107d18 100755
@@ -2,15 +2,15 @@
 
 set -ex
 
+serial_log="$(pwd)/smoke.serial"
+
 # machine type from first arg passed directly to qemu -M
 machine=$1
 
 # Run the test
-rm -f smoke.serial
+rm -f ${serial_log}
 set +e
 
-touch smoke.serial
-
 timeout -k 1 20 \
 binaries/qemu-system-ppc64 \
     -bios binaries/skiboot.lid \
@@ -20,9 +20,10 @@ binaries/qemu-system-ppc64 \
     -vga none \
     -monitor none \
     -nographic \
-    -serial file:smoke.serial \
-    -kernel binaries/xen
+    -serial stdio \
+    -kernel binaries/xen \
+    |& tee ${serial_log} | sed 's/\r//'
 
 set -e
-(grep -q "Hello, ppc64le!" smoke.serial) || exit 1
+(grep -q "Hello, ppc64le!" ${serial_log}) || exit 1
 exit 0
Signature · 1 line
2.30.2
#12 lore raw
In reply to Andrew Cooper
Quoted 6 lines · Andrew Cooper

All found while making extensive use of Gitlab CI for the bitops boot testing.

For 4.19.  It's all very low risk, and improves the utility/useability of our
testing.

~ Oleksii

Quoted 10 lines

Andrew Cooper (3):
  CI: Remove CI_COMMIT_REF_PROTECTED requirement for HW jobs
  CI: Use a debug build of Xen for the Xilinx HW tests
  CI: Improve serial handling in qemu-smoke-ppc64le.sh

 automation/gitlab-ci/test.yaml           |  8 ++++---- automation/scripts/qemu-smoke-ppc64le.sh | 13 +++++++------

 2 files changed, 11 insertions(+), 10 deletions(-)