bazel: migrate cmd/iot-agent and its dependencies#53806
Conversation
Fixes a latent build break where modules_test compiled with a fixed gotags=[test,linux_bpf] instead of the per-flavor tag set, so pkg/gpu's nvml-gated probe.go was silently dropped while eventcollector.go (which uses a symbol it defines) was kept.
It calls rlimit.RemoveMemlock, which needs CAP_SYS_RESOURCE and fails under plain unprivileged bazel test sandboxing. pkg/ebpf:ebpf_test and pkg/ebpf/verifier:verifier_test already use this same tag for the same reason.
…rs/k8s and transformers/k8s
…/ksm, containers/kubelet, network-devices/versa, orchestrator/ecs and orchestrator/pod
Patch the go_repository-generated BUILD to expose the vendored ODPI-C sources (odpi/include, odpi/src, odpi/embed) via a cdeps cc_library. Gazelle never generates a BUILD.bazel for those directories since they have no buildable .go files under the default build tags, so the godror go_library's -Iodpi/... cgo CFLAGS previously found nothing in the sandbox.
Its dependency chain (pkg/logs/launchers, comp/logs-library/pipeline, comp/anomalydetection/logssource/impl) is fully migrated now; the hand-written stub restricting this package to the noop variant was stale.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6906962c45
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| go_deps.module_override( | ||
| patch_strip = 1, | ||
| patches = [ | ||
| "//bazel/rules/go_godror:odpi-build-file.patch", | ||
| "//bazel/rules/go_godror:cdeps-attr.patch", |
There was a problem hiding this comment.
Commit MODULE.bazel.lock with the override
This adds a new go_deps.module_override for github.com/godror/godror, but MODULE.bazel.lock is not updated in the commit. For module-extension invocation changes the lockfile is part of the reproducible Bazel state; a build with lockfile enforcement will need to rewrite the lock before it can accept this override, so please regenerate and commit the lockfile alongside these patches.
Useful? React with 👍 / 👎.
| ], | ||
| embed = [":modules"], | ||
| gotags = ["test"], | ||
| target_compatible_with = ["@platforms//os:linux"], |
There was a problem hiding this comment.
Keep Windows module tests enabled
This target_compatible_with is forwarded to every modules_test_* target created by dd_agent_go_test, so the system-probe module tests are now skipped entirely on Windows. The previous go_test carried Windows deps and traceroute_test.go is explicitly linux || windows, so Windows traceroute/module coverage is lost; split the Linux-only tests out or keep this target compatible with Windows.
Useful? React with 👍 / 👎.
|
🎯 Code Coverage (details) 🔗 Commit SHA: 6906962 | Docs | Datadog PR Page | Give us feedback! |
Files inventory check summaryFile checks results against ancestor 3e31e7b3: Results for datadog-agent_7.83.0~devel.git.215.6906962.pipeline.125406505-1_amd64.deb:No change detected |
Static quality checks✅ Please find below the results from static quality gates 33 successful checks with minimal change (< 2 KiB)
|
What does this PR do?
Migrate more packages as part of the migration to Bazel
Packages migrated in this batch:
cmd/iot-agentcmd/iot-agent/subcommandscmd/agent/subcommands/checkcmd/agent/subcommands/runcmd/agent/windows/servicecmd/cluster-agentcmd/cluster-agent/apicmd/cluster-agent/subcommands/checkcmd/cluster-agent-cloudfoundry/subcommands/runcmd/serverless-initcmd/serverless-init/modecmd/process-agent/commandcmd/process-agent/subcommandscmd/process-agent/subcommands/checkcmd/process-agent/subcommands/configcmd/process-agent/subcommands/coveragecmd/process-agent/subcommands/statuscmd/process-agent/subcommands/taggerlistcmd/process-agent/subcommands/versioncmd/process-agent/subcommands/workloadlistcmd/system-probe/modulescmd/system-probe/subcommands/ebpfpkg/cli/subcommands/checkpkg/cli/subcommands/processcheckspkg/cli/subcommands/autoscalerlistpkg/commoncheckspkg/collector/corechecks/oraclepkg/collector/corechecks/gpupkg/collector/corechecks/cluster/orchestratorpkg/collector/corechecks/cluster/orchestrator/collectorspkg/collector/corechecks/cluster/orchestrator/discoverypkg/collector/corechecks/cluster/orchestrator/processorspkg/collector/corechecks/cluster/orchestrator/transformers/k8spkg/collector/corechecks/cluster/ksmpkg/collector/corechecks/orchestrator/ecspkg/collector/corechecks/orchestrator/podpkg/collector/corechecks/containers/kubeletpkg/collector/corechecks/containers/kubelet/provider/cadvisorpkg/collector/corechecks/containers/kubelet/provider/healthpkg/collector/corechecks/containers/kubelet/provider/kubeletpkg/collector/corechecks/containers/kubelet/provider/nodepkg/collector/corechecks/containers/kubelet/provider/podpkg/collector/corechecks/containers/kubelet/provider/probepkg/collector/corechecks/containers/kubelet/provider/prometheuspkg/collector/corechecks/containers/kubelet/provider/slispkg/collector/corechecks/containers/kubelet/provider/summarypkg/collector/corechecks/network-devices/versapkg/process/runnerpkg/clusteragent/admissionpkg/clusteragent/autoscaling/externalmetricscomp/processcomp/process/agent/fxcomp/process/agent/implcomp/process/runner/fxcomp/process/runner/implcomp/process/submitter/defcomp/process/submitter/fxcomp/process/submitter/implcomp/process/submitter/mockcomp/collector/collector/fxcomp/core/gui/implcomp/core/gui/fxcomp/anomalydetection/logssource/fxcomp/metadataMotivation
Part of the ongoing effort to migrate the agent's Go build to Bazel.
Describe how you validated your changes
bazelisk run //:gazellebazelisk test --config=cache //...Additional Notes
Also patches the
com_github_godror_godrorgo_repository to expose itsvendored ODPI-C sources via
cdepsso that it can build in bazel's sandbox