Skip to content

Commit 2773d83

Browse files
committed
Fix ARM runner by downloading correct architecture binary
The ARM instances were failing because the parent gha_runner module always provides the x64 runner download URL. ARM instances need the arm64 binary instead. Added architecture detection in the userdata script: - Detect if running on ARM (aarch64/arm64) - Replace 'x64' with 'arm64' in the download URL for ARM - Download the correct architecture-specific runner binary This fixes the issue where ARM instances would download an x64 binary that couldn't execute, causing registration to fail and the failsafe to terminate the instance.
1 parent 69b6a6a commit 2773d83

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/ec2_gha/templates/user-script.sh.templ

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,17 @@ echo "$script" > pre-runner-script.sh
211211
echo "[$$(date '+%Y-%m-%d %H:%M:%S')] Running pre-runner script"
212212
source pre-runner-script.sh
213213
export RUNNER_ALLOW_RUNASROOT=1
214-
# We will get the latest release from the GitHub API
215-
echo "[$$(date '+%Y-%m-%d %H:%M:%S')] Downloading runner from: $runner_release"
216-
curl -L $runner_release -o runner.tar.gz
214+
# Detect architecture and download appropriate runner
215+
ARCH=$$(uname -m)
216+
if [ "$$ARCH" = "aarch64" ] || [ "$$ARCH" = "arm64" ]; then
217+
# For ARM, replace x64 with arm64 in the URL
218+
RUNNER_URL=$$(echo "$runner_release" | sed 's/x64/arm64/g')
219+
echo "[$$(date '+%Y-%m-%d %H:%M:%S')] ARM detected, using: $$RUNNER_URL"
220+
else
221+
RUNNER_URL="$runner_release"
222+
echo "[$$(date '+%Y-%m-%d %H:%M:%S')] x64 detected, using: $$RUNNER_URL"
223+
fi
224+
curl -L $$RUNNER_URL -o runner.tar.gz
217225
echo "[$$(date '+%Y-%m-%d %H:%M:%S')] Extracting runner"
218226
# `--no-overwrite-dir` is important, otherwise `$$homedir` ends up `chown`'d to `1001:docker`, and `sshd` will refuse connection attempts to `$$homedir`
219227
tar --no-overwrite-dir -xzf runner.tar.gz

0 commit comments

Comments
 (0)