Skip to content

fips: Make build bazel hermetic#39728

Merged
agrawroh merged 4 commits intoenvoyproxy:mainfrom
phlax:fips-cleanup
Jun 6, 2025
Merged

fips: Make build bazel hermetic#39728
agrawroh merged 4 commits intoenvoyproxy:mainfrom
phlax:fips-cleanup

Conversation

@phlax
Copy link
Member

@phlax phlax commented Jun 3, 2025

No description provided.

@phlax phlax marked this pull request as draft June 3, 2025 14:56
@repokitteh-read-only repokitteh-read-only bot added the deps Approval required for changes to Envoy's external dependencies label Jun 3, 2025
@repokitteh-read-only
Copy link

CC @envoyproxy/dependency-shepherds: Your approval is needed for changes made to (bazel/.*repos.*\.bzl)|(bazel/dependency_imports\.bzl)|(api/bazel/.*\.bzl)|(.*/requirements\.txt)|(.*\.patch).
envoyproxy/dependency-shepherds assignee is @agrawroh

🐱

Caused by: #39728 was opened by phlax.

see: more, trace.

@phlax phlax changed the title [WIP] fips: Make build bazel hermetic fips: Make build bazel hermetic Jun 4, 2025
@phlax phlax marked this pull request as ready for review June 4, 2025 16:31
Signed-off-by: Ryan Northey <ryan@synca.io>
@phlax phlax force-pushed the fips-cleanup branch 3 times, most recently from 89bfc89 to 11e7abc Compare June 4, 2025 17:19
Signed-off-by: Ryan Northey <ryan@synca.io>
Copy link
Member

@ggreenway ggreenway left a comment

Choose a reason for hiding this comment

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

I tried building this locally and got error

ERROR: /build/.cache/bazel/_bazel_envoybuild/b570b5ccd0454dc9af9f65ab1833764d/boringssl_fips/BUILD.bazel:131:8: configurable attribute "exec_properties" in @@boringssl_fips//:build doesn't match this configuration. Would a default condition help?

Conditions checked:
 //bazel:engflow_rbe_x86_64
 //bazel:engflow_rbe_aarch64

To see a condition's definition, run: bazel query --output=build <condition label>.

This instance of @@boringssl_fips//:build has configuration identifier 54cb9a0. To inspect its configuration, run: bazel config 54cb9a0.

command: bazel build --config=clang --test_output=errors --@envoy//source/extensions/wasm_runtime/v8:enabled=false --define boringssl=fips //:envoy

@phlax
Copy link
Member Author

phlax commented Jun 5, 2025

now i see why it was working for me (sometimes) ...

218 build:libc++ --action_env=BAZEL_CXXOPTS=-stdlib=libc++

we add the env iff its a libc++ - so that was never gonna work by itself - adding a flag/setting to control this ...

@phlax
Copy link
Member Author

phlax commented Jun 5, 2025

k, i think the conditionality should be fixed

i tested this with both libc++ and libstc++

bazel test --define=boringssl=fips @envoy//test/server:server_test

assuming our stdlib flags work correctly - which i think they do in this case - then this should work now for both libc++/libstdc++

whats not tested is the arm build - iirc we do have some downstream arm fips builders so it might be worth adding some ci at some point to check it works as expected - altho thinking about it - if you (@ggreenway) are testing this directly with macos/arm then i guess that is at least getting tested locally

@phlax phlax force-pushed the fips-cleanup branch 2 times, most recently from 3b0d02a to c7a1f67 Compare June 5, 2025 08:36
Signed-off-by: Ryan Northey <ryan@synca.io>
Signed-off-by: Ryan Northey <ryan@synca.io>
@agrawroh
Copy link
Member

agrawroh commented Jun 5, 2025

/lgtm deps

@repokitteh-read-only repokitteh-read-only bot removed the deps Approval required for changes to Envoy's external dependencies label Jun 5, 2025
Copy link
Member

@ggreenway ggreenway left a comment

Choose a reason for hiding this comment

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

This is great! Thanks!

@agrawroh agrawroh merged commit ed8b1b2 into envoyproxy:main Jun 6, 2025
25 checks passed
phlax pushed a commit that referenced this pull request Sep 25, 2025
[This PR](#39728) moved the Go
dependency in FIPS builds to a Bazel `http_archive`. Once that was done,
Bazel's `filegroup` doesn't seem to be dealing so well with non-UTF-8
characters present in a file name in Go's test suite, causing the build
to fail.

```
#23 170.8 ERROR: /build/top/BUILD/envoy/build/bazel_root/base/external/boringssl_fips/BUILD.bazel:70:8: Executing genrule @@boringssl_fips//:build failed: error reading file '@@fips_go_linux_amd64//:test/fixedbugs/issue27836.dir/Þmain.go': /build/top/BUILD/envoy/build/bazel_root/base/external/fips_go_linux_amd64/test/fixedbugs/issue27836.dir/Þmain.go (No such file or directory)
#23 170.8 ERROR: /build/top/BUILD/envoy/build/bazel_root/base/external/boringssl_fips/BUILD.bazel:70:8: Executing genrule @@boringssl_fips//:build failed: 1 input file(s) are in error
#23 171.2 Target //distribution/binary:release failed to build
```

It's not fully understood what circumstances cause Bazel to behave like
that, but it seems reasonable to remove the `test` directory from the
exports. Once a bug is filed to the Bazel project I'll update the PR
with the issue number.

Signed-off-by: Gustavo <grnmeira@gmail.com>
grnmeira added a commit to grnmeira/envoy that referenced this pull request Oct 17, 2025
[This PR](envoyproxy#39728) moved the Go
dependency in FIPS builds to a Bazel `http_archive`. Once that was done,
Bazel's `filegroup` doesn't seem to be dealing so well with non-UTF-8
characters present in a file name in Go's test suite, causing the build
to fail.

```
envoyproxy#23 170.8 ERROR: /build/top/BUILD/envoy/build/bazel_root/base/external/boringssl_fips/BUILD.bazel:70:8: Executing genrule @@boringssl_fips//:build failed: error reading file '@@fips_go_linux_amd64//:test/fixedbugs/issue27836.dir/Þmain.go': /build/top/BUILD/envoy/build/bazel_root/base/external/fips_go_linux_amd64/test/fixedbugs/issue27836.dir/Þmain.go (No such file or directory)
envoyproxy#23 170.8 ERROR: /build/top/BUILD/envoy/build/bazel_root/base/external/boringssl_fips/BUILD.bazel:70:8: Executing genrule @@boringssl_fips//:build failed: 1 input file(s) are in error
envoyproxy#23 171.2 Target //distribution/binary:release failed to build
```

It's not fully understood what circumstances cause Bazel to behave like
that, but it seems reasonable to remove the `test` directory from the
exports. Once a bug is filed to the Bazel project I'll update the PR
with the issue number.

Signed-off-by: Gustavo <grnmeira@gmail.com>
phlax pushed a commit that referenced this pull request Oct 17, 2025
[This PR](#39728) moved the Go
dependency in FIPS builds to a Bazel `http_archive`. Once that was done,
Bazel's `filegroup` doesn't seem to be dealing so well with non-UTF-8
characters present in a file name in Go's test suite, causing the build
to fail.

```
#23 170.8 ERROR: /build/top/BUILD/envoy/build/bazel_root/base/external/boringssl_fips/BUILD.bazel:70:8: Executing genrule @@boringssl_fips//:build failed: error reading file '@@fips_go_linux_amd64//:test/fixedbugs/issue27836.dir/Þmain.go': /build/top/BUILD/envoy/build/bazel_root/base/external/fips_go_linux_amd64/test/fixedbugs/issue27836.dir/Þmain.go (No such file or directory)
#23 170.8 ERROR: /build/top/BUILD/envoy/build/bazel_root/base/external/boringssl_fips/BUILD.bazel:70:8: Executing genrule @@boringssl_fips//:build failed: 1 input file(s) are in error
#23 171.2 Target //distribution/binary:release failed to build
```

It's not fully understood what circumstances cause Bazel to behave like
that, but it seems reasonable to remove the `test` directory from the
exports. Once a bug is filed to the Bazel project I'll update the PR
with the issue number.

Signed-off-by: Gustavo <grnmeira@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants