Repository navigation
[ABLD-525] Make FIPS backend selection explicit in build tasks - #59501
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
Conversation
--fips-backend--fips-backend
There was a problem hiding this comment.
AI review by Codex (OpenAI) - workflow run
The patch is incorrect: the new backend option is silently ignored when building the Cluster Agent through Bazel, allowing a requested FIPS build to produce a non-FIPS binary. Python tests could not run because invoke is unavailable.
(obsolete: #59501 (comment))
Gitlab CI Configuration Changes
|
| Removed | Modified | Added | Renamed |
|---|---|---|---|
| 0 | 7 | 0 | 0 |
ℹ️ Diff available in the job log.
393e68b to
3664a45
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 393e68b4ac
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
3664a45 to
dd5a1a1
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dd5a1a110f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Static quality checks✅ Please find below the results from static quality gates 33 successful checks with minimal change (< 2 KiB)
|
dd5a1a1 to
e83aeaa
Compare
--fips-backend### 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 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 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? 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? 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?
Replace the
--fips-modeboolean in build tasks by a--fips-backendofnone,msgo(Microsoft Go's OpenSSL or CNG backend) orboringcrypto(upstream Go's BoringSSL backend) and propagate it from every build of FIPS packages togo_build.Make
go_buildset the matchingGOEXPERIMENT,boringcryptoor, for Linuxmsgobuilds,ms_nocgo_opensslcrypto, in place of the CI jobs' variable,cluster_agent.py's derivation from it andtasks/omnibus.py's omnibus-wide one.Pass
--fips-backend=msgofrom omnibus, and--fips-backend=boringcryptofrom the cluster-agent and secret-generic-connector FIPS jobs.Make the
--enable-bazelFIPS refusals from #59511 key on--fips-backend.Motivation
The boolean conflated 2 FIPS backends needing different Go distributions, since
msgorejectsGOEXPERIMENT=boringcrypto.Each therefore relied on the environment instead: BoringCrypto builds on a job variable that
cluster_agent.pyread back, Linuxmsgobuilds on an omnibus-wideGOEXPERIMENT, and both on whichevergocame first onPATH.Naming the backend lets the build pick the Go distribution, which is what bazelifying it requires: #58530 maps
msgoto 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
GOEXPERIMENTunset, checked that:cluster-agent.buildandsecret-generic-connector.buildwith--fips-backend=boringcryptolink BoringCrypto (_Cfunc__goboringcrypto_symbols), the former into its secret-generic-connector too, and not without it,msgoonPATH, asadd_msgo_to_envputs it,dda inv -- -e installer.build --fips-backend=msgo --no-cgoanddda inv -- -e agent.build --build-exclude=systemd --flavor fipsrecordGOEXPERIMENT=ms_nocgo_opensslcryptoand link its OpenSSL backend, the former setting its RUNPATH,--fips-backendvalue, and any FIPS backend with--enable-bazel, fail fast,dda inv -- -e linter.python,dda inv -- -e linter.gitlab-ci,dda inv -- -e linter.gitlab-ci-shellcheckanddda inv -- -e invoke-unit-tests.runforgo,omnibusandcluster_agent_helperspass.Additional Notes
It also leaves room for upstream Go's native FIPS 140-3 module, which is selected through
GOFIPS140and meant to later replace BoringCrypto (https://go.dev/doc/security/fips140): one more value handled bygo_build, rather than another variable to thread through CI jobs and omnibus.