Skip to content

Draft: Specify macOS SDK version so GDK build succeeds

James Liu requested to merge jamesliu-gitlab-master-patch-72564 into master

Modifies the bazelrc to specify a recent macOS SDK version. Without this line, the build fails when Bazel attempts to locate a very old version of the SDK. This is primarily an issue in GDK.

See https://github.com/bazelbuild/rules_go/issues/1554 for more information.

Sample error when running gdk reconfigure after enabling the agent:

--------------------------------------------------------------------------------
Installing gitlab-org/cluster-integration/gitlab-agent
--------------------------------------------------------------------------------
Loading:
Loading:
Loading: 0 packages loaded
Analyzing: target //cmd/kas:extract_kas_race (0 packages loaded, 0 targets configured)
INFO: Analyzed target //cmd/kas:extract_kas_race (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
[0 / 223] [Prepa] BazelWorkspaceStatusAction stable-status.txt ... (2 actions, 0 running)
[1 / 507] GoStdlib external/io_bazel_rules_go/stdlib_/pkg; 1s darwin-sandbox ... (2 actions running)
[1 / 507] GoStdlib external/io_bazel_rules_go/stdlib_/pkg; 12s darwin-sandbox ... (2 actions running)
ERROR: /private/var/tmp/_bazel_james/12eee559ab94d1cc8322022caf22bc93/external/io_bazel_rules_go/BUILD.bazel:42:7: GoStdlib external/io_bazel_rules_go/stdlib_/pkg failed: I/O exception during sandboxed execution: xcrun failed with code 1.
This most likely indicates that SDK version [10.11] for platform [MacOSX] is unsupported for the target version of xcode.
Process exited with status 1
stdout: stderr: 2024-04-15 13:25:56.745 xcodebuild[6653:1602146] Writing error result bundle to /var/folders/n9/1hjy54t504qf39svy01lc8840000gn/T/ResultBundle_2024-15-04_13-25-0056.xcresult
xcodebuild: error: SDK "macosx10.11" cannot be located.
2024-04-15 13:25:58.401 xcodebuild[6944:1605109] Writing error result bundle to /var/folders/n9/1hjy54t504qf39svy01lc8840000gn/T/ResultBundle_2024-15-04_13-25-0058.xcresult
xcodebuild: error: SDK "macosx10.11" cannot be located.
xcrun: error: unable to lookup item 'Path' in SDK 'macosx10.11'
Target //cmd/kas:extract_kas_race failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 20.391s, Critical Path: 19.98s
INFO: 3 processes: 3 internal.
FAILED: Build did NOT complete successfully
ERROR: Build failed. Not running target
make[1]: *** [gdk-install] Error 36
make: *** [gitlab-k8s-agent/build/gdk/bin/kas_race] Error 2
❌️ ERROR: Failed to reconfigure.
-------------------------------------------------------
Edited by James Liu

Merge request reports