Skip to content

bazel: migrate cmd/iot-agent and its dependencies#53806

Draft
chouquette wants to merge 30 commits into
mainfrom
chouquette/bazel/go_migration_22
Draft

bazel: migrate cmd/iot-agent and its dependencies#53806
chouquette wants to merge 30 commits into
mainfrom
chouquette/bazel/go_migration_22

Conversation

@chouquette

@chouquette chouquette commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Migrate more packages as part of the migration to Bazel

Packages migrated in this batch:

  • cmd/iot-agent
  • cmd/iot-agent/subcommands
  • cmd/agent/subcommands/check
  • cmd/agent/subcommands/run
  • cmd/agent/windows/service
  • cmd/cluster-agent
  • cmd/cluster-agent/api
  • cmd/cluster-agent/subcommands/check
  • cmd/cluster-agent-cloudfoundry/subcommands/run
  • cmd/serverless-init
  • cmd/serverless-init/mode
  • cmd/process-agent/command
  • cmd/process-agent/subcommands
  • cmd/process-agent/subcommands/check
  • cmd/process-agent/subcommands/config
  • cmd/process-agent/subcommands/coverage
  • cmd/process-agent/subcommands/status
  • cmd/process-agent/subcommands/taggerlist
  • cmd/process-agent/subcommands/version
  • cmd/process-agent/subcommands/workloadlist
  • cmd/system-probe/modules
  • cmd/system-probe/subcommands/ebpf
  • pkg/cli/subcommands/check
  • pkg/cli/subcommands/processchecks
  • pkg/cli/subcommands/autoscalerlist
  • pkg/commonchecks
  • pkg/collector/corechecks/oracle
  • pkg/collector/corechecks/gpu
  • pkg/collector/corechecks/cluster/orchestrator
  • pkg/collector/corechecks/cluster/orchestrator/collectors
  • pkg/collector/corechecks/cluster/orchestrator/discovery
  • pkg/collector/corechecks/cluster/orchestrator/processors
  • pkg/collector/corechecks/cluster/orchestrator/transformers/k8s
  • pkg/collector/corechecks/cluster/ksm
  • pkg/collector/corechecks/orchestrator/ecs
  • pkg/collector/corechecks/orchestrator/pod
  • pkg/collector/corechecks/containers/kubelet
  • pkg/collector/corechecks/containers/kubelet/provider/cadvisor
  • pkg/collector/corechecks/containers/kubelet/provider/health
  • pkg/collector/corechecks/containers/kubelet/provider/kubelet
  • pkg/collector/corechecks/containers/kubelet/provider/node
  • pkg/collector/corechecks/containers/kubelet/provider/pod
  • pkg/collector/corechecks/containers/kubelet/provider/probe
  • pkg/collector/corechecks/containers/kubelet/provider/prometheus
  • pkg/collector/corechecks/containers/kubelet/provider/slis
  • pkg/collector/corechecks/containers/kubelet/provider/summary
  • pkg/collector/corechecks/network-devices/versa
  • pkg/process/runner
  • pkg/clusteragent/admission
  • pkg/clusteragent/autoscaling/externalmetrics
  • comp/process
  • comp/process/agent/fx
  • comp/process/agent/impl
  • comp/process/runner/fx
  • comp/process/runner/impl
  • comp/process/submitter/def
  • comp/process/submitter/fx
  • comp/process/submitter/impl
  • comp/process/submitter/mock
  • comp/collector/collector/fx
  • comp/core/gui/impl
  • comp/core/gui/fx
  • comp/anomalydetection/logssource/fx
  • comp/metadata

Motivation

Part of the ongoing effort to migrate the agent's Go build to Bazel.

Describe how you validated your changes

  • bazelisk run //:gazelle
  • bazelisk test --config=cache //...

Additional Notes

Also patches the com_github_godror_godror go_repository to expose its
vendored ODPI-C sources via cdeps so that it can build in bazel's sandbox

JSGette and others added 30 commits July 17, 2026 16:45
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.
…/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.
@github-actions

Copy link
Copy Markdown
Contributor

@codex review

@dd-octo-sts dd-octo-sts Bot added internal Identify a non-fork PR team/agent-build labels Jul 17, 2026
@github-actions github-actions Bot added the long review PR is complex, plan time to review it label Jul 17, 2026
@chouquette chouquette added changelog/no-changelog No changelog entry needed qa/no-code-change No code change in Agent code requiring validation labels Jul 17, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread deps/go.MODULE.bazel
Comment on lines +595 to +599
go_deps.module_override(
patch_strip = 1,
patches = [
"//bazel/rules/go_godror:odpi-build-file.patch",
"//bazel/rules/go_godror:cdeps-attr.patch",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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"],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@datadog-datadog-us1-prod

datadog-datadog-us1-prod Bot commented Jul 17, 2026

Copy link
Copy Markdown

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 52.01% (+0.13%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 6906962 | Docs | Datadog PR Page | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Files inventory check summary

File checks results against ancestor 3e31e7b3:

Results for datadog-agent_7.83.0~devel.git.215.6906962.pipeline.125406505-1_amd64.deb:

No change detected

@dd-octo-sts

dd-octo-sts Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Static quality checks

✅ Please find below the results from static quality gates
Comparison made with ancestor 3e31e7b
📊 Static Quality Gates Dashboard
🔗 SQG Job

33 successful checks with minimal change (< 2 KiB)
Quality gate Current Size
agent_deb_amd64 750.056 MiB
agent_deb_amd64_fips 704.965 MiB
agent_heroku_amd64 307.921 MiB
agent_msi 643.924 MiB
agent_rpm_amd64 750.040 MiB
agent_rpm_amd64_fips 704.949 MiB
agent_rpm_arm64 726.648 MiB
agent_rpm_arm64_fips 685.238 MiB
agent_suse_amd64 750.040 MiB
agent_suse_amd64_fips 704.949 MiB
agent_suse_arm64 726.648 MiB
agent_suse_arm64_fips 685.238 MiB
docker_agent_amd64 808.759 MiB
docker_agent_arm64 810.375 MiB
docker_agent_jmx_amd64 999.656 MiB
docker_agent_jmx_arm64 989.925 MiB
docker_cluster_agent_amd64 209.791 MiB
docker_cluster_agent_arm64 222.889 MiB
docker_cws_instrumentation_amd64 7.447 MiB
docker_cws_instrumentation_arm64 6.877 MiB
docker_dogstatsd_amd64 39.223 MiB
docker_dogstatsd_arm64 37.367 MiB
docker_host_profiler_amd64 303.101 MiB
docker_host_profiler_arm64 314.592 MiB
dogstatsd_deb_amd64 29.960 MiB
dogstatsd_deb_arm64 28.003 MiB
dogstatsd_rpm_amd64 29.960 MiB
dogstatsd_suse_amd64 29.960 MiB
iot_agent_deb_amd64 46.109 MiB
iot_agent_deb_arm64 42.805 MiB
iot_agent_deb_armhf 43.573 MiB
iot_agent_rpm_amd64 46.110 MiB
iot_agent_suse_amd64 46.109 MiB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/no-changelog No changelog entry needed component/system-probe internal Identify a non-fork PR long review PR is complex, plan time to review it qa/no-code-change No code change in Agent code requiring validation team/agent-build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants