Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/1449 Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org> Co-authored-by: Andreas Ahlenstorf <andreas@ahlenstorf.ch> Co-committed-by: Andreas Ahlenstorf <andreas@ahlenstorf.ch>
40 lines
1.4 KiB
Bash
40 lines
1.4 KiB
Bash
source "lib/lib.sh"
|
|
|
|
api="$url/api/v1"
|
|
|
|
function main() {
|
|
local repo
|
|
repo="root/example-$example"
|
|
|
|
secret="$(openssl rand -hex 20)"
|
|
runner_name="runner-$(openssl rand -hex 5)"
|
|
|
|
create_offline_registration_token "$runner_name" root "$secret"
|
|
|
|
# Changing to $DIR is necessary so that `.runner` gets created there. Otherwise, `forgejo-runner` would not pick it up.
|
|
pushd "$DIR" || exit 1
|
|
./forgejo-runner -c "$EXAMPLE_DIR/runner-config.yaml" create-runner-file --instance "http://$IP:3000" --name "$runner_name" --secret "$secret" --connect
|
|
popd || exit 1
|
|
|
|
FORGEJO_RUNNER_CONFIG="$EXAMPLE_DIR/runner-config.yaml" forgejo-runner.sh reload
|
|
|
|
label_count=$(jq '.labels | length ' "$DIR/.runner")
|
|
if [[ "$label_count" != "1" ]] ; then
|
|
echo "Unexpected number of labels in .runner file: $label_count instead of 1" >&2
|
|
exit 1
|
|
fi
|
|
|
|
runner_label=$(jq -r '.labels[0]' "$DIR/.runner")
|
|
if [[ "$runner_label" != "create-runner-file:docker://code.forgejo.org/oci/node:24-trixie" ]] ; then
|
|
echo "Unexpected runner label: '$runner_label' instead of create-runner-file:docker://code.forgejo.org/oci/node:24-trixie" >&2
|
|
exit 1
|
|
fi
|
|
|
|
forgejo-test-helper.sh push_workflow "actions/example-$example" "$url" root "example-$example" setup-forgejo "$token"
|
|
|
|
local sha
|
|
sha="$(forgejo-test-helper.sh branch_tip "$url" "$repo" main)"
|
|
forgejo-test-helper.sh wait_success "$url" "$repo" "$sha"
|
|
}
|
|
|
|
main
|