002 build bazel integration #2233
No reviewers
Labels
No labels
1week
2weeks
Failed compliance check
IP cameras
NATS
Possible security concern
Review effort 1/5
Review effort 2/5
Review effort 3/5
Review effort 4/5
Review effort 5/5
UI
aardvark
accessibility
amd64
api
arm64
auth
back-end
bgp
blog
bug
build
checkers
ci-cd
cleanup
cnpg
codex
core
dependencies
device-management
documentation
duplicate
dusk
ebpf
enhancement
eta 1d
eta 1hr
eta 3d
eta 3hr
feature
fieldsurvey
github_actions
go
good first issue
help wanted
invalid
javascript
k8s
log-collector
mapper
mtr
needs-triage
netflow
network-sweep
observability
oracle
otel
plug-in
proton
python
question
reddit
redhat
research
rperf
rperf-checker
rust
sdk
security
serviceradar-agent
serviceradar-agent-gateway
serviceradar-web
serviceradar-web-ng
siem
snmp
sysmon
topology
ubiquiti
wasm
wontfix
zen-engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
carverauto/serviceradar!2233
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refs/pull/2233/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from GitHub pull request.
Original GitHub pull request: #1653
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/1653
Original created: 2025-09-23T16:18:09Z
Original updated: 2025-09-23T16:20:15Z
Original head: carverauto/serviceradar:002-build-bazel-integration
Original base: main
Original merged: 2025-09-23T16:18:19Z by @mfreeman451
PR Type
Enhancement
Description
Integrate Bazel build system with comprehensive CI/CD setup
Fix OCaml toolchain and opam sandboxing issues
Add BuildBuddy remote execution and caching configuration
Improve test infrastructure with better privilege handling
Diagram Walkthrough
File Walkthrough
3 files
Add comprehensive CI workflow with BazelImprove sandbox fallback handlingAdd parameter substitution helper function1 files
Remove old bootstrap workflow2 files
Configure remote execution and compiler flagsSkip Bazelisk wrapper for direct execution1 files
Update dependencies and add Java patches5 files
Fix OCaml toolchain with sandboxing and compiler flagsDisable opam sandboxing for CI compatibilityAdd override repository and sandboxing fixesFix OpenBSD JNI header compatibilityFix buffer overflow in C code5 files
Improve test privilege checking and mock setupAdd better permission error handlingFix test mocking and privilege checksAdd Bazel runfiles path resolutionTag OCaml tests for filtering13 files
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1653#issuecomment-3324711282
Original created: 2025-09-23T16:18:56Z
PR Reviewer Guide 🔍
Here are some key observations to aid the review process:
Sensitive information exposure:
Ensure the BuildBuddy API key is only used via GitHub Secrets and not leaked in logs. The workflow writes the API key into .bazelrc.remote; verify that CI logs do not echo the header line. Also, sandbox fallback in sandbox.sh executes commands without isolation when bwrap is unavailable; while necessary for CI, confirm that this behavior is restricted to trusted environments and cannot be triggered in untrusted builds.
Flaky Test Risk
The new permissionError-based skipping logic may still pass through non-permission errors to require.NoError, potentially causing intermittent failures on environments with partial raw socket support. Consider tightening the skip conditions or adding more explicit capability checks.
Platform Toolchain Selection
The selection of --extra_toolchains based on mctx.os.name/arch may not cover all Linux arches and relies on local_config_cc; ensure these labels exist across CI runners and that BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN interactions won’t cause inconsistent toolchain resolution.
Missing Secret Handling
Remote cache setup writes .bazelrc.remote only if BUILDBUDDY_ORG_API_KEY is set, but build/test always pass --config=ci which uses --config=remote; ensure CI doesn’t hang or error when remote is configured without credentials and that fallbacks are in place.
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1653#issuecomment-3324715897
Original created: 2025-09-23T16:20:15Z
PR Code Suggestions ✨
Explore these optional code suggestions:
OCaml tests are disabled in CI
The new CI workflow in the PR disables all OCaml tests by filtering them out
with a tag. Instead of skipping them, the underlying toolchain issues causing
this should be fixed to ensure proper test coverage.
Examples:
.github/workflows/main.yml [40-43]
ocaml/srql/BUILD.bazel [208]
Solution Walkthrough:
Before:
After:
Suggestion importance[1-10]: 9
__
Why: The suggestion correctly identifies that the new CI setup explicitly disables all OCaml tests, which is a significant regression in test coverage that should be addressed rather than bypassed.
Fix sandbox fallback logic
Improve the sandbox script's fallback logic by executing the command without the
sandbox if
mktempfails, preventing build failures in constrained environments.third_party/vendor/tools_opam/extensions/obazl.opamrc [271]
[To ensure code accuracy, apply this suggestion manually]Suggestion importance[1-10]: 7
__
Why: The suggestion correctly identifies a flaw in the fallback logic for when
mktempfails and proposes a more robust alternative that improves the script's resilience in constrained environments.