feat(setup): add arm64 support and runner.arch input#208
Open
alexFilichkin wants to merge 1 commit into
Open
Conversation
The setup script previously branched only on `runner.os` and always
downloaded the amd64 binary (e.g. `snyk-linux`). On arm64 runners the
binary cannot exec, producing:
/usr/local/bin/snyk: line 5: /usr/local/bin/snyk-linux: cannot execute binary file: Exec format error
Installed Snyk v # empty version
This change:
- Adds a third positional arg to setup_snyk.sh for the CPU architecture.
When omitted, the script falls back to `uname -m` so existing 2-arg
callers keep working.
- Maps X64/x86_64/amd64 → "" (default amd64 binary) and
ARM64/aarch64/arm64 → "-arm64". arm64 binaries are downloaded only for
platforms where Snyk publishes them (linux, macos, alpine — all
verified against downloads.snyk.io/cli/latest).
- Adds an `arch` input on the composite action defaulting to
`${{ runner.arch }}`, plumbed through as the new third arg.
Backwards compatible: existing X64/X86 Linux/macOS runners resolve to
the same binaries as before. The arch input is optional.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
setup/setup_snyk.shbranches only onrunner.osand unconditionally downloads the amd64 binary (e.g.snyk-linux). On arm64 runners — increasingly common with AWS CodeBuild, Apple Silicon self-hosted runners, and the GAubuntu-24.04-armimages — the binary cannot exec:Subsequent
snykinvocations exit with code 126 (command found but not executable) in ~9 ms, masking the real failure. This was first hit in a real downstream workflow on a CodeBuild ARM64 runner.Snyk already publishes arm64 binaries at the same CDN —
snyk-linux-arm64,snyk-macos-arm64,snyk-alpine-arm64(all return HTTP 200 fromhttps://downloads.snyk.io/cli/latest/) — they're just never selected.Change
setup/setup_snyk.sh— accepts an optional 3rd positional arg for CPU architecture. When omitted, falls back touname -m, so existing 2-arg callers keep working. New case statement maps:X64/x86_64/amd64→""(default binary, unchanged behavior)ARM64/aarch64/arm64→-arm64diewith a clear messageBINARY="snyk-${PREFIX}${ARCH_SUFFIX}"so download/checksum/move all stay consistent.setup/action.yml— new optionalarchinput defaulting to${{ runner.arch }}, plumbed through as the third arg.Backwards compatibility
snyk-linuxsnyk-linux-arm64snyk-macossnyk-macos-arm64snyk-alpinesnyk-alpine-arm64Existing callers that pass only 2 args (version, OS) keep working because the script falls back to
uname -mfor the arch. The action'sarchinput defaults torunner.arch, so existing workflows that only setos(or accept the default) are unaffected.Test plan
caselogic locally.snyk-linux-arm64,snyk-macos-arm64,snyk-alpine-arm64) all return HTTP 200 fromdownloads.snyk.io/cli/latest/.bash -n setup_snyk.shpasses.