Repository navigation
[ABLD-525] register a msgo SDK toolchain (FIPS prereq) - #58511
Conversation
There was a problem hiding this comment.
AI review by Codex (OpenAI) - workflow run
The patch is incorrect: the new extension commits unguarded print() calls, violating the repository’s Starlark logging requirement. Build validation was not run in this read-only environment.
Regression DetectorRegression Detector ResultsMetrics dashboard Baseline: 400a51d Optimization Goals: ✅ No significant changes detected
|
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|---|---|---|---|---|---|---|
| ➖ | dsd_uds_client_drop_detector_cpu | % cpu utilization | +2.32 | [+1.79, +2.85] | 1 | Logs |
| ➖ | dsd_uds_10mb_3k_timestamped_contexts_memory | memory utilization | +1.02 | [+0.80, +1.24] | 1 | Logs |
| ➖ | quality_gate_metrics_logs | memory utilization | +0.98 | [+0.76, +1.20] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_private_action_runner | memory utilization | +0.51 | [+0.38, +0.64] | 1 | Logs bounds checks dashboard |
| ➖ | dsd_uds_10mb_3k_timestamped_contexts_cpu | % cpu utilization | +0.50 | [+0.25, +0.76] | 1 | Logs |
| ➖ | quality_gate_idle_all_features | memory utilization | +0.10 | [+0.03, +0.17] | 1 | Logs bounds checks dashboard |
| ➖ | python_openmetrics | % cpu utilization | +0.08 | [-0.60, +0.76] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_idle | memory utilization | +0.05 | [+0.01, +0.09] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_security_idle | memory utilization | -0.10 | [-0.13, -0.06] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_security_no_fs_load | memory utilization | -0.21 | [-0.26, -0.16] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_security_mean_fs_load | memory utilization | -0.25 | [-0.29, -0.22] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_logs | % cpu utilization | -0.56 | [-1.48, +0.35] | 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 | 74.46 ≤ 100 | bounds checks dashboard |
| ✅ | python_openmetrics | cpu_usage | 10/10 | 1331.59 ≤ 1500 | bounds checks dashboard |
| ✅ | python_openmetrics | memory_usage | 10/10 | 4.32GiB ≤ 4.75GiB | bounds checks dashboard |
| ✅ | quality_gate_idle | intake_connections | 10/10 | 4 ≤ 5 | bounds checks dashboard |
| ✅ | quality_gate_idle | memory_usage | 10/10 | 176.10MiB ≤ 181MiB | bounds checks dashboard |
| ✅ | quality_gate_idle | total_bytes_received | 10/10 | 756.49KiB ≤ 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 | 474.77MiB ≤ 542MiB | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | total_bytes_received | 10/10 | 1.14MiB ≤ 1.25MiB | bounds checks dashboard |
| ✅ | quality_gate_logs | intake_connections | 10/10 | 17 ≤ 40 | bounds checks dashboard |
| ✅ | quality_gate_logs | memory_usage | 10/10 | 216.39MiB ≤ 228MiB | bounds checks dashboard |
| ✅ | quality_gate_logs | missed_bytes | 10/10 | 0B = 0B | bounds checks dashboard |
| ✅ | quality_gate_logs | total_bytes_received | 10/10 | 263.93MiB ≤ 292MiB | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | cpu_usage | 10/10 | 425.93 ≤ 2000 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | intake_connections | 10/10 | 19 ≤ 40 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | memory_usage | 10/10 | 437.66MiB ≤ 455MiB | 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 | 74.96MiB ≤ 77MiB | bounds checks dashboard |
| ✅ | quality_gate_security_idle | cpu_usage | 10/10 | 30.00 ≤ 100 | bounds checks dashboard |
| ✅ | quality_gate_security_idle | memory_usage | 10/10 | 327.53MiB ≤ 357MiB | bounds checks dashboard |
| ✅ | quality_gate_security_mean_fs_load | cpu_usage | 10/10 | 55.09 ≤ 200 | bounds checks dashboard |
| ✅ | quality_gate_security_mean_fs_load | memory_usage | 10/10 | 306.17MiB ≤ 337MiB | bounds checks dashboard |
| ✅ | quality_gate_security_no_fs_load | cpu_usage | 10/10 | 26.33 ≤ 100 | bounds checks dashboard |
| ✅ | quality_gate_security_no_fs_load | memory_usage | 10/10 | 310.99MiB ≤ 348MiB | 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_idle_all_features, bounds check total_bytes_received: 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_metrics_logs, bounds check missed_bytes: 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 intake_connections: 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 memory_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.
- quality_gate_private_action_runner, bounds check memory_usage: 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_logs, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_idle, bounds check memory_usage: 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 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.
1291c1d to
a113248
Compare
There was a problem hiding this comment.
AI review by Codex (OpenAI) - workflow run
The patch is incorrect: an informational update check can fail toolchain resolution, and the new warning violates the supplied Starlark logging requirement. Validation was limited to static review.
Static quality checks✅ Please find below the results from static quality gates 33 successful checks with minimal change (< 2 KiB)
|
7c4d613 to
9b5d950
Compare
### What does this PR do? Build the FIPS installer through `bazel run //:msgo --` instead of the `msgo` preinstalled in build images, by letting `go_build` take the `go` command to run. Drop `installer.rb`'s `add_msgo_to_env` call accordingly. ### Motivation Evaluate replacing the preinstalled `msgo` with the Bazel-fetched one from #58511, starting with the smallest FIPS build. ### Describe how you validated your changes Checked that: - `dda inv -- -e installer.build --fips-mode --no-cgo` builds the installer with `bazel run //:msgo --`, linking `msgo`'s OpenSSL backend (`_Cfunc__mkcgo_OPENSSL` symbols, as `omnibus/lib/fips.rb` expects), - `dda inv -- -e linter.python` passes. ### Additional Notes - `bazel run //:msgo` runs without omnibus's `omnibazel_flags`, so it may discard Bazel's analysis cache between the job's other Bazel invocations, - the Windows FIPS installer build switches too, but wasn't exercised locally.
### What does this PR do? Add a `msgo` module extension creating the Microsoft build of Go SDK for the host platform at the version of `go.work`'s `go` directive, and registering a toolchain for it, selectable via `--@rules_go//go/toolchain:sdk_name=msgo`. Register `go_sdk`'s toolchains ahead of it, so that builds without `sdk_name` keep using the `go.work` SDK. Add `//:msgo`, running `@rules_go//go` under `sdk_name=msgo`, as a `bazel run` shorthand, tagged `manual` so that `//...` doesn't build `msgo`. The extension reads `microsoft/go`'s release manifest for the pinned build revision, then calls `go_download_sdk_rule` and `declare_bazel_toolchains`, `rules_go`'s own building blocks `go_sdk.download()` uses. It warns when a newer revision than the pinned one exists, or when it can't check. Allow such actionable `print()` warnings, starting with `WARNING: `, in `bazel/AGENTS.md` and `bazel/codereview_guideline.md`, as `rules_go`, `rules_python` and `rules_rust` already emit them. ### Motivation [ABLD-525](https://datadoghq.atlassian.net/browse/ABLD-525) wants FIPS platforms, such as `//bazel/platforms:linux_arm64_fips`, to build with `msgo` through Go toolchain selection, which #56440 aims at providing. Offloading the SDK from #56440 and reading `microsoft/go`'s release manifest at fetch time leaves the build revision as the only pinned value, with no update step. A registered `msgo` toolchain also gives a point of maintenance where patches can be inserted, which there is none of today. ### Describe how you validated your changes Checked that: - `bazel run //:msgo -- version` prints `go1.26.10` on Linux and Windows, `env GOROOT` pointing at `@msgo`, - a binary links with `@msgo` under `sdk_name=msgo`, recording `GOEXPERIMENT=ms_nocgo_opensslcrypto`, and with `@go_work_sdk` otherwise, - `//pkg/fips` compiles `fips.go` with `msgo`, whose default sets its `goexperiment.systemcrypto` build tag, and `fips_disabled.go` otherwise, - with all downloads blocked, re-evaluating the extension still builds with `msgo`, reading the pinned release from `MODULE.bazel.lock`, - the build fails without the `inject_repo()` call, `@io_bazel_rules_go` not being visible from `@msgo`, - `bazel build --nobuild //...` analyzes cleanly, and `//bazel/buildifier:test` passes. ### Additional Notes - toolchains are registered for the host platform only, whereas the SDK covers every platform the manifest lists, - the extension declares itself reproducible and host-dependent, as `go_sdk` does, recording only the pinned release's archives and checksums in `MODULE.bazel.lock`, as facts, - a missing pinned `msgo` release fails every Go build, `@msgo_toolchains` being registered for all of them, - building with `msgo` on macOS fails in Bazel's sandbox, `go:embed` rejecting the symlinked `config.json` that `msgo`'s telemetry package embeds (bazel-contrib/rules_go#3178).
9b5d950 to
73f6038
Compare
### What does this PR do? Set `GOEXPERIMENT=ms_nocgo_opensslcrypto` for Linux FIPS omnibus builds, as `bazel/rules/msgo/extension.bzl` does for the `msgo` Bazel toolchain. Honor the installer's `--no-cgo` in FIPS mode too, `msgo`'s cgo-less OpenSSL backend making cgo unnecessary there. Check FIPS binaries for `vendor/github.com/microsoft/go-crypto-openssl/openssl.` symbols, which cgo and cgo-less builds both have, instead of the cgo-only `_Cfunc__mkcgo_OPENSSL` ones. Make `//cmd/installer:installer` pure on Linux and drop its FIPS-only `cgo` override, so that it builds without cgo in both flavors, as omnibus does. ### Motivation The upcoming bazelification will ship `//cmd/installer:installer` built with #58511's `msgo` toolchain, which sets `ms_nocgo_opensslcrypto`, so the omnibus build should establish the same baseline. Without that experiment, Linux's OpenSSL backend needs cgo, the only reason why the FIPS installer, unlike the non-FIPS one, was built with cgo. ### Describe how you validated your changes Checked with `msgo` 1.26.10 that: - `dda inv -- -e installer.build --fips-mode --no-cgo`, with `GOEXPERIMENT=ms_nocgo_opensslcrypto`, builds with `CGO_ENABLED=0`, dynamically linking only `libc`, `libdl` and `libpthread`, OpenSSL being `dlopen`ed, - that installer has `vendor/github.com/microsoft/go-crypto-openssl/openssl.` symbols but no `_Cfunc__mkcgo_OPENSSL` ones, while a cgo FIPS build, like the agent's, has both, - `//cmd/installer:installer` builds with `CGO_ENABLED=0` and the same dynamic libraries in the FIPS flavor with the `msgo` toolchain, and statically in the base flavor. Checked that `//bazel/buildifier:test` and `dda inv -- -e linter.python` pass. ### Additional Notes - a rules_go binary's `CGO_ENABLED` comes from `pure`, not `cgo`, which only covers the target's own sources, so the Bazel installer was built with cgo in both flavors until now, - the non-FIPS Bazel installer therefore becomes static on Linux, as the omnibus-built one already is, while Windows and macOS keep cgo, as omnibus does there, - the agent keeps cgo, for `rtloader` and the `netcgo` resolver among others, - Go 1.27 removes the experiment and rejects it, its cgo-less backend becoming `systemcrypto`'s own under `CGO_ENABLED=0`, so both experiment settings go away then, - Windows keeps plain `systemcrypto`, with cgo.
### What does this PR do? Set `GOEXPERIMENT=ms_nocgo_opensslcrypto` for Linux FIPS omnibus builds, as `bazel/rules/msgo/extension.bzl` does for the `msgo` Bazel toolchain. Honor the installer's `--no-cgo` in FIPS mode too, `msgo`'s cgo-less OpenSSL backend making cgo unnecessary there. Check FIPS binaries for `vendor/github.com/microsoft/go-crypto-openssl/openssl` symbols, which cgo and cgo-less builds both have, instead of the cgo-only `_Cfunc__mkcgo_OPENSSL` ones. Make `//cmd/installer:installer` pure on Linux and drop its FIPS-only `cgo` override, so that it builds without cgo in both flavors, as omnibus does. ### Motivation The upcoming bazelification will ship `//cmd/installer:installer` built with #58511's `msgo` toolchain, which sets `ms_nocgo_opensslcrypto`, so the omnibus build should establish the same baseline. Without that experiment, Linux's OpenSSL backend needs cgo, the only reason why the FIPS installer, unlike the non-FIPS one, was built with cgo. ### Describe how you validated your changes Checked with `msgo` 1.26.10 that: - `dda inv -- -e installer.build --fips-mode --no-cgo`, with `GOEXPERIMENT=ms_nocgo_opensslcrypto`, builds with `CGO_ENABLED=0`, dynamically linking only `libc`, `libdl` and `libpthread`, OpenSSL being `dlopen`ed, - that installer has `vendor/github.com/microsoft/go-crypto-openssl/openssl` symbols but no `_Cfunc__mkcgo_OPENSSL` ones, while a cgo FIPS build, like the agent's, has both, - `//cmd/installer:installer` builds with `CGO_ENABLED=0` and the same dynamic libraries in the FIPS flavor with the `msgo` toolchain, and statically in the base flavor. Checked that `//bazel/buildifier:test` and `dda inv -- -e linter.python` pass. ### Additional Notes - a rules_go binary's `CGO_ENABLED` comes from `pure`, not `cgo`, which only covers the target's own sources, so the Bazel installer was built with cgo in both flavors until now, - the non-FIPS Bazel installer therefore becomes static on Linux, as the omnibus-built one already is, while Windows and macOS keep cgo, as omnibus does there, - the agent keeps cgo, for `rtloader` and the `netcgo` resolver among others, - Go 1.27 removes the experiment and rejects it, its cgo-less backend becoming `systemcrypto`'s own under `CGO_ENABLED=0`, so both experiment settings go away then, - Windows keeps plain `systemcrypto`, with cgo.
### What does this PR do? Set `GOEXPERIMENT=ms_nocgo_opensslcrypto` for Linux FIPS omnibus builds, as `bazel/rules/msgo/extension.bzl` does for the `msgo` Bazel toolchain. Honor the installer's `--no-cgo` in FIPS mode too, `msgo`'s cgo-less OpenSSL backend making cgo unnecessary there. Give that installer its embedded libraries' rpath through Go's `-r`, which cgo's external linker otherwise gets from omnibus. Check FIPS binaries for `vendor/github.com/microsoft/go-crypto-openssl/openssl` symbols, which cgo and cgo-less builds both have, instead of the cgo-only `_Cfunc__mkcgo_OPENSSL` ones. Make `//cmd/installer:installer` pure on Linux and drop its FIPS-only `cgo` override, so that it builds without cgo in both flavors, as omnibus does. ### Motivation The upcoming bazelification will ship `//cmd/installer:installer` built with #58511's `msgo` toolchain, which sets `ms_nocgo_opensslcrypto`, so the omnibus build should establish the same baseline. Without that experiment, Linux's OpenSSL backend needs cgo, the only reason why the FIPS installer, unlike the non-FIPS one, was built with cgo. ### Describe how you validated your changes Checked with `msgo` 1.26.10 that: - `dda inv -- -e installer.build --fips-mode --no-cgo`, with `GOEXPERIMENT=ms_nocgo_opensslcrypto`, builds with `CGO_ENABLED=0`, dynamically linking only `libc`, `libdl` and `libpthread`, OpenSSL being `dlopen`ed, - built with `--install-path`, that installer gets `<install_path>/embedded/lib` as rpath, as `datadog-agent-finalize.rb` asserts, - that installer has `vendor/github.com/microsoft/go-crypto-openssl/openssl` symbols but no `_Cfunc__mkcgo_OPENSSL` ones, while a cgo FIPS build, like the agent's, has both, - `//cmd/installer:installer` builds with `CGO_ENABLED=0` and the same dynamic libraries in the FIPS flavor with the `msgo` toolchain, and statically in the base flavor. Checked that `//bazel/buildifier:test` and `dda inv -- -e linter.python` pass. ### Additional Notes - a rules_go binary's `CGO_ENABLED` comes from `pure`, not `cgo`, which only covers the target's own sources, so the Bazel installer was built with cgo in both flavors until now, - the non-FIPS Bazel installer therefore becomes static on Linux, as the omnibus-built one already is, while Windows and macOS keep cgo, as omnibus does there, - the Bazel `//cmd/installer:installer` has no such rpath yet, which its FIPS packaging will need, - the agent keeps cgo, for `rtloader` and the `netcgo` resolver among others, - Go 1.27 removes the experiment and rejects it, its cgo-less backend becoming `systemcrypto`'s own under `CGO_ENABLED=0`, so both experiment settings go away then, - Windows keeps plain `systemcrypto`, with cgo.
### What does this PR do? Build the Linux FIPS installer without cgo, honoring its `--no-cgo` as for the non-FIPS one, through `msgo`'s cgo-less OpenSSL backend. Set `GOEXPERIMENT=ms_nocgo_opensslcrypto` for Linux FIPS omnibus builds, which enables that backend, as `bazel/rules/msgo/extension.bzl` does for the `msgo` Bazel toolchain. Write the installer's own version's and the stable version's embedded libraries into its rpath with Go's `-r`, in that order, and drop the `patchelf` rewrite of its bootstrap copy from `.gitlab/build/packaging/oci.yml`. Check FIPS binaries for `vendor/github.com/microsoft/go-crypto-openssl/openssl` symbols, which cgo and cgo-less builds both have, instead of the cgo-only `_Cfunc__mkcgo_OPENSSL` ones. Make `//cmd/installer:installer` pure on Linux and drop its FIPS-only `cgo` override, so that it builds without cgo in both flavors, as omnibus does. ### Motivation The upcoming bazelification will ship `//cmd/installer:installer` built with #58511's `msgo` toolchain, which sets `ms_nocgo_opensslcrypto`, so the omnibus build should establish the same baseline. Without that experiment, Linux's OpenSSL backend needs cgo, the only reason why the FIPS installer, unlike the non-FIPS one, was built with cgo. Without cgo, Go's internal linker ignores omnibus' rpath, which `-r` restores. The bootstrap copy's `patchelf --set-rpath`, from #57045, segfaults on such a binary once GNU-stripped, `patchelf` 0.18.0 included. Listing both library directories makes that rewrite unnecessary: the installed installer finds its own version's, and the bootstrap, which runs before that version is unpacked, falls back to the stable one's. ### Describe how you validated your changes Checked with `msgo` 1.26.10 that: - `dda inv -- -e installer.build --fips-mode --no-cgo`, with `GOEXPERIMENT=ms_nocgo_opensslcrypto` and a versioned `--install-path`, builds with `CGO_ENABLED=0`, dynamically linking only `libc`, `libdl` and `libpthread`, OpenSSL being `dlopen`ed, - once GNU-stripped, as omnibus does, that installer's rpath lists `<install_path>/embedded/lib` then `<package>/stable/embedded/lib`, as `datadog-agent-finalize.rb` now asserts, - a stripped binary with that rpath order loads `libcrypto` from its own version's directory when present, and from the stable one's otherwise, - that installer has `vendor/github.com/microsoft/go-crypto-openssl/openssl` symbols but no `_Cfunc__mkcgo_OPENSSL` ones, while a cgo FIPS build, like the agent's, has both, - `//cmd/installer:installer` builds with `CGO_ENABLED=0` and the same dynamic libraries in the FIPS flavor with the `msgo` toolchain, and statically in the base flavor. Checked that `//bazel/buildifier:test` and `dda inv -- -e linter.python` pass. ### Additional Notes - a `rules_go` binary's `CGO_ENABLED` comes from `pure`, not `cgo`, which only covers the target's own sources, so the Bazel installer was built with cgo in both flavors until now, - the non-FIPS Bazel installer therefore becomes static on Linux, as the omnibus-built one already is, while Windows and macOS keep cgo, as omnibus does there, - the Bazel `//cmd/installer:installer` has no such rpath yet, which its FIPS packaging will need, - #57045's `TestFipsUpgradeFromDebRPM` exercises the bootstrap's fallback to the stable version's libraries, - the agent keeps cgo, for `rtloader` and the `netcgo` resolver among others, - Go 1.27 removes the experiment and rejects it, its cgo-less backend becoming `systemcrypto`'s own under `CGO_ENABLED=0`, so both experiment settings go away then, - Windows keeps plain `systemcrypto`, with cgo.
…56351) ### What does this PR do? **Build** the Linux FIPS installer without cgo, honoring its `--no-cgo` as for the non-FIPS one, through `msgo`'s cgo-less OpenSSL backend. Set `GOEXPERIMENT=ms_nocgo_opensslcrypto` for Linux FIPS omnibus builds, which enables that backend, as `bazel/rules/msgo/extension.bzl` does for the `msgo` Bazel toolchain. Write the installer's own version's and the stable version's embedded libraries into its rpath with Go's `-r`, in that order, and drop the `patchelf` rewrite of its bootstrap copy from `.gitlab/build/packaging/oci.yml`. Check FIPS binaries for `vendor/github.com/microsoft/go-crypto-openssl/openssl` symbols, which cgo and cgo-less builds both have, instead of the cgo-only `_Cfunc__mkcgo_OPENSSL` ones. Make `//cmd/installer:installer` pure on Linux and drop its FIPS-only `cgo` override, so that it builds without cgo in both flavors, as omnibus does. ### Motivation The upcoming bazelification will ship `//cmd/installer:installer` built with #58511's `msgo` toolchain, which sets `ms_nocgo_opensslcrypto`, so the omnibus build should establish the same baseline. Without that experiment, Linux's OpenSSL backend needs cgo, the only reason why the FIPS installer, unlike the non-FIPS one, was built with cgo. Without cgo, Go's internal linker ignores omnibus' rpath, which `-r` restores. The bootstrap copy's `patchelf --set-rpath`, from #57045, segfaults on such a binary once GNU-stripped, `patchelf` 0.18.0 included. Listing both library directories makes that rewrite unnecessary: the installed installer finds its own version's, and the bootstrap, which runs before that version is unpacked, falls back to the stable one's. ### Describe how you validated your changes Checked with `msgo` 1.26.10 that: - `dda inv -- -e installer.build --fips-mode --no-cgo`, with `GOEXPERIMENT=ms_nocgo_opensslcrypto` and a versioned `--install-path`, builds with `CGO_ENABLED=0`, dynamically linking only `libc`, `libdl` and `libpthread`, OpenSSL being `dlopen`ed, - once GNU-stripped, as omnibus does, that installer's rpath lists `<install_path>/embedded/lib` then `<package>/stable/embedded/lib`, as `datadog-agent-finalize.rb` now asserts, - a stripped binary with that rpath order loads `libcrypto` from its own version's directory when present, and from the stable one's otherwise, - that installer has `vendor/github.com/microsoft/go-crypto-openssl/openssl` symbols but no `_Cfunc__mkcgo_OPENSSL` ones, while a cgo FIPS build, like the agent's, has both, - `//cmd/installer:installer` builds with `CGO_ENABLED=0` and the same dynamic libraries in the FIPS flavor with the `msgo` toolchain, and statically in the base flavor. Checked that `//bazel/buildifier:test` and `dda inv -- -e linter.python` pass. ### Additional Notes - a `rules_go` binary's `CGO_ENABLED` comes from `pure`, not `cgo`, which only covers the target's own sources, so the Bazel installer was built with cgo in both flavors until now, - the non-FIPS Bazel installer therefore becomes static on Linux, as the omnibus-built one already is, while Windows and macOS keep cgo, as omnibus does there, - the Bazel `//cmd/installer:installer` has no such rpath yet, which its FIPS packaging will need, - #57045's `TestFipsUpgradeFromDebRPM` exercises the bootstrap's fallback to the stable version's libraries, - the agent keeps cgo, for `rtloader` and the `netcgo` resolver among others, - Go 1.27 removes the experiment and rejects it, its cgo-less backend becoming `systemcrypto`'s own under `CGO_ENABLED=0`, so both experiment settings go away then, - Windows keeps plain `systemcrypto`, with cgo. Co-authored-by: regis.desgroppes <[email protected]>
### What does this PR do? Run the installer build's `go` invocations through `bazel run //:msgo --` in FIPS mode and `bazel run //:go --` otherwise, instead of whichever `go` is on `PATH`. Drop `installer.rb`'s `add_msgo_to_env` call accordingly. To that end, let `go_build` take an optional `bazel_go` target, and the FIPS symbol check take the `go` command to run. ### Motivation Evaluate replacing the `msgo` preinstalled in build images with the Bazel-fetched one from #58511, starting with the smallest FIPS build. Each `go` call states the toolchain it runs, while a stray `PATH` one still fails on the `GOEXPERIMENT=ms_nocgo_opensslcrypto` of Linux FIPS omnibus builds. ### Describe how you validated your changes With upstream Go as the `go` on `PATH`, logging its invocations, checked that: - `dda inv -- -e installer.build --fips-mode --no-cgo` with `installer.rb`'s run and install paths, `GOEXPERIMENT=ms_nocgo_opensslcrypto` and `DEPLOY_AGENT=true` never runs that `go`, and builds the Linux installer with `msgo`, recording `CGO_ENABLED=0` and the experiment, linking its OpenSSL backend (`go-crypto-openssl/openssl` symbols, which `bazel run //:msgo -- tool nm` finds from `omnibus/`) and setting both RUNPATH entries, - `dda inv -- -e installer.build --no-cgo` never runs that `go` either, and builds with `//:go`, - `dda inv -- -e installer.build --fips-mode` builds the Windows installer with `msgo` and no `go` on `PATH`, linking its CNG backend (`go-crypto-winnative` symbols), - `dda inv -- -e linter.python` and `dda inv -- -e invoke-unit-tests.run` for `go` and `omnibus` pass. ### Additional Notes `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.
### What does this PR do? Make `go_build` run `bazel run //:msgo --` for the `msgo` FIPS backend instead of the `msgo` preinstalled in build images, and the omnibus FIPS symbol check run `tool nm` the same way. Drop `installer.rb`'s `add_msgo_to_env` call, the installer build running no other `go`. ### Motivation Evaluate replacing the preinstalled `msgo` with the Bazel-fetched one from #58511, now that #59501 has every FIPS build name its backend. ### 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`, - `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.
### What does this PR do? Make `go_build` run `bazel run //:msgo --` for the `msgo` FIPS backend instead of the `msgo` preinstalled in build images, and the omnibus symbol inspector run `tool nm` through `//:msgo` in FIPS mode and `//:go` otherwise. Drop `installer.rb`'s `add_msgo_to_env` call, the installer build running no other `go`. ### Motivation Evaluate replacing the preinstalled `msgo` with the Bazel-fetched one from #58511, now that #59501 has every FIPS build name its backend. ### 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`, - `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.
### 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 `//:go` otherwise, instead of the `go` on `PATH`. Drop `installer.rb`'s `add_msgo_to_env` call, the installer build running no other `go`. The agent and OTel agent builds keep it for their other `go` commands, and 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 only. ### 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 //: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.
### 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 `//: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`. 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 only. ### 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 //: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.
### 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 `//: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 //: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.
### 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 `//: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 //: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.
### 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.
…8530) <!--Please give us some feedback on your experience writing this PR ! https://app.datadoghq.com/forms/43db4c02-6837-400c-8083-692e141b1b88 !--> ### 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. Co-authored-by: regis.desgroppes <[email protected]>
### 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? 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 the target platform's `//bazel/platforms:fips` constraint the only way to request a FIPS build, the FIPS platforms selecting the `msgo` SDK through their own `flags`, instead of the `fips` value of `//packages/agent:flavor`. To that end: - give `//bazel/platforms:crypto` a `:standard` default value, which `linux_default` now requires, so that it never overlaps `linux_fips`, - key `//packages/agent:fips` (formerly `fips_flavor`), `linux_fips` and the per-platform FIPS settings, as well as `@openssl`'s, on the constraint, - drop `fips` from the `//packages/agent:flavor` values, - name FIPS packages from the constraint in `package_naming.bzl`, - have the omnibus build helpers pass `--platforms=//bazel/platforms:<os>_<arch>_fips` instead of the flavor, - register a test toolchain for FIPS targets, so that `bazel test` works on FIPS platforms, - remove the macOS FIPS platforms, which no product uses. This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS binaries load, nor lifting the #59511 refusal of `--enable-bazel` FIPS builds, which depends on it. ### Motivation `bazel build --platforms=//bazel/platforms:linux_x86_64_fips` built a non-FIPS binary, the platform's `:fips` constraint selecting nothing, while `--//packages/agent:flavor=fips` selected the FIPS build tags but kept the upstream Go SDK, silently producing a non-FIPS binary, which #59511 had to refuse. #58511 made `msgo` a Bazel toolchain, selected by `--@rules_go//go/toolchain:sdk_name=msgo`, so a FIPS platform can now carry both the constraint and that toolchain choice, making FIPS a property of the target platform only. ### Describe how you validated your changes Checked that, for `//cmd/agent:agent`: - `linux_x86_64_fips` builds with `msgo`, with the `requirefips` and `goexperiment.systemcrypto` tags, and `windows_x86_64_fips` with `msgo` and `goexperiment.systemcrypto` only, as the tasks do, - `linux_x86_64` and `windows_x86_64` keep the upstream SDK without these tags, - `linux_arm64_fips` selects `msgo`, checked on a pure-Go target since this x86-64 host has no arm64 C toolchain. Also checked that: - `//cmd/agent`, `//cmd/dogstatsd`, `//cmd/installer`, `//cmd/loader`, `//packages/agent/linux:debian`, `//packages/agent/dependencies`, `//packages/agent/product` and `@openssl//:openssl` analyze without ambiguous `select()` on `linux_x86_64` and `linux_x86_64_fips`, and `//cmd/agent`, `//cmd/dogstatsd` and `@openssl//:openssl` on `windows_x86_64` and `windows_x86_64_fips`, - `bazel test` passes on `//pkg/ebpf:verify_generated_files` with `--platforms=//bazel/platforms:linux_x86_64_fips`, - `//packages/rules` tests pass, the FIPS product names now coming from the constraint. ### Additional Notes The FIPS platforms set `sdk_name` through `platform(flags = ...)`, native since Bazel 8, because deriving it from the constraint would take patching `go_transition`, `go_binary` using the only incoming transition a rule can have, or duplicating rules_go's `toolchain()` matrix. `linux_default` and `linux_fips` are made disjoint by the `:standard` default rather than by `select()` specialization, which doesn't see through the `config_setting_group` that `linux_default` uses since the `recorder` flavor. Passing the retired `--//packages/agent:flavor=fips` now fails the analysis of packaging targets, and leaves a bare Go binary consistently non-FIPS. The `package_naming.bzl` tests transition to a FIPS platform derived from the host, so that the host's C++ toolchain keeps resolving. The Python omnibus helper lower-cases `platform.machine()`, which is `AMD64` on Windows.
### What does this PR do? Make the target platform's `//bazel/platforms:fips` constraint the only way to request a FIPS build, the FIPS platforms selecting the `msgo` SDK through their own `flags`, instead of the `fips` value of `//packages/agent:flavor`. To that end: - key `//packages/agent:fips` (formerly `fips_flavor`), `linux_fips` and the per-platform FIPS settings, as well as `@openssl`'s, on the constraint, - drop `fips` from the `//packages/agent:flavor` values, - name FIPS packages from the constraint in `package_naming.bzl`, - have the omnibus build helpers pass `--platforms=//bazel/platforms:<os>_<arch>_fips` instead of the flavor, - register a test toolchain for FIPS targets, so that `bazel test` works on FIPS platforms, - remove the macOS FIPS platforms, which no product uses. This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS binaries load, nor lifting the #59511 refusal of `--enable-bazel` FIPS builds, which depends on it. ### Motivation `bazel build --platforms=//bazel/platforms:linux_x86_64_fips` built a non-FIPS binary, the platform's `:fips` constraint selecting nothing, while `--//packages/agent:flavor=fips` selected the FIPS build tags but kept the upstream Go SDK, silently producing a non-FIPS binary, which #59511 had to refuse. #58511 made `msgo` a Bazel toolchain, selected by `--@rules_go//go/toolchain:sdk_name=msgo`, so a FIPS platform can now carry both the constraint and that toolchain choice, making FIPS a property of the target platform only. ### Describe how you validated your changes Checked that, for `//cmd/agent:agent`: - `linux_x86_64_fips` builds with `msgo`, with the `requirefips` and `goexperiment.systemcrypto` tags, and `windows_x86_64_fips` with `msgo` and `goexperiment.systemcrypto` only, as the tasks do, - `linux_x86_64` and `windows_x86_64` keep the upstream SDK without these tags, - `linux_arm64_fips` selects `msgo`, checked on a pure-Go target since this x86-64 host has no arm64 C toolchain. Also checked that: - `//cmd/agent`, `//cmd/dogstatsd`, `//cmd/installer`, `//cmd/loader`, `//packages/agent/linux:debian`, `//packages/agent/dependencies`, `//packages/agent/product` and `@openssl//:openssl` analyze without ambiguous `select()` on `linux_x86_64` and `linux_x86_64_fips`, and `//cmd/agent`, `//cmd/dogstatsd` and `@openssl//:openssl` on `windows_x86_64` and `windows_x86_64_fips`, - `bazel test` passes on `//pkg/ebpf:verify_generated_files` with `--platforms=//bazel/platforms:linux_x86_64_fips`, - `//packages/rules` tests pass, the FIPS product names now coming from the constraint. ### Additional Notes The FIPS platforms set `sdk_name` through `platform(flags = ...)`, native since Bazel 8, because deriving it from the constraint would take patching `go_transition`, `go_binary` using the only incoming transition a rule can have, or duplicating rules_go's `toolchain()` matrix. `linux_fips` still takes precedence over `@platforms//os:linux` by `select()` specialization, as set up by #60181. Passing the retired `--//packages/agent:flavor=fips` now fails the analysis of packaging targets, and leaves a bare Go binary consistently non-FIPS. The `package_naming.bzl` tests transition to a FIPS platform derived from the host, so that the host's C++ toolchain keeps resolving. The Python omnibus helper lower-cases `platform.machine()`, which is `AMD64` on Windows.
### 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.
### 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? Request FIPS builds with `--platforms=//bazel/platforms:<os>_<cpu>_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, #58511's `msgo` SDK building its OpenSSL backend without cgo through `ms_nocgo_opensslcrypto`, the default of `msgo` 1.27 (https://devblogs.microsoft.com/go/go-1-27-0-1-microsoft-build-now-available/), 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>_<cpu>_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 #59511's guard against them, 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 block. Since #58511 made `msgo` a toolchain, the platform now carries 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 retired flavor value now fails the analysis of packaging targets. `//cmd/dogstatsd` drops its `cgo` select, whose FIPS branch was a no-op, #58511's `msgo` SDK building its OpenSSL backend without cgo through `ms_nocgo_opensslcrypto`, the default of `msgo` 1.27 (https://devblogs.microsoft.com/go/go-1-27-0-1-microsoft-build-now-available/), 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. Groundwork: - #56351 - #56865 - #57078 - #57223 - #58511 - #58530 - #59501 - #59511 - #59840 - #60181
### What does this PR do? Request FIPS builds with `--platforms=//bazel/platforms:<os>_<cpu>_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. :bulb: This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS binaries load, nor lifting #59511's guard against them, which will be addressed in: - #60204. ### 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 block. Since #58511 made `msgo` a toolchain, the platform now carries 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 retired flavor value now fails the analysis of packaging targets. `//cmd/dogstatsd` drops its `cgo` select, whose FIPS branch was a no-op, #58511's `msgo` SDK building its OpenSSL backend without cgo through `ms_nocgo_opensslcrypto`, the default of [`msgo` 1.27](https://devblogs.microsoft.com/go/go-1-27-0-1-microsoft-build-now-available/), 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. Groundwork: - #56351 - #56865 - #57078 - #57223 - #58511 - #58530 - #59501 - #59511 - #59840 - #60181 Co-authored-by: regis.desgroppes <[email protected]>
What does this PR do?
Add a
msgomodule extension creating the Microsoft build of Go SDK for the host platform at the version ofgo.work'sgodirective, and registering a toolchain for it, selectable via--@rules_go//go/toolchain:sdk_name=msgo.Register
go_sdk's toolchains ahead of it, so that builds withoutsdk_namekeep using thego.workSDK.Add
//:msgo, running@rules_go//goundersdk_name=msgo, as abazel runshorthand, taggedmanualso that//...doesn't buildmsgo.The extension reads
microsoft/go's release manifest for the pinned build revision, then callsgo_download_sdk_ruleanddeclare_bazel_toolchains,rules_go's own building blocksgo_sdk.download()uses.It warns when a newer revision than the pinned one exists, or when it can't check.
Allow such actionable
print()warnings, starting withWARNING:, inbazel/AGENTS.mdandbazel/codereview_guideline.md, asrules_go,rules_pythonandrules_rustalready emit them.Motivation
ABLD-525 wants FIPS platforms, such as
//bazel/platforms:linux_arm64_fips, to build withmsgothrough Go toolchain selection, which #56440 aims at providing.Offloading the SDK from #56440 and reading
microsoft/go's release manifest at fetch time leaves the build revision as the only pinned value, with no update step.A registered
msgotoolchain also gives a point of maintenance where patches can be inserted, which there is none of today.Describe how you validated your changes
Checked that:
bazel run //:msgo -- versionprintsgo1.26.10on Linux and Windows,env GOROOTpointing at@msgo,@msgoundersdk_name=msgo, recordingGOEXPERIMENT=ms_nocgo_opensslcrypto, and with@go_work_sdkotherwise,//pkg/fipscompilesfips.gowithmsgo, whose default sets itsgoexperiment.systemcryptobuild tag, andfips_disabled.gootherwise,msgo, reading the pinned release fromMODULE.bazel.lock,inject_repo()call,@io_bazel_rules_gonot being visible from@msgo,bazel build --nobuild //...analyzes cleanly, and//bazel/buildifier:testpasses.Additional Notes
go_sdkdoes, recording only the pinned release's archives and checksums inMODULE.bazel.lock, as facts,msgorelease fails every Go build,@msgo_toolchainsbeing registered for all of them,msgoon macOS fails in Bazel's sandbox,go:embedrejecting the symlinkedconfig.jsonthatmsgo's telemetry package embeds (go_path embedding still failing on go 1.18 bazel-contrib/rules_go#3178).