summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoropenshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com>2022-07-14 20:56:06 +0000
committerGitHub <noreply@github.com>2022-07-14 20:56:06 +0000
commit10bf85c07fefa4b02d90e8727b3d96109f37ab43 (patch)
tree568caa3f20c1a24bc0078c45f8ad7941c173655d
parentf6e41e77c75826b141291940e7678e63c0ec2351 (diff)
parentd95e79ebe3c620b15834c972c281442cfeb31c5a (diff)
downloadpodman-10bf85c07fefa4b02d90e8727b3d96109f37ab43.tar.gz
podman-10bf85c07fefa4b02d90e8727b3d96109f37ab43.tar.bz2
podman-10bf85c07fefa4b02d90e8727b3d96109f37ab43.zip
Merge pull request #14927 from cevich/fix_error_grep
[CI:DOCS] GHA: Fix dumb error check
-rwxr-xr-x.github/actions/check_cirrus_cron/cron_failures.sh20
1 files changed, 13 insertions, 7 deletions
diff --git a/.github/actions/check_cirrus_cron/cron_failures.sh b/.github/actions/check_cirrus_cron/cron_failures.sh
index 4fb3af98f..f4dddff8b 100755
--- a/.github/actions/check_cirrus_cron/cron_failures.sh
+++ b/.github/actions/check_cirrus_cron/cron_failures.sh
@@ -67,11 +67,6 @@ jq --indent 4 --color-output . <./artifacts/reply.json || \
cat ./artifacts/reply.json
echo "::endgroup::"
-# Desirable to catch non-JSON encoded errors in reply.
-if grep -qi 'error' ./artifacts/reply.json; then
- err "Found the word 'error' in reply"
-fi
-
# e.x. reply.json
# {
# "data": {
@@ -102,8 +97,19 @@ fi
# }
# }
# }
-_filt='.data.ownerRepository.cronSettings | map(select(.lastInvocationBuild.status=="FAILED") | { name:.name, id:.lastInvocationBuild.id} | join(" ")) | join("\n")'
-jq --raw-output "$_filt" ./artifacts/reply.json > "$NAME_ID_FILEPATH"
+
+# This should never ever return an empty-list, unless there are no cirrus-cron
+# jobs defined for the repository. In that case, this monitoring script shouldn't
+# be running anyway.
+filt_head='.data.ownerRepository.cronSettings'
+if ! jq -e "$filt_head" ./artifacts/reply.json &> /dev/null
+then
+ # Actual colorized JSON reply was printed above
+ err "Null/empty result filtering reply with '$filt_head'"
+fi
+
+filt="$filt_head | map(select(.lastInvocationBuild.status==\"FAILED\") | { name:.name, id:.lastInvocationBuild.id} | join(\" \")) | join(\"\n\")"
+jq --raw-output "$filt" ./artifacts/reply.json > "$NAME_ID_FILEPATH"
echo "<Cron Name> <Failed Build ID>"
cat "$NAME_ID_FILEPATH"