#!/bin/bash # SPDX-License-Identifier: MIT # RUNNER_HOME=${RUNNER_HOME:-/data} set -ex set -o pipefail if [ ! -d "${RUNNER_HOME}" ]; then log.error "$RUNNER_HOME should be an emptyDir mount. Please fix the pod spec." exit 1 fi if [ -z "$METADATA_URL" ]; then echo "no token is available and METADATA_URL is not set" exit 1 fi if [ -z "$CALLBACK_URL" ]; then echo "CALLBACK_URL is not set" exit 1 fi # 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/") forgejo-runner \ register \ --no-interactive \ --token ${RUNNER_SECRET} \ --name ${RUNNER_NAME} \ --instance ${GITHUB_URL} \ --labels ubuntu-host:host forgejo-runner generate-config > config.yml; unset RUNNER_SECRET unset BEARER_TOKEN /bin/forgejo-runner --config config.yml daemon