patchwork: Filter checks by CI prefix to avoid skipping untested series
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().
Signed-off-by Andrea Cervesato <[email protected]>
---
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
@@ -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
Hi!
I was wondering why some of the checks were not run.
Acked-by Cyril Hrubis <[email protected]>
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Merged
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp