Repository navigation
[ABLD-525] Build FIPS Go binaries with the Bazel msgo toolchain - #58530
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
Conversation
There was a problem hiding this comment.
AI review by Codex (OpenAI) - workflow run
The patch is incorrect under the supplied review requirements: the new extension commits unguarded print() calls. Build execution could not be verified in this read-only environment with restricted network access.
(obsolete: #58530 (comment))
fbe5504 to
78ee04b
Compare
Regression DetectorRegression Detector ResultsMetrics dashboard Baseline: b51f510 Optimization Goals: ✅ No significant changes detected
|
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|---|---|---|---|---|---|---|
| ➖ | dsd_uds_client_drop_detector_cpu | % cpu utilization | +0.99 | [+0.44, +1.53] | 1 | Logs |
| ➖ | quality_gate_logs | % cpu utilization | +0.88 | [-0.02, +1.79] | 1 | Logs bounds checks dashboard |
| ➖ | dsd_uds_10mb_3k_timestamped_contexts_memory | memory utilization | +0.83 | [+0.62, +1.04] | 1 | Logs |
| ➖ | quality_gate_security_mean_fs_load | memory utilization | +0.38 | [+0.34, +0.42] | 1 | Logs bounds checks dashboard |
| ➖ | python_openmetrics | % cpu utilization | +0.35 | [-0.31, +1.01] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_metrics_logs | memory utilization | +0.27 | [+0.04, +0.49] | 1 | Logs bounds checks dashboard |
| ➖ | dsd_uds_10mb_3k_timestamped_contexts_cpu | % cpu utilization | +0.21 | [-0.05, +0.48] | 1 | Logs |
| ➖ | quality_gate_security_idle | memory utilization | +0.03 | [-0.02, +0.08] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_security_no_fs_load | memory utilization | -0.04 | [-0.11, +0.03] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_idle | memory utilization | -0.28 | [-0.33, -0.24] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_idle_all_features | memory utilization | -0.38 | [-0.45, -0.31] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_private_action_runner | memory utilization | -0.42 | [-0.55, -0.29] | 1 | Logs bounds checks dashboard |
Bounds Checks: ✅ Passed
| perf | experiment | bounds_check_name | replicates_passed | observed_value | links |
|---|---|---|---|---|---|
| ✅ | python_openmetrics | checks_execution_time | 10/10 | 81.07 ≤ 100 | bounds checks dashboard |
| ✅ | python_openmetrics | cpu_usage | 10/10 | 1349.70 ≤ 1500 | bounds checks dashboard |
| ✅ | python_openmetrics | memory_usage | 10/10 | 4.31GiB ≤ 4.75GiB | bounds checks dashboard |
| ✅ | quality_gate_idle | intake_connections | 10/10 | 4 ≤ 5 | bounds checks dashboard |
| ✅ | quality_gate_idle | memory_usage | 10/10 | 180.98MiB ≤ 190MiB | bounds checks dashboard |
| ✅ | quality_gate_idle | total_bytes_received | 10/10 | 773.22KiB ≤ 819.20KiB | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | intake_connections | 10/10 | 2 ≤ 5 | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | memory_usage | 10/10 | 472.37MiB ≤ 544MiB | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | total_bytes_received | 10/10 | 1.17MiB ≤ 1.25MiB | bounds checks dashboard |
| ✅ | quality_gate_logs | intake_connections | 10/10 | 16 ≤ 40 | bounds checks dashboard |
| ✅ | quality_gate_logs | memory_usage | 10/10 | 222.26MiB ≤ 234MiB | bounds checks dashboard |
| ✅ | quality_gate_logs | missed_bytes | 10/10 | 0B = 0B | bounds checks dashboard |
| ✅ | quality_gate_logs | total_bytes_received | 10/10 | 263.92MiB ≤ 292MiB | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | cpu_usage | 10/10 | 367.14 ≤ 2000 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | intake_connections | 10/10 | 18 ≤ 40 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | memory_usage | 10/10 | 450.84MiB ≤ 463MiB | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | missed_bytes | 10/10 | 0B = 0B | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | total_bytes_received | 10/10 | 0.95GiB ≤ 1.04GiB | bounds checks dashboard |
| ✅ | quality_gate_private_action_runner | memory_usage | 10/10 | 75.48MiB ≤ 78MiB | bounds checks dashboard |
| ✅ | quality_gate_security_idle | cpu_usage | 10/10 | 30.59 ≤ 100 | bounds checks dashboard |
| ✅ | quality_gate_security_idle | memory_usage | 10/10 | 336.20MiB ≤ 365MiB | bounds checks dashboard |
| ✅ | quality_gate_security_mean_fs_load | cpu_usage | 10/10 | 39.67 ≤ 200 | bounds checks dashboard |
| ✅ | quality_gate_security_mean_fs_load | memory_usage | 10/10 | 313.97MiB ≤ 343MiB | bounds checks dashboard |
| ✅ | quality_gate_security_no_fs_load | cpu_usage | 10/10 | 24.93 ≤ 100 | bounds checks dashboard |
| ✅ | quality_gate_security_no_fs_load | memory_usage | 10/10 | 345.37MiB ≤ 356MiB | bounds checks dashboard |
Explanation
Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%
Performance changes are noted in the perf column of each table:
- ✅ = significantly better comparison variant performance
- ❌ = significantly worse comparison variant performance
- ➖ = no significant change in performance
A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".
For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:
-
Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.
-
Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.
-
Its configuration does not mark it "erratic".
CI Pass/Fail Decision
✅ Passed. All Quality Gates passed.
- quality_gate_metrics_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_private_action_runner, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_idle_all_features, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_idle_all_features, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_idle_all_features, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
- quality_gate_idle, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
- quality_gate_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_idle, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_security_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_security_idle, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
- quality_gate_security_mean_fs_load, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_security_mean_fs_load, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
- quality_gate_security_no_fs_load, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_security_no_fs_load, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
78ee04b to
49f7558
Compare
49f7558 to
b0d6c99
Compare
Static quality checks✅ Please find below the results from static quality gates 33 successful checks with minimal change (< 2 KiB)
|
b0d6c99 to
2ed9162
Compare
### What does this PR do? Replace the `--fips-mode` boolean in build tasks by a `--fips-backend` of `none`, `msgo` (Microsoft Go's OpenSSL or CNG backend) or `boringcrypto` (upstream Go's BoringSSL backend), the cluster agent included, and propagate it from every build of FIPS packages to `go_build`, the loader and systray included. Make `go_build` set the matching `GOEXPERIMENT`, `boringcrypto` or, for Linux `msgo` builds, `ms_nocgo_opensslcrypto`, in place of the CI jobs' variable, `cluster_agent.py`'s derivation from it and `tasks/omnibus.py`'s omnibus-wide one. Pass `--fips-backend=msgo` from omnibus, and `--fips-backend=boringcrypto` from the cluster-agent and secret-generic-connector FIPS jobs. Reject the `--fips-backend` values that `--enable-bazel` cannot honor, in the cluster-agent and secret-generic-connector builds. ### Motivation The boolean conflated 2 FIPS backends needing different Go distributions, since `msgo` rejects `GOEXPERIMENT=boringcrypto`. Each therefore relied on the environment instead: BoringCrypto builds on a job variable that `cluster_agent.py` read back, Linux `msgo` builds on an omnibus-wide `GOEXPERIMENT`, and both on whichever `go` came first on `PATH`. Naming the backend lets the build pick the Go distribution, which is what bazelifying it requires: #58530 maps `msgo` to the Bazel-fetched `//:msgo`, and a Bazel build can likewise select its toolchain from that value rather than from inherited variables. ### Describe how you validated your changes With `GOEXPERIMENT` unset, checked that: - `cluster-agent.build` and `secret-generic-connector.build` with `--fips-backend=boringcrypto` link BoringCrypto (`_Cfunc__goboringcrypto_` symbols), the former into its secret-generic-connector too, and not without it, - with `msgo` on `PATH`, as `add_msgo_to_env` puts it, `dda inv -- -e installer.build --fips-backend=msgo --no-cgo` and `dda inv -- -e agent.build --build-exclude=systemd --flavor fips` record `GOEXPERIMENT=ms_nocgo_opensslcrypto` and link its OpenSSL backend, the former setting its RUNPATH, - an invalid `--fips-backend` value, or one that `--enable-bazel` cannot honor, fails fast, - `dda inv -- -e linter.python`, `dda inv -- -e linter.gitlab-ci`, `dda inv -- -e linter.gitlab-ci-shellcheck` and `dda inv -- -e invoke-unit-tests.run` for `go`, `omnibus` and `cluster_agent_helpers` pass. ### Additional Notes It also leaves room for upstream Go's native FIPS 140-3 module, which is selected through `GOFIPS140` and meant to later replace BoringCrypto (https://go.dev/doc/security/fips140): one more value handled by `go_build`, rather than another variable to thread through CI jobs and omnibus.
### What does this PR do? Make `go_build` build the `msgo` FIPS backend with `bazel run //:msgo --` instead of the `msgo` preinstalled in build images. Make the omnibus symbol inspector run `tool nm` through `//:msgo` in FIPS mode and `@rules_go//go` otherwise, instead of the `go` on `PATH`. Remove `add_msgo_to_env` and the Windows `MSGO_ROOT` lookup feeding it, no omnibus FIPS build running any other `go` needing the preinstalled `msgo`. Remove `get_omnibus_env`'s `fips_mode` argument with them, its only other effect being a `FIPS_MODE` variable nothing reads. Builds without the `msgo` backend keep the `go` on `PATH`. ### Motivation FIPS builds take `msgo` from the build images, where `add_msgo_to_env` puts it ahead of the `go` on `PATH`, so the FIPS toolchain comes with the image rather than being pinned like the other Bazel toolchains, and is selected by altering the environment every `go` command shares. #58511 made `msgo` a Bazel toolchain and #59501 made every FIPS build name its backend, so `go_build` can now route exactly the `msgo` builds to that toolchain, one step towards building Go binaries with Bazel. ### Describe how you validated your changes With upstream Go as the `go` on `PATH`, checked that: - `dda inv -- -e installer.build --fips-backend=msgo --no-cgo` with `installer.rb`'s run and install paths and `DEPLOY_AGENT=true` never runs that `go`, and builds the Linux installer with `msgo`, recording `GOEXPERIMENT=ms_nocgo_opensslcrypto`, linking its OpenSSL backend (`go-crypto-openssl/openssl` symbols) and setting its RUNPATH, even when `bazelisk` is a shim changing to another checkout, as omnibus's is, - `dda inv -- -e agent.build --build-exclude=systemd --flavor fips` builds with `msgo`, linking its OpenSSL backend, - builds outside the `msgo` backend still use that `go`, a `boringcrypto` secret-generic-connector included, - `dda inv -- -e installer.build --fips-backend=msgo` builds the Windows installer with `msgo`, - `bazel run @rules_go//go tool nm` lists the symbols of a binary on Linux and Windows, as `bazel run //:msgo tool nm` does, - `dda inv -- -e linter.python` and `dda inv -- -e invoke-unit-tests.run --tests=go` pass. ### Additional Notes `go_build` passes `-C` with the current directory to the Bazel `go`, because omnibus's `bazel` shim runs Bazel from the original checkout while the build runs in omnibus's source copy. The symbol inspector gets `omnibazel_flags` from its callers, because it cannot resolve `install_dir` itself, and Bazel would otherwise discard its analysis cache. `go_build` now joins its arguments with `join_command`, so its `PATH` `go` command lines quote them the shell's way rather than with hand-written double quotes.
#58530 (comment) > Why not make this homogeneous as part of the same PR? What I'm thinking is that perhaps we can also invoke go explicitly under bazel here in all cases and have `fips_backend` decide between `//:msgo` and `//:go` like you already did elsewhere on this PR. > > I say this because the branching here is a bit awkward (there's also the repetition of the `join_command` call which previously would've been simply `cmd` and the awkward naming for the whydeadcode helpers), and it looks like that would significantly simplify this. => Both `go_build` routes now return the build's stderr, the `PATH` one through the large-chunk runner the dead code check already used, so a single `whydeadcode` call serves both, with `join_command` called once and no whydeadcode helper left. Routing every build through Bazel is left for a follow-up, its prerequisites extending the review surface beyond FIPS: - `Arch` and `get_build_flags` recognizing the armhf image's 32-bit ARM userland on its 64-bit kernel and pinning `GOARCH=arm`, `GOARM=6` and cgo, at the risk of `GOARM` drifting from the image's Go and of the new `arm` spelling also matching the arm64 kernel header paths `system_probe.py` ranks, - the host-profiler jobs extending `.bazel:defs:cache:progressive`, which ties them to Buildbarn's availability, - `go_build` keeping the `go` on `PATH` without `bazelisk`, for AIX and the Docker images building the OTel agent, the customer-facing BYOC one included, at the risk of a silent fallback where `dda inv install-tools` was skipped. The follow-up then moves every other Go build, Windows and macOS included, to Bazel's Go.
1c34270 to
6df956e
Compare
### What does this PR do? Patch the `msgo` SDK's `go.env` so that `MS_GOTOOLCHAIN_TELEMETRY_ENABLED` defaults to `0`, as microsoft/go#2566 lets distributions do and microsoft/azurelinux#19611 does. Users can still opt in through their environment or `go env -w`, which both take precedence over `GOROOT/go.env`. ### Motivation #58511 made `msgo` a Bazel SDK whose `go.env` enables Microsoft's telemetry, which its `go build`, `go install` and `go run` send unless `MS_GOTOOLCHAIN_TELEMETRY_ENABLED=0` is set. #58530 builds FIPS binaries with `bazel run //:msgo -- build`, only opted out by the `ENV` that `DataDog/datadog-agent-buildimages` sets in its images, leaving other hosts, developer ones included, sending it. Opting out in the SDK itself covers every host and lets the build images drop that `ENV`. ### Describe how you validated your changes With `MS_GOTOOLCHAIN_TELEMETRY_ENABLED` unset, checked on Linux and Windows that `bazel run //:msgo -- env MS_GOTOOLCHAIN_TELEMETRY_ENABLED` prints `0`, whereas it prints `1` on Linux without the patch. With `MS_GOTOOLCHAIN_TELEMETRY_ENABLED=1` on Linux, checked that it prints `1`. Checked that `MODULE.bazel.lock` is unchanged and that `bazel run //bazel/buildifier:test` passes. ### Additional Notes Unlike `--run_env=MS_GOTOOLCHAIN_TELEMETRY_ENABLED=0`, the patch keeps the user opt-in and covers every `go` command run from `@msgo`, not only `bazel run //:msgo`. The patch fails the SDK fetch should a later `msgo` release reword its `go.env`, rather than silently leaving telemetry on.
### What does this PR do? Patch the `msgo` SDK's `go.env` so that `MS_GOTOOLCHAIN_TELEMETRY_ENABLED` defaults to `0`, as microsoft/go#2566 lets distributions do and microsoft/azurelinux#19611 indeed does. Users can still opt in through their environment or `go env -w`, which both take precedence over `GOROOT/go.env`. ### Motivation #58511 made `msgo` a Bazel SDK whose `go.env` enables Microsoft's telemetry, which its `go build`, `go install` and `go run` send unless `MS_GOTOOLCHAIN_TELEMETRY_ENABLED=0` is set. #58530 builds FIPS binaries with `bazel run //:msgo -- build`, only opted out by the `ENV` that `DataDog/datadog-agent-buildimages` sets in its images, leaving other hosts, developer ones included, sending it. Opting out in the SDK itself covers every host and lets the build images drop that `ENV`. ### Describe how you validated your changes With `MS_GOTOOLCHAIN_TELEMETRY_ENABLED` unset, checked on Linux and Windows that `bazel run //:msgo -- env MS_GOTOOLCHAIN_TELEMETRY_ENABLED` prints `0`, whereas it prints `1` on Linux without the patch. With `MS_GOTOOLCHAIN_TELEMETRY_ENABLED=1` on Linux, checked that it prints `1`. ### Additional Notes Unlike `--run_env=MS_GOTOOLCHAIN_TELEMETRY_ENABLED=0`, the patch keeps the user opt-in and covers every `go` command run from `@msgo`, not only `bazel run //:msgo`. The patch fails the SDK fetch should a later `msgo` release reword its `go.env`, rather than silently leaving telemetry on. Co-authored-by: regis.desgroppes <[email protected]>
### What does this PR do? Make `go_build` run `bazel run @rules_go//go --` for every backend but `msgo`, which keeps `bazel run //:msgo --`, instead of the `go` preinstalled in build images, keeping that `go` only where Bazel is missing, such as on AIX and in the Docker images building the OTel agent. To that end: - make `get_build_flags` pin `GOARCH=arm`, `GOARM=6` and `CGO_ENABLED=1` when a 32-bit Python runs on a 64-bit ARM kernel, as in the armhf build image, since Bazel's Go SDK follows that kernel, and its builds for 32-bit ARM, being cross-builds, would otherwise disable cgo and default to `GOARM=7`, - give the host-profiler jobs the Bazel CI setup their builds now need. ### Motivation #58530 routed the `msgo` builds of `go_build` to Bazel's `msgo` but left the others on the `go` of build images, and its review suggested making `go_build` homogeneous. Every build then uses a toolchain pinned like the other Bazel ones rather than one coming with the image, one step towards building Go binaries with Bazel. ### Describe how you validated your changes With upstream Go as the `go` on `PATH`, checked that: - a `go_build` with `check_deadcode` builds through `@rules_go//go` and feeds its `-dumpdep` output to `whydeadcode`, - `dda inv -- -e agent.build --build-exclude=systemd` builds with `@rules_go//go`, cgo included, - `dda inv -- -e secret-generic-connector.build` with `--fips-backend=boringcrypto` builds with `@rules_go//go`, recording `GOEXPERIMENT=boringcrypto` and linking BoringSSL (`_Cfunc__goboringcrypto_` symbols), - without `bazelisk` on `PATH`, `go_build` builds with the `go` on `PATH` and skips `check_deadcode` with a warning, `whydeadcode` itself running through Bazel, - the armhf build produces a 32-bit ARM agent with `GOARCH=arm`, `GOARM=6` and `CGO_ENABLED=1`, the settings of the released 7.85.1 armhf agent. ### Additional Notes `@rules_go//go` is the official, statically linked `go`, unlike the `go_fast` behind `//:go`, whose cgo would depend on the host C toolchain, which the armhf image's 32-bit one cannot serve. The armhf pin restates the defaults of the image's own `go`, a 32-bit ARM build, and doesn't apply where `libfakearmv7l.so` spoofs `uname` as `armv7l`, which only `iot_agent_rpm-armhf` does, without building Go code.
### What does this PR do? Stop installing the Microsoft build of Go in the Linux and Windows images, and drop its release and checksums from `go.env`, `docker-bake.override.json` and `dda run update go`, whose `--msgo-patch` option goes with them. Drop the Go update workflow's check that `microsoft/go` published the requested release. Drop `MS_GOTOOLCHAIN_TELEMETRY_ENABLED=0` from the Linux and Windows images, DataDog/datadog-agent#59840 disabling `msgo` telemetry in its Bazel SDK instead. ### Motivation Omnibus FIPS builds took `msgo` from `/usr/local/msgo` on Linux and `C:\msgo` on Windows, through `datadog-agent`'s `add_msgo_to_env`. DataDog/datadog-agent#58511 made `msgo` a Bazel toolchain pinned from `microsoft/go`'s release manifest, DataDog/datadog-agent#59501 made every FIPS build name its backend, and DataDog/datadog-agent#58530 builds the `msgo` backend with `bazel run //:msgo` and removes `add_msgo_to_env`, leaving the preinstalled `msgo` without any reader. ### Possible Drawbacks / Trade-offs A Go update is no longer held back until `microsoft/go` publishes it (may take a few days), `datadog-agent`'s Bazel Go builds failing instead while `msgo` lacks the release. This should not be a problem because we've not been adopting Go releases right away. ### Additional Notes The `go_builder` stage's `DD_GO_TOOLCHAIN` switch goes too, its `.bashrc` never reaching the final image.
### What does this PR do? Stop installing the Microsoft build of Go in the Linux and Windows images, and drop its release and checksums from `go.env`, `docker-bake.override.json` and `dda run update go`, whose `--msgo-patch` option goes with them. Drop the Go update workflow's check that `microsoft/go` published the requested release. Drop `MS_GOTOOLCHAIN_TELEMETRY_ENABLED=0` from the Linux and Windows images, DataDog/datadog-agent#59840 disabling `msgo` telemetry in its Bazel SDK instead. ### Motivation Omnibus FIPS builds took `msgo` from `/usr/local/msgo` on Linux and `C:\msgo` on Windows, through `datadog-agent`'s `add_msgo_to_env`. DataDog/datadog-agent#58511 made `msgo` a Bazel toolchain pinned from `microsoft/go`'s release manifest, DataDog/datadog-agent#59501 made every FIPS build name its backend, and DataDog/datadog-agent#58530 builds the `msgo` backend with `bazel run //:msgo` and removes `add_msgo_to_env`, leaving the preinstalled `msgo` without any reader. ### Possible Drawbacks / Trade-offs A Go update is no longer held back until `microsoft/go` publishes it (may take a few days), `datadog-agent`'s Bazel Go builds failing instead while `msgo` lacks the release. This should not be a problem because we've not been adopting Go releases right away: worst case, the Renovate-generated buildimage bump stays on hold until Microsoft ships its counterpart. ### Additional Notes The `go_builder` stage's `DD_GO_TOOLCHAIN` switch goes too, its `.bashrc` never reaching the final image, whereas #1386 removed `setup/go.sh` along with other unreferenced scripts.
### What does this PR do? Make `go_build` run `bazel run @rules_go//go --` for every backend but `msgo`, which keeps `bazel run //:msgo --`, instead of the `go` preinstalled in build images, keeping that `go` only where Bazel is missing, such as on AIX and in the Docker images building the OTel agent. To that end: - make `get_build_flags` pin `GOARCH=arm` and `CGO_ENABLED=1` when a 32-bit userland runs on a 64-bit ARM kernel, as in the armhf build image, since Bazel's Go SDK follows that kernel, and its builds for 32-bit ARM, being cross-builds, would otherwise disable cgo, - give the host-profiler jobs the Bazel CI setup their builds now need. ### Motivation #58530 moved the `msgo` builds of `go_build` to Bazel's `msgo`, but left the other builds on the `go` of build images, and its review asked to route them all through Bazel, `fips_backend` picking `//:msgo` or the plain Bazel `go`, which would also simplify `go_build`. Doing so there would have broken the armhf build, the host-profiler jobs and the Bazel-less Docker builds, so it was agreed to leave the non-FIPS path to this follow-up, which first lifts those blockers. Every Go build then uses a toolchain pinned like the other Bazel ones, rather than one coming with the image. ### Describe how you validated your changes With upstream Go as the `go` on `PATH`, checked that: - a `go_build` with `check_deadcode` builds through `@rules_go//go` and feeds its `-dumpdep` output to `whydeadcode`, - `dda inv -- -e agent.build --build-exclude=systemd` builds with `@rules_go//go`, cgo included, - `dda inv -- -e secret-generic-connector.build` with `--fips-backend=boringcrypto` builds with `@rules_go//go`, recording `GOEXPERIMENT=boringcrypto` and linking BoringSSL (`_Cfunc__goboringcrypto_` symbols), - without `bazelisk` on `PATH`, `go_build` builds with the `go` on `PATH` and skips `check_deadcode` with a warning, `whydeadcode` itself running through Bazel, - the armhf build produces a 32-bit ARM agent with `GOARCH=arm` and `CGO_ENABLED=1`. ### Additional Notes `@rules_go//go` is the official, statically linked `go`, unlike the `go_fast` behind `//:go`, whose cgo would depend on the host C toolchain, which the armhf image's 32-bit one cannot serve. The armhf agent's Go code moves from the `GOARM=6` of the image's own `go`, a `linux-armv6l` release, to Go's cross-build default `GOARM=7`, the ARMv7 that its C code (ELF `Tag_CPU_arch: v7`) and the IoT Agent's documented support already require. The armhf pin doesn't apply where `libfakearmv7l.so` spoofs `uname` as `armv7l`, which only `iot_agent_rpm-armhf` does, without building Go code. `get_build_flags`'s `platform` parameter becomes `target_platform`, the name of the variable `agent.build`, its only user, passes to it, so as to stop shadowing the `platform` module.
### What does this PR do? Make `go_build` run `bazel run @rules_go//go --` for every backend but `msgo`, which keeps `bazel run //:msgo --`, instead of the `go` preinstalled in build images, keeping that `go` only where Bazel is missing, such as on AIX and in the Docker images building the OTel agent. To that end: - make `get_build_flags` pin `GOARCH=arm` and `CGO_ENABLED=1` when a 32-bit userland runs on a 64-bit ARM kernel, as in the `armhf` build image, since Bazel's Go SDK follows that kernel, and its builds for 32-bit ARM, being cross-builds, would otherwise disable cgo, - give the host-profiler jobs the Bazel CI setup their builds now need. ### Motivation #58530 moved the `msgo` builds of `go_build` to Bazel's `msgo`, but left the other builds on the `go` of build images, and its review asked to route them all through Bazel, `fips_backend` picking `//:msgo` or the plain Bazel `go`, which would also simplify `go_build`. Doing so there would have broken the armhf build, the host-profiler jobs and the Bazel-less Docker builds, so it was agreed to [leave the non-FIPS path to a follow-up](#58530 (comment)), which first lifts those blockers. Every Go build then uses a toolchain pinned like the other Bazel ones, rather than one coming with the image. ### Describe how you validated your changes With upstream Go as the `go` on `PATH`, checked that: - a `go_build` with `check_deadcode` builds through `@rules_go//go` and feeds its `-dumpdep` output to `whydeadcode`, - `dda inv -- -e agent.build --build-exclude=systemd` builds with `@rules_go//go`, cgo included, - `dda inv -- -e secret-generic-connector.build` with `--fips-backend=boringcrypto` builds with `@rules_go//go`, recording `GOEXPERIMENT=boringcrypto` and linking BoringSSL (`_Cfunc__goboringcrypto_` symbols), - without `bazelisk` on `PATH`, `go_build` builds with the `go` on `PATH` and skips `check_deadcode` with a warning, `whydeadcode` itself running through Bazel, - the armhf build produces a 32-bit ARM agent with `GOARCH=arm` and `CGO_ENABLED=1`. ### Additional Notes The armhf pin doesn't apply where `libfakearmv7l.so` spoofs `uname` as `armv7l`, which only `iot_agent_rpm-armhf` does, without building Go code. `get_build_flags`'s `platform` parameter becomes `target_platform`, the name of the variable `agent.build`, its only user, passes to it, so as to stop shadowing the `platform` module. Co-authored-by: regis.desgroppes <[email protected]>
### What does this PR do? Request FIPS builds with `--platforms=//bazel/platforms:<os>_<arch>_fips`, whose `flags` select the `msgo` SDK, instead of the retired `fips` value of `//packages/agent:flavor`. Key the FIPS `config_setting`s, `@openssl`'s and the FIPS package names on the `//bazel/platforms:fips` constraint, and have the omnibus helpers pass the FIPS platform. Register a test toolchain so that `bazel test` works on FIPS platforms, and remove the unused macOS FIPS platforms. This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS binaries load, nor lifting the #59511 refusal, which depends on it. ### Motivation The FIPS platforms' constraint selected nothing, and the `fips` flavor selected the FIPS tags but kept the upstream SDK, both silently producing non-FIPS binaries, which #59511 had to refuse. Since #58511 made `msgo` a toolchain, a platform can carry both the constraint and the SDK choice. ### Describe how you validated your changes - `//cmd/agent` builds with `msgo` and the FIPS tags on the FIPS platforms, `requirefips` being Linux-only, and with the upstream SDK and no FIPS tags on the others, - the agent, installer, loader and packaging targets, and `@openssl`, analyze with no ambiguous `select()` on the Linux and Windows platforms, FIPS or not, - `bazel test` passes on a FIPS platform. ### Additional Notes The FIPS platforms set `sdk_name` through `platform(flags = ...)`, because deriving it from the constraint would take patching rules_go's `go_transition` or duplicating its `toolchain()` matrix. The retired flavor value now fails the analysis of packaging targets. Prerequisites: - #56351 - #56865 - #57078 - #57223 - #58511 - #58530 - #59501 - #59511 - #59840 - #59871 - #59875 - #60181
### What does this PR do? Request FIPS builds with `--platforms=//bazel/platforms:<os>_<arch>_fips`, whose `flags` select the `msgo` SDK, instead of the retired `fips` value of `//packages/agent:flavor`. Key the FIPS `config_setting`s, `@openssl`'s and the FIPS package names on the `//bazel/platforms:fips` constraint, and have the omnibus helpers pass the FIPS platform. Register a test toolchain so that `bazel test` works on FIPS platforms, and remove the unused macOS FIPS platforms. This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS binaries load, nor lifting the #59511 refusal, which depends on it. ### Motivation The FIPS platforms' constraint selected nothing, and the `fips` flavor selected the FIPS tags but kept the upstream SDK, both silently producing non-FIPS binaries, which #59511 had to refuse. Since #58511 made `msgo` a toolchain, a platform can carry both the constraint and the SDK choice. ### Describe how you validated your changes - `//cmd/agent` builds with `msgo` and the FIPS tags on the FIPS platforms, `requirefips` being Linux-only, and with the upstream SDK and no FIPS tags on the others, - the agent, installer, loader and packaging targets, and `@openssl`, analyze with no ambiguous `select()` on the Linux and Windows platforms, FIPS or not, - `bazel test` passes on a FIPS platform. ### Additional Notes The FIPS platforms set `sdk_name` through `platform(flags = ...)`, because deriving it from the constraint would take patching rules_go's `go_transition` or duplicating its `toolchain()` matrix. The retired flavor value now fails the analysis of packaging targets. `//cmd/dogstatsd` drops its `cgo` select, whose FIPS branch was a no-op, leaving `dd_agent_go_binary`'s identical default. Prerequisites: - #56351 - #56865 - #57078 - #57223 - #58511 - #58530 - #59501 - #59511 - #59840 - #59871 - #59875 - #60181
### What does this PR do? Request FIPS builds with `--platforms=//bazel/platforms:<os>_<arch>_fips`, whose `flags` select the `msgo` SDK, instead of the retired `fips` value of `//packages/agent:flavor`. Key the FIPS `config_setting`s, `@openssl`'s and the FIPS package names on the `//bazel/platforms:fips` constraint, and have the omnibus helpers pass the FIPS platform. Register a test toolchain so that `bazel test` works on FIPS platforms, and remove the unused macOS FIPS platforms. This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS binaries load, nor lifting the #59511 refusal, which depends on it. ### Motivation The FIPS platforms' constraint selected nothing, and the `fips` flavor selected the FIPS tags but kept the upstream SDK, both silently producing non-FIPS binaries, which #59511 had to refuse. Since #58511 made `msgo` a toolchain, a platform can carry both the constraint and the SDK choice. ### Describe how you validated your changes - `//cmd/agent` builds with `msgo` and the FIPS tags on the FIPS platforms, `requirefips` being Linux-only, and with the upstream SDK and no FIPS tags on the others, - the agent, installer, loader and packaging targets, and `@openssl`, analyze with no ambiguous `select()` on the Linux and Windows platforms, FIPS or not, - `bazel test` passes on a FIPS platform. ### Additional Notes The FIPS platforms set `sdk_name` through `platform(flags = ...)`, because deriving it from the constraint would take patching rules_go's `go_transition` or duplicating its `toolchain()` matrix. The retired flavor value now fails the analysis of packaging targets. `//cmd/dogstatsd` drops its `cgo` select, whose FIPS branch was a no-op, leaving `dd_agent_go_binary`'s identical default. Prerequisites: - #56351 - #56865 - #57078 - #57223 - #58511 - #58530 - #59501 - #59511 - #59840 - #59871 - #59875 - #60181
### What does this PR do? Request FIPS builds with `--platforms=//bazel/platforms:<os>_<arch>_fips`, whose `flags` select the `msgo` SDK, instead of the retired `fips` value of `//packages/agent:flavor`. Key the FIPS `config_setting`s, `@openssl`'s and the FIPS package names on the `//bazel/platforms:fips` constraint, and have the omnibus helpers pass the FIPS platform. Register a test toolchain so that `bazel test` works on FIPS platforms, and remove the unused macOS FIPS platforms. Have the installer's symbol test require `msgo`'s OpenSSL or CNG backend on the Linux or Windows FIPS platforms, and reject it elsewhere. This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS binaries load, nor lifting the #59511 refusal, which depends on it. ### Motivation The FIPS platforms' constraint selected nothing, and the `fips` flavor selected the FIPS tags but kept the upstream SDK, both silently producing non-FIPS binaries, which #59511 had to refuse. Since #58511 made `msgo` a toolchain, a platform can carry both the constraint and the SDK choice. ### Describe how you validated your changes - `//cmd/agent` builds with `msgo` and the FIPS tags on the FIPS platforms, `requirefips` being Linux-only, and with the upstream SDK and no FIPS tags on the others, - the agent, installer, loader and packaging targets, and `@openssl`, analyze with no ambiguous `select()` on the Linux and Windows platforms, FIPS or not, - `bazel test` passes on a FIPS platform, - the installer's symbol test passes on the Linux and Windows FIPS platforms, and fails when expecting a package the binary lacks. ### Additional Notes The FIPS platforms set `sdk_name` through `platform(flags = ...)`, because deriving it from the constraint would take patching rules_go's `go_transition` or duplicating its `toolchain()` matrix. The retired flavor value now fails the analysis of packaging targets. `//cmd/dogstatsd` drops its `cgo` select, whose FIPS branch was a no-op, leaving `dd_agent_go_binary`'s identical default. `//cmd/loader:trace_loader_all_files` only excludes Windows, like `:loader`, instead of listing Linux and macOS. Prerequisites: - #56351 - #56865 - #57078 - #57223 - #58511 - #58530 - #59501 - #59511 - #59840 - #59871 - #59875 - #60181
### What does this PR do? Request FIPS builds with `--platforms=//bazel/platforms:<os>_<arch>_fips`, whose `flags` select the `msgo` SDK, instead of the retired `fips` value of `//packages/agent:flavor`. Key the FIPS `config_setting`s, `@openssl`'s and the FIPS package names on the `//bazel/platforms:fips` constraint, and have the omnibus helpers pass the FIPS platform. Register a test toolchain so that `bazel test` works on FIPS platforms, and remove the unused macOS FIPS platforms. Have the installer's symbol test require `msgo`'s OpenSSL or CNG backend on the Linux or Windows FIPS platforms, and reject it elsewhere. This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS binaries load, nor lifting the #59511 refusal, which depends on it. ### Motivation The FIPS platforms' constraint selected nothing, and the `fips` flavor selected the FIPS tags but kept the upstream SDK, both silently producing non-FIPS binaries, which #59511 had to refuse. Since #58511 made `msgo` a toolchain, a platform can carry both the constraint and the SDK choice. ### Describe how you validated your changes - `//cmd/agent` builds with `msgo` and the FIPS tags on the FIPS platforms, `requirefips` being Linux-only, and with the upstream SDK and no FIPS tags on the others, - the agent, installer, loader and packaging targets, and `@openssl`, analyze with no ambiguous `select()` on the Linux and Windows platforms, FIPS or not, - `bazel test` passes on a FIPS platform, - the installer's symbol test passes on the Linux and Windows FIPS platforms, and fails when expecting a package the binary lacks. ### Additional Notes The FIPS platforms set `sdk_name` through `platform(flags = ...)`, because deriving it from the constraint would take patching rules_go's `go_transition` or duplicating its `toolchain()` matrix. The retired flavor value now fails the analysis of packaging targets. `//cmd/dogstatsd` drops its `cgo` select, whose FIPS branch was a no-op, leaving `dd_agent_go_binary`'s identical default. `//cmd/loader:trace_loader_all_files` only excludes Windows, like `:loader`, instead of listing Linux and macOS. Prerequisites: - #56351 - #56865 - #57078 - #57223 - #58511 - #58530 - #59501 - #59511 - #59840 - #59871 - #59875 - #60181
### What does this PR do? Request FIPS builds with `--platforms=//bazel/platforms:<os>_<arch>_fips`, whose `flags` select the `msgo` SDK, instead of the retired `fips` value of `//packages/agent:flavor`. Key the FIPS `config_setting`s, `@openssl`'s and the FIPS package names on the `//bazel/platforms:fips` constraint, and have the omnibus helpers pass the FIPS platform. Register a test toolchain so that `bazel test` works on FIPS platforms, and remove the unused macOS FIPS platforms. Have the installer's symbol test require `msgo`'s OpenSSL or CNG backend on the Linux or Windows FIPS platforms, and reject it elsewhere. This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS binaries load, nor lifting the #59511 refusal, which depends on it. ### Motivation The FIPS platforms' constraint selected nothing, and the `fips` flavor selected the FIPS tags but kept the upstream SDK, both silently producing non-FIPS binaries, which #59511 had to refuse. Since #58511 made `msgo` a toolchain, a platform can carry both the constraint and the SDK choice. ### Describe how you validated your changes - `//cmd/agent` builds with `msgo` and the FIPS tags on the FIPS platforms, `requirefips` being Linux-only, and with the upstream SDK and no FIPS tags on the others, - the agent, installer, loader and packaging targets, and `@openssl`, analyze with no ambiguous `select()` on the Linux and Windows platforms, FIPS or not, - `bazel test` passes on a FIPS platform, - the installer's symbol test passes on the Linux and Windows FIPS platforms, and fails when expecting a package the binary lacks. ### Additional Notes The FIPS platforms set `sdk_name` through `platform(flags = ...)`, because deriving it from the constraint would take patching rules_go's `go_transition` or duplicating its `toolchain()` matrix. The retired flavor value now fails the analysis of packaging targets. `//cmd/dogstatsd` drops its `cgo` select, whose FIPS branch was a no-op, leaving `dd_agent_go_binary`'s identical default. `//cmd/loader:trace_loader_all_files` only excludes Windows, like `:loader`, instead of listing Linux and macOS. Prerequisites: - #56351 - #56865 - #57078 - #57223 - #58511 - #58530 - #59501 - #59511 - #59840 - #59871 - #59875 - #60181
### What does this PR do? Request FIPS builds with `--platforms=//bazel/platforms:<os>_<arch>_fips`, whose `flags` select the `msgo` SDK, instead of the retired `fips` value of `//packages/agent:flavor`. Key the FIPS `config_setting`s, `@openssl`'s and the FIPS package names on the `//bazel/platforms:fips` constraint, and have the omnibus helpers pass the FIPS platform. Register a test toolchain so that `bazel test` works on FIPS platforms, and remove the unused macOS FIPS platforms. Have the installer's symbol test require `msgo`'s OpenSSL or CNG backend on the Linux or Windows FIPS platforms, and reject it elsewhere. This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS binaries load, nor lifting the #59511 refusal, which depends on it. ### Motivation The FIPS platforms' constraint selected nothing, and the `fips` flavor selected the FIPS tags but kept the upstream SDK, both silently producing non-FIPS binaries, which #59511 had to refuse. Since #58511 made `msgo` a toolchain, a platform can carry both the constraint and the SDK choice. ### Describe how you validated your changes - `//cmd/agent` builds with `msgo` and the FIPS tags on the FIPS platforms, `requirefips` being Linux-only, and with the upstream SDK and no FIPS tags on the others, - the agent, installer, loader and packaging targets, and `@openssl`, analyze with no ambiguous `select()` on the Linux and Windows platforms, FIPS or not, - `bazel test` passes on a FIPS platform, - the installer's symbol test passes on the Linux and Windows FIPS platforms, and fails when expecting a package the binary lacks. ### Additional Notes The FIPS platforms set `sdk_name` through `platform(flags = ...)`, because deriving it from the constraint would take patching rules_go's `go_transition` or duplicating its `toolchain()` matrix. The retired flavor value now fails the analysis of packaging targets. `//cmd/dogstatsd` drops its `cgo` select, whose FIPS branch was a no-op, leaving `dd_agent_go_binary`'s identical default. `//cmd/loader:trace_loader_all_files` only excludes Windows, like `:loader`, instead of listing Linux and macOS. Prerequisites: - #56351 - #56865 - #57078 - #57223 - #58511 - #58530 - #59501 - #59511 - #59840 - #59871 - #59875 - #60181
### What does this PR do? Request FIPS builds with `--platforms=//bazel/platforms:<os>_<arch>_fips`, whose `flags` select the `msgo` SDK, instead of the retired `fips` value of `//packages/agent:flavor`. Key the FIPS `config_setting`s, `@openssl`'s and the FIPS package names on the `//bazel/platforms:fips` constraint, and have the omnibus helpers pass the FIPS platform. Register a test toolchain so that `bazel test` works on FIPS platforms, and remove the unused macOS FIPS platforms. Have the installer's symbol test require `msgo`'s OpenSSL or CNG backend on the Linux or Windows FIPS platforms, and reject it elsewhere. This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS binaries load, nor lifting the #59511 refusal, which depends on it. ### Motivation The FIPS platforms' constraint selected nothing, and the `fips` flavor selected the FIPS tags but kept the upstream SDK, both silently producing non-FIPS binaries, which #59511 had to refuse. Since #58511 made `msgo` a toolchain, a platform can carry both the constraint and the SDK choice. ### Describe how you validated your changes - `//cmd/agent` builds with `msgo` and the FIPS tags on the FIPS platforms, `requirefips` being Linux-only, and with the upstream SDK and no FIPS tags on the others, - the agent, installer, loader and packaging targets, and `@openssl`, analyze with no ambiguous `select()` on the Linux and Windows platforms, FIPS or not, - `bazel test` passes on a FIPS platform, - the installer's symbol test passes on the Linux and Windows FIPS platforms, and fails when expecting a package the binary lacks. ### Additional Notes The FIPS platforms set `sdk_name` through `platform(flags = ...)`, because deriving it from the constraint would take patching rules_go's `go_transition` or duplicating its `toolchain()` matrix. The retired flavor value now fails the analysis of packaging targets. `//cmd/dogstatsd` drops its `cgo` select, whose FIPS branch was a no-op, leaving `dd_agent_go_binary`'s identical default. `//cmd/loader:trace_loader_all_files` only excludes Windows, like `:loader`, instead of listing Linux and macOS. Prerequisites: - #56351 - #56865 - #57078 - #57223 - #58511 - #58530 - #59501 - #59511 - #59840 - #59871 - #59875 - #60181
### What does this PR do? Request FIPS builds with `--platforms=//bazel/platforms:<os>_<arch>_fips`, whose `flags` select the `msgo` SDK, instead of the retired `fips` value of `//packages/agent:flavor`. Key the FIPS `config_setting`s, `@openssl`'s and the FIPS package names on the `//bazel/platforms:fips` constraint, and have the omnibus helpers pass the FIPS platform. Register a test toolchain so that `bazel test` works on FIPS platforms, and remove the unused macOS FIPS platforms. Have the installer's symbol test require `msgo`'s OpenSSL or CNG backend on the Linux or Windows FIPS platforms, and reject it elsewhere. This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS binaries load, nor lifting the #59511 refusal, which depends on it. ### Motivation The FIPS platforms' constraint selected nothing, and the `fips` flavor selected the FIPS tags but kept the upstream SDK, both silently producing non-FIPS binaries, which #59511 had to refuse. Since #58511 made `msgo` a toolchain, a platform can carry both the constraint and the SDK choice. ### Describe how you validated your changes - `//cmd/agent` builds with `msgo` and the FIPS tags on the FIPS platforms, `requirefips` being Linux-only, and with the upstream SDK and no FIPS tags on the others, - the agent, installer, loader and packaging targets, and `@openssl`, analyze with no ambiguous `select()` on the Linux and Windows platforms, FIPS or not, - `bazel test` passes on a FIPS platform, - the installer's symbol test passes on the Linux and Windows FIPS platforms, and fails when expecting a package the binary lacks. ### Additional Notes The FIPS platforms set `sdk_name` through `platform(flags = ...)`, because deriving it from the constraint would take patching rules_go's `go_transition` or duplicating its `toolchain()` matrix. The retired flavor value now fails the analysis of packaging targets. `//cmd/dogstatsd` drops its `cgo` select, whose FIPS branch was a no-op, leaving `dd_agent_go_binary`'s identical default. `//cmd/loader:trace_loader_all_files` only excludes Windows, like `:loader`, instead of listing Linux and macOS. Prerequisites: - #56351 - #56865 - #57078 - #57223 - #58511 - #58530 - #59501 - #59511 - #59840 - #59871 - #59875 - #60181
What does this PR do?
Make
go_buildbuild themsgoFIPS backend withbazel run //:msgo --instead of themsgopreinstalled in build images.Make the omnibus symbol inspector run
tool nmthrough//:msgoin FIPS mode and@rules_go//gootherwise, instead of thegoonPATH.Remove
add_msgo_to_envand the WindowsMSGO_ROOTlookup feeding it, no omnibus FIPS build running any othergoneeding the preinstalledmsgo.Remove
get_omnibus_env'sfips_modeargument with them, its only other effect being aFIPS_MODEvariable nothing reads.Builds without the
msgobackend keep thegoonPATH.Motivation
FIPS builds take
msgofrom the build images, whereadd_msgo_to_envputs it ahead of thegoonPATH, so the FIPS toolchain comes with the image rather than being pinned like the other Bazel toolchains, and is selected by altering the environment everygocommand shares.#58511 made
msgoa Bazel toolchain and #59501 made every FIPS build name its backend, sogo_buildcan now route exactly themsgobuilds to that toolchain, one step towards building Go binaries with Bazel.Describe how you validated your changes
With upstream Go as the
goonPATH, checked that:dda inv -- -e installer.build --fips-backend=msgo --no-cgowithinstaller.rb's run and install paths andDEPLOY_AGENT=truenever runs thatgo, and builds the Linux installer withmsgo, recordingGOEXPERIMENT=ms_nocgo_opensslcrypto, linking its OpenSSL backend (go-crypto-openssl/opensslsymbols) and setting its RUNPATH, even whenbazeliskis a shim changing to another checkout, as omnibus's is,dda inv -- -e agent.build --build-exclude=systemd --flavor fipsbuilds withmsgo, linking its OpenSSL backend,msgobackend still use thatgo, aboringcryptosecret-generic-connector included,dda inv -- -e installer.build --fips-backend=msgobuilds the Windows installer withmsgo,bazel run @rules_go//go tool nmlists the symbols of a binary on Linux and Windows, asbazel run //:msgo tool nmdoes,dda inv -- -e linter.pythonanddda inv -- -e invoke-unit-tests.run --tests=gopass.Additional Notes
go_buildpasses-Cwith the current directory to the Bazelgo, because omnibus'sbazelshim runs Bazel from the original checkout while the build runs in omnibus's source copy.The symbol inspector gets
omnibazel_flagsfrom its callers, because it cannot resolveinstall_diritself, and Bazel would otherwise discard its analysis cache.go_buildnow joins its arguments withjoin_command, so itsPATHgocommand lines quote them the shell's way rather than with hand-written double quotes.