Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log warning if SIP is disabled and CLI version is < 2.15.1 #2261

Merged
merged 14 commits into from
Apr 25, 2024

Conversation

angelapwen
Copy link
Contributor

@angelapwen angelapwen commented Apr 25, 2024

The macos-latest image is now ARM rather than Intel, so we need to change some of our PR Checks. The build tracer on CLI versions before v2.15.1 did not support the ARM machines where System Integrity Protection was disabled, which now includes macos-latest.

This change:

  • uses macos-12 Intel runners for any checks where the CLI version is below v2.15.1
  • logs a warning if SIP is disabled, and if the CLI version is below v2.15.1

Separately, the macos-latest image no longer supports Go on the path by default, so this PR adds setup-go to all PR checks analyzing Go.

I've updated the Required PR checks on main to include the new ones, but have not updated v2 or v3 yet.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

Prior to CLI v2.15.1, ARM runners were not supported by the build tracer. "macos-latest" is now an ARM runner, so we run these tests on the old CLIs on Intel runners instead.
@angelapwen angelapwen force-pushed the angelapwen/arm-runner-fix branch from 645450c to db8b7f5 Compare April 25, 2024 17:35
Just so we can see all CLI versions that are failing on `macos-12`
@angelapwen angelapwen force-pushed the angelapwen/arm-runner-fix branch from e0223de to b6e9f31 Compare April 25, 2024 18:26
@angelapwen angelapwen marked this pull request as ready for review April 25, 2024 20:41
@angelapwen angelapwen requested a review from a team as a code owner April 25, 2024 20:41
Copy link
Contributor

@adityasharad adityasharad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - generally looks good but a couple of minor suggestions.

!(await isSipEnabled(logger))
) {
logger.warning(
"CodeQL versions 2.15.0 and lower are not supported on MacOS ARM machines with System Integrity Protection (SIP) disabled.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The warning mentions ARM, but you're not checking process.arch.
Either we can change the warning to say macOS in general with SIP disabled is not supported on <=2.15.0 (not strictly true, but I don't know if we fixed other relocation issues that would affect Intel),
or change the code above to check process.arch being arm or arm64.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, good point 👍 will change it to process.arch as I believe that's more accurate to the problem we were looking at in 2.15.1.

// For CLI versions <2.15.1, build tracing caused errors in MacOS ARM machines with
// System Integrity Protection (SIP) disabled.
if (
!(await codeQlVersionAbove(codeql, "2.15.1")) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, separate: I had to go look at the definition to remind myself whether this was > or >=. Perhaps we should rename it codeQlVersionAtLeast or similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I always double check that it's using gte too. I've made the change

Comment on lines 92 to 93
(matrix.os == 'macos-latest' ||
matrix.os == 'macos-12') && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we simplify this to just runner.os == 'macOS'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, done!

@angelapwen angelapwen force-pushed the angelapwen/arm-runner-fix branch from ee744db to 492f7d6 Compare April 25, 2024 21:58
@@ -477,7 +477,7 @@ async function run() {
// System Integrity Protection (SIP) disabled.
if (
!(await codeQlVersionAbove(codeql, "2.15.1")) &&
process.platform === "darwin" &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line needs to remain!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, Linux exists 😆

@angelapwen angelapwen enabled auto-merge (squash) April 25, 2024 22:07
@angelapwen angelapwen merged commit ac2f82a into main Apr 25, 2024
320 checks passed
@angelapwen angelapwen deleted the angelapwen/arm-runner-fix branch April 25, 2024 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants