Add support for Linux Arm64 runners - #4072
Conversation
Recognize the linux/arm64 platform so the CodeQL CLI is accepted on Arm64 Linux runners and the native per-platform bundle codeql-bundle-linux-arm64.tar.zst is resolved, rather than falling through to the combined all-platforms gzip fallback (which deliberately omits arm64). Add ["linux", "arm64"] to the supported platforms and make the linux bundle name arch-aware. Keep the download mock faithful and cover the new arch branch with tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
cb3455d to
4c96123
Compare
|
@mbg or @henrymercer do you mind giving a very early quick look whether this seems sensible? We can postpone merging until we decide to go with it in the releases. Tomorrow I plan on running some tests by hand on this branch with the nightly release, so I don't mind if the first review is shallow. |
henrymercer
left a comment
There was a problem hiding this comment.
Looks good to start testing! Can we add a PR check based on ubuntu-24.04-arm?
mbg
left a comment
There was a problem hiding this comment.
Thanks for preparing these changes! They generally look reasonable. A few points that we'd probably want to tackle on top of them:
- Add at least one end-to-end test that runs on arm64 Linux. (This might also require updating
sync.ts) Possibly run other e2e tests on arm64 as well. - It would be nice if we could provide a useful error message if someone attempts to use an older CLI that doesn't support arm64 (e.g. by checking the release assets and provide an appropriate error message if on that platform)
- Add darwin/x64 case to linked bundle tests and disambiguate the parametrized test title by platform/arch - Reword CHANGELOG entry to clarify the CLI supports Linux Arm64 - Add a dedicated Linux Arm64 end-to-end PR check on ubuntu-24.04-arm Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 308c78bb-53a3-4877-a373-70fab87543f1
…1399) * ci: drop redundant CodeQL scan, fix Scorecard ARM64 incompatibility codeql-action doesn't support Linux ARM64 (upstream: github/codeql-action#4072, #2700), and every codeql "actions" rule already maps to a zizmor audit running on ARM64 in ci.yml, so drop codeql.yml and raise zizmor's min-severity from high to medium to keep equivalent coverage. scorecard-action's amd64-only image has failed every scheduled run on ubuntu-24.04-arm since at least 2026-07-20 (ossf/scorecard-action#1697). Replace it with the checksum-verified linux_arm64 scorecard CLI binary, matching the existing cargo-semver-checks pattern, and upload SARIF via codeql-action/upload-sarif. Closes #1398 Signed-off-by: Hugues Clouâtre <hugues@linux.com> * ci: fix zizmor medium-severity findings surfaced by min-severity change Raising zizmor's min-severity to medium (this PR) surfaces two pre-existing findings unrelated to codeql/scorecard: - dtolnay/rust-toolchain is pinned to the "stable" branch tip but commented "# 1.97.1", which zizmor reads as a mismatched version comment since a branch literally named "1.97.1" points elsewhere. The actual desired version is already set via the "toolchain" input; correct the comment to "# stable" to match what's really pinned (matches the existing correct usage in update-deps.yml). - release.yml and release-repair.yml pass `secrets: inherit` into build-and-attest.yml, which only ever reads the auto-provided GITHUB_TOKEN. Drop the unneeded blanket secret grant. Signed-off-by: Hugues Clouâtre <hugues@linux.com> --------- Signed-off-by: Hugues Clouâtre <hugues@linux.com>
There was a problem hiding this comment.
Warning
- Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.
Pull request overview
Adds Linux Arm64 support by recognizing the platform and selecting native CodeQL bundles.
Changes:
- Adds Linux Arm64 platform and bundle resolution.
- Extends unit mocks/tests and adds an Arm64 integration check.
- Documents the new support.
Show a summary per file
| File | Description |
|---|---|
src/cli-errors.ts |
Recognizes Linux Arm64. |
src/cli-errors.test.ts |
Removes Arm64 from unsupported cases. |
src/setup-codeql.ts |
Resolves Arm64 bundle names. |
src/setup-codeql.test.ts |
Tests architecture-specific resolution. |
src/testing-utils.ts |
Updates bundle mocks for Arm64. |
pr-checks/checks/linux-arm64.yml |
Adds an Arm64 integration test. |
CHANGELOG.md |
Announces Arm64 support. |
lib/entry-points.js |
Generated artifact excluded from review. |
.github/workflows/__linux-arm64.yml |
Generated workflow excluded from review. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Files excluded by content exclusion policy (2)
- .github/workflows/__linux-arm64.yml
- lib/entry-points.js
- Files reviewed: 7/9 changed files
- Comments generated: 1
- Review effort level: Balanced
|
|
||
| const SUPPORTED_PLATFORMS = [ | ||
| ["linux", "x64"], | ||
| ["linux", "arm64"], |
There was a problem hiding this comment.
This is a good idea, we should stub the OS and architecture in "wrapCliConfigurationError - supported platform" rather than just testing on the OS / architecture on which we happen to be running.
| - uses: ./../action/analyze | ||
| with: | ||
| skip-queries: true | ||
| upload-database: false |
There was a problem hiding this comment.
Perhaps we should run the queries, to check the database can be finalized and that it works to some extent. I'm not too concerned about the additional run time, as long as this doesn't become the longest check.
|
|
||
| const SUPPORTED_PLATFORMS = [ | ||
| ["linux", "x64"], | ||
| ["linux", "arm64"], |
There was a problem hiding this comment.
This is a good idea, we should stub the OS and architecture in "wrapCliConfigurationError - supported platform" rather than just testing on the OS / architecture on which we happen to be running.
The CodeQL CLI will ship native
linux-arm64artifacts, but the Action does not yet recognize that platform: it rejects the CLI as an unsupported platform/architecture combination and, even if it got past that, would resolve the wrong bundle asset. This change teaches the Action aboutlinux/arm64so it accepts the CLI and downloads the correct bundle.Approach
Two small semantic edits, plus faithful test/mock coverage:
src/cli-errors.ts- add["linux", "arm64"]toSUPPORTED_PLATFORMSsoisUnsupportedPlatform()no longer rejects it.src/setup-codeql.ts- make the linux branch ofgetCodeQLBundleName()architecture-aware, resolvingcodeql-bundle-linux-arm64.tar.zston arm64 andcodeql-bundle-linux64elsewhere. This flows automatically to the download and nightlies URL builders.Arm64 is shipped as a per-platform bundle only and is deliberately excluded from the combined all-platforms gzip (which is near the release-asset size limit), so it is important that resolution lands on the exact per-platform asset name rather than the combined-gzip fallback.
The bundle-download mock in
src/testing-utils.tswas updated to mirror the same arch logic so it stays faithful on arm64 hosts (x64 behavior is unchanged). Tests were updated accordingly: the now-supportedlinux/arm64case was removed from the unsupported-platform list insrc/cli-errors.test.ts, andsrc/setup-codeql.test.tsgained an explicitarchper case plus a newlinux/arm64case.x64, macOS, and Windows behavior is unchanged; the only new behavior is on Linux arm64 runners, which do not work at all today.
Risk assessment
For internal use only. Please select the risk level of this change:
Which use cases does this change impact?
Workflow types:
dynamicworkflows (Default Setup, Code Quality, ...).Products:
analysis-kinds: code-scanning.analysis-kinds: code-quality.Environments:
github.comand/or GitHub Enterprise Cloud with Data Residency.Only relevant when running on a Linux arm64 runner; other architectures are unaffected.
How did/will you validate this change?
.test.tsfiles) for the new arch branch and platform-support change.If something goes wrong after this change is released, what are the mitigation and rollback strategies?
How will you know if something goes wrong after this change is released?
Are there any special considerations for merging or releasing this change?
codeql-bundle-linux-arm64.tar.zstasset. It should only be merged once that asset is being produced.Merge / deployment checklist