[Backport 5.3.9104] bazel: transition oci_image to opt/release mode for Rust #62049
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Our rust binaries (e.g. scip-ctags/syntect_server) were being built in some mix of opt & fastbuild mode[1]. Unlike with Go where there is no release/debug mode flag, Rust requires opting into optimized release builds. We can do that automagically when building any oci_image target with the power of ✨ transitions ✨
This has the side-effect of our Go binaries no longer being stripped & containing debug symbols, see bazelbuild/rules_go#3917
Also to note, in Cargo.toml we opt into debug symbols in release mode. Is this preserved by this PR for bazel[2]?
[1]
strings
on the binaries showed the 3rd-party crates havingk8-opt
filepath names e.g.but the final binaries (and the 1st-party crates) themselves were being built in fastbuild mode. See https://github.com/sourcegraph/devx-support/issues/790 for original point of contact
[2] It seems like it may be preserved, but I dont know how reliable this is for Rust binaries
Test plan
Tested for sourcegraph/scip-ctags image: