From 65c2ec64f6045b4a126d1b396c50ea74e99cb5ce Mon Sep 17 00:00:00 2001 From: casjay Date: Thu, 4 Jun 2026 17:13:51 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20act=5Frunner=20download:?= =?UTF-8?q?=20repo=20renamed,=20new=20binary=20names=20=F0=9F=90=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The gitea/act_runner repo was renamed to gitea/runner and binary filenames changed from act_runner-{ver}-linux-{arch} to gitea-runner-{ver}-linux-{arch} (with version stripping the leading 'v'). The old URLs returned 404 causing every build to fail. Also adds resilience for builds where gitea.com is unreachable: - 30s connect timeout / 45s max-time on API calls - Pinned fallback version (v1.0.8) used when API returns nothing - Fallback direct URL constructed from version tag without API - Empty-URL guard before curl invocation prevents blank-argument error - rootfs/root/docker/setup/05-custom.sh: fix repo path gitea/act_runner → gitea/runner, fix binary name pattern, add fallback version, add fallback URL construction, add empty-URL guard rootfs/root/docker/setup/05-custom.sh --- rootfs/root/docker/setup/05-custom.sh | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/rootfs/root/docker/setup/05-custom.sh b/rootfs/root/docker/setup/05-custom.sh index 2055875..06c06b0 100755 --- a/rootfs/root/docker/setup/05-custom.sh +++ b/rootfs/root/docker/setup/05-custom.sh @@ -32,8 +32,23 @@ GITEA_BIN_FILE="/usr/local/bin/gitea" ACT_BIN_FILE="/usr/local/bin/act_runner" ARCH="$(uname -m | tr '[:upper]' '[:lower]')" case "$ARCH" in x86_64) ARCH="amd64" ;; aarch64) ARCH="arm64" ;; *) echo "$ARCH is not supported by this script" >&2 && exit 1 ;; esac -ACT_VERSIONS="$(curl -q -LSsf 'https://gitea.com/api/v1/repos/gitea/act_runner/releases' -H 'accept: application/json' | jq -r '.[].tag_name' | sort -Vr | head -n1)" -ACT_URL="$(curl -q -LSsf "https://gitea.com/api/v1/repos/gitea/act_runner/releases/tags/$ACT_VERSIONS" -H 'accept: application/json' | jq -rc '.assets|.[]|.browser_download_url' | grep "linux.*$ARCH$")" +# Pinned fallback used when gitea.com is unreachable from the build host +# Repo was renamed gitea/act_runner -> gitea/runner; binaries are now gitea-runner-{ver}-linux-{arch} +ACT_RUNNER_FALLBACK_VERSION="${ACT_RUNNER_FALLBACK_VERSION:-v1.0.8}" +# Fetch latest version tag from the renamed repo — 30s connect timeout +ACT_VERSIONS="$(curl -q --connect-timeout 30 --max-time 45 -LSsf \ + 'https://gitea.com/api/v1/repos/gitea/runner/releases' \ + -H 'accept: application/json' 2>/dev/null | jq -r '.[].tag_name' | sort -Vr | head -n1)" +# Fall back to pinned version if API is unreachable +[ -z "$ACT_VERSIONS" ] && ACT_VERSIONS="$ACT_RUNNER_FALLBACK_VERSION" && echo "WARNING: gitea.com unreachable, using act_runner $ACT_VERSIONS" >&2 +# Fetch download URL from API; binary names use the version without leading 'v' +ACT_URL="$(curl -q --connect-timeout 30 --max-time 45 -LSsf \ + "https://gitea.com/api/v1/repos/gitea/runner/releases/tags/$ACT_VERSIONS" \ + -H 'accept: application/json' 2>/dev/null | jq -rc '.assets|.[]|.browser_download_url' | grep "linux-${ARCH}$")" +# If API parse yielded nothing, construct the direct download URL from the version +# Tag format: v1.0.8 → filename: gitea-runner-1.0.8-linux-amd64 (strip leading 'v') +ACT_VER_PLAIN="${ACT_VERSIONS#v}" +[ -z "$ACT_URL" ] && ACT_URL="https://gitea.com/gitea/runner/releases/download/${ACT_VERSIONS}/gitea-runner-${ACT_VER_PLAIN}-linux-${ARCH}" if [ -z "$GITEA_VERSION" ] || [ "$GITEA_VERSION" = "latest" ] || [ "$GITEA_VERSION" = "current" ]; then _latest_url="$(curl -4sfL -o /dev/null -w '%{url_effective}' https://github.com/go-gitea/gitea/releases/latest 2>/dev/null)" GITEA_VERSION="$(printf '%s\n' "$_latest_url" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')" @@ -60,7 +75,10 @@ else exitCode=$((exitCode + 1)) fi echo "Downloading act_runner from $ACT_URL" -if curl -q -LSsf "$ACT_URL" -o "/tmp/act_runner.$$"; then +if [ -z "$ACT_URL" ]; then + echo "Failed to resolve act_runner download URL" >&2 + exitCode=$((exitCode + 1)) +elif curl -q -LSsf "$ACT_URL" -o "/tmp/act_runner.$$"; then mv -f "/tmp/act_runner.$$" "$ACT_BIN_FILE" echo "act_runner has been installed to: $ACT_BIN_FILE" chmod +x "$ACT_BIN_FILE"