show all statuses on failure

This commit is contained in:
Earl Warren 2023-09-29 22:57:05 +02:00
parent fdd4ccf4c3
commit 64e3b2e23e
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -44,12 +44,20 @@ function build_runner() {
forgejo-runner --version
}
function get_status() {
local url="$1"
local repo="$2"
local sha="$3"
forgejo-curl.sh api_json $url/api/v1/repos/$repo/commits/$sha/status
}
function check_status() {
local url="$1"
local repo="$2"
local sha="$3"
local state=$(forgejo-curl.sh api_json $url/api/v1/repos/$repo/commits/$sha/status | jq --raw-output .state)
local state=$(get_status $url $repo $sha | jq --raw-output .state)
echo $state
test "$state" != "" -a "$state" != "pending" -a "$state" != "running" -a "$state" != "null"
}
@ -67,8 +75,8 @@ function wait_success() {
sleep $LOOP_DELAY
done
if ! test "$(check_status "$url" "$repo" "$sha")" = "success" ; then
get_status $url $repo $sha | jq .statuses
test "$FORGEJO_RUNNER_LOGS" && cat $FORGEJO_RUNNER_LOGS
forgejo-curl.sh api_json $url/api/v1/repos/$repo/commits/$sha/status | jq .
return 1
fi
}