Switch to uncompressed tools for gitea

Use uncompressed tools for gitea. Gitea compresses using .xz, including for
Windows, which does not have a native, built-in tool to uncompress that
format.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
Gabriel Adrian Samfira 2025-10-05 08:18:20 +00:00 committed by Gabriel
parent 1594887d23
commit 76f538ffb3
2 changed files with 8 additions and 9 deletions

View file

@ -57,10 +57,8 @@ function fail() {
function downloadAndExtractRunner() {
sendStatus "downloading tools from {{ .DownloadURL }}"
curl --retry 5 --retry-delay 5 --retry-connrefused --fail -L -o "/home/{{ .RunnerUsername }}/{{ .FileName }}" "{{ .DownloadURL }}" || fail "failed to download tools"
mkdir -p "$RUN_HOME" || fail "failed to create actions-runner folder"
sendStatus "extracting runner"
xz -d -c "/home/{{ .RunnerUsername }}/{{ .FileName }}" > "$RUN_HOME/act_runner" || fail "failed to extract runner"
mkdir -p "$RUN_HOME" || fail "failed to create actions-runner folder"
curl --retry 5 --retry-delay 5 --retry-connrefused --fail -L -o "$RUN_HOME/act_runner" "{{ .DownloadURL }}" || fail "failed to download tools"
chown {{ .RunnerUsername }}:{{ .RunnerGroup }} -R "$RUN_HOME"/ || fail "failed to change owner"
chmod +x "$RUN_HOME/act_runner" || fail "failed to set executable flag"
}

View file

@ -47,15 +47,15 @@ var nightlyActRunner = GiteaEntityTool{
Assets: []GiteaToolsAssets{
{
Name: "act_runner-nightly-linux-amd64.xz",
DownloadURL: "https://dl.gitea.com/act_runner/nightly/act_runner-nightly-linux-amd64.xz",
DownloadURL: "https://dl.gitea.com/act_runner/nightly/act_runner-nightly-linux-amd64",
},
{
Name: "act_runner-nightly-linux-arm64.xz",
DownloadURL: "https://dl.gitea.com/act_runner/nightly/act_runner-nightly-linux-arm64.xz",
DownloadURL: "https://dl.gitea.com/act_runner/nightly/act_runner-nightly-linux-arm64",
},
{
Name: "act_runner-nightly-windows-amd64.exe.xz",
DownloadURL: "https://dl.gitea.com/act_runner/nightly/act_runner-nightly-windows-amd64.exe.xz",
DownloadURL: "https://dl.gitea.com/act_runner/nightly/act_runner-nightly-windows-amd64.exe",
},
},
}
@ -207,8 +207,9 @@ func getTools(ctx context.Context, metadataURL string, useInternal bool) ([]comm
slog.InfoContext(ctx, "ignoring unrecognized tools os", "tool", asset.Name)
continue
}
if !strings.HasSuffix(asset.DownloadURL, ".xz") {
// filter out non compressed versions.
if strings.HasSuffix(asset.DownloadURL, ".xz") || strings.HasSuffix(asset.DownloadURL, ".sha256") {
// filter out compressed files and sha256 sums. Windows does not have any way to uncompress
// .xz by default.
continue
}
slog.DebugContext(ctx, "found valid tools", "download_url", asset.DownloadURL, "os", os, "arch", arch, "file_name", asset.Name)