Skip to contentSkip to conversation

patchwork: Filter checks by CI prefix to avoid skipping untested series

PATCH In review Andrea Cervesato 3 participants 3 messages Apr 9

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 patchwork: Filter checks by CI prefix to avoid skipping untested series

From: Andrea Cervesato <[email protected]>

Other CI systems adding checks to patches caused this CI to skip series it hadn't tested yet. Prefix check contexts with a configurable PATCHWORK_CI_PREFIX and filter by it in already_tested().

---
After adding copilot review we have a problem to run CI due to the build scripts. We need to verify that _only_ build checks were not added.

---
 ci/tools/patchwork.sh | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
ci/tools/patchwork.sh +11 -3
index 3e18ee9480c443837bc4269a408fc3151d76b165..affa7f2a0a6bb69079308ad6ada4bd6e7f296c26 100755
@@ -9,6 +9,7 @@
 
 PATCHWORK_URL="${PATCHWORK_URL:-https://patchwork.ozlabs.org}"
 PATCHWORK_SINCE="${PATCHWORK_SINCE:-3600}"
+PATCHWORK_CI_PREFIX="${PATCHWORK_CI_PREFIX:-github-build}"
 
 command_exists() {
         local cmd
@@ -93,13 +94,20 @@ set_series_state() {
 
 get_checks() {
         local patch_id="$1"
+        local prefix="$2"
         local stdout
 
         stdout="$(curl -k -G $PATCHWORK_URL/api/patches/$patch_id/checks/)"
 
         [ $? -eq 0 ] || exit 1
 
-        echo "$stdout" | jq -r '.[] | "\(.id)"'
+        if [ -n "$prefix" ]; then
+                echo "$stdout" | jq -r \
+                        --arg pfx "$prefix" \
+                        '.[] | select(.context | startswith($pfx)) | "\(.id)"'
+        else
+                echo "$stdout" | jq -r '.[] | "\(.id)"'
+        fi
 }
 
 already_tested() {
@@ -108,7 +116,7 @@ already_tested() {
         get_patches "$series_id" | while read -r patch_id; do
                 [ "$patch_id" ] || continue
 
-                get_checks "$patch_id" | while read -r check_id; do
+                get_checks "$patch_id" "$PATCHWORK_CI_PREFIX" | while read -r check_id; do
                         if [ -n "$check_id" ]; then
                                 echo "$check_id"
                                 return
@@ -146,7 +154,7 @@ send_results() {
 
         verify_token_exists
 
-        local context=$(echo "$3" | sed 's/:/_/g; s/\//-/g; s/\./-/g')
+        local context="$PATCHWORK_CI_PREFIX/$(echo "$3" | sed 's/:/_/g; s/\//-/g; s/\./-/g')"
 
         [ "$CC" ] && context="${context}_${CC}"
         [ "$ARCH" ] && context="${context}_${ARCH}"

---
base-commit: 3a4bf67d82eae0febb5462077fb43937e875e46e
change-id: 20260409-fix_ci_checks-9db08800880c

Best regards,

Signature · 5 lines
Andrea Cervesato <[email protected]>


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp