fixed idle error
This commit is contained in:
parent
e85966c361
commit
a5cbcc62f9
2 changed files with 37 additions and 0 deletions
|
|
@ -23,6 +23,35 @@ if [ -z "$CALLBACK_URL" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$GITHUB_URL" ]; then
|
||||
echo "GITHUB_URL is not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$RUNNER_NAME" ]; then
|
||||
echo "RUNNER_NAME is not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$BEARER_TOKEN" ]; then
|
||||
echo "BEARER_TOKEN is not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function success() {
|
||||
MSG="$1"
|
||||
ID=${2:-null}
|
||||
|
||||
call "{\"status\": \"idle\", \"message\": \"$MSG\", \"agent_id\": $ID}"
|
||||
}
|
||||
|
||||
function call() {
|
||||
PAYLOAD="$1"
|
||||
local cb_url=$CALLBACK_URL
|
||||
[[ $cb_url =~ ^(.*)/status(/)?$ ]] || cb_url="${cb_url}/status"
|
||||
curl --retry 5 --retry-delay 5 --retry-connrefused --fail -s -X POST -d "${PAYLOAD}" -H 'Accept: application/json' -H "Authorization: Bearer ${BEARER_TOKEN}" "${cb_url}" || echo "failed to call home: exit code ($?)"
|
||||
}
|
||||
|
||||
# retrieve runner secret from garm
|
||||
RUNNER_SECRET=$(curl --retry 5 --retry-delay 5 --retry-connrefused --fail -v -X GET -H 'Accept: application/json' -H "Authorization: Bearer ${BEARER_TOKEN}" "${METADATA_URL}/runner-registration-token/")
|
||||
|
||||
|
|
@ -36,6 +65,8 @@ forgejo-runner \
|
|||
|
||||
forgejo-runner generate-config > config.yml;
|
||||
|
||||
success "runner should be working"
|
||||
|
||||
unset RUNNER_SECRET
|
||||
unset BEARER_TOKEN
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue