Skip to content

Commit 709289a

Browse files
authored
Inline dd-procmgrd Bazel build into omnibus packaging (#46834)
### What does this PR do? Remove the dedicated `binary_build` stage jobs (`build_dd-procmgrd-{x64,arm64}`) that built the `dd-procmgrd` Rust binary, archived it as a GitLab artifact, and passed it to the packaging stage via `--dd-procmgrd-bin=...` (`DD_PROCMGRD_BIN=...` from omnibus perspective). Instead, the build is triggered directly from within the omnibus software definition via `bazel run //pkg/procmgr/rust:install` when `--with-dd-procmgrd` is passed (`WITH_DD_PROCMGRD=true` from omnibus perspective). ### Motivation Bazel in CI operates with two caching layers: a minimal GitLab cache for bootstrapping pre-fetched external repositories (read-only in PR branches, read/write on `main`), and an always-on remote cache, so any target built with identical inputs is fetched rather than rebuilt. An orthogonal GitLab artifact carrying the same binary is therefore redundant: it imposes a fixed pack/upload/download/unpack overhead on every run, including those that would otherwise be remote cache hits, and introduces an inter-stage dependency that serializes the pipeline. Running the build at the point of consumption lets Bazel's DAG do the right thing: unchanged sources yield a near-instant cache hit; if sources differ, the cost is paid once and cached for all subsequent runs. ### Describe how you validated your changes CI. Co-authored-by: regis.desgroppes <regis.desgroppes@datadoghq.com>
1 parent b49aab4 commit 709289a

File tree

6 files changed

+15
-49
lines changed

6 files changed

+15
-49
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@
128128
/.gitlab/build/binary_build/fakeintake.yml @DataDog/agent-devx
129129
/.gitlab/build/binary_build/host_profiler.yml @DataDog/opentelemetry-agent @DataDog/profiling-full-host @DataDog/agent-build
130130
/.gitlab/build/binary_build/system_probe.yml @DataDog/ebpf-platform @DataDog/agent-build
131-
/.gitlab/build/binary_build/dd_procmgrd.yml @DataDog/agent-runtimes @DataDog/agent-build
132131
/.gitlab/build/binary_build/windows.yml @DataDog/agent-build @DataDog/windows-products
133132

134133
/.gitlab/build/source_test/codeql_scan.yml @DataDog/sdlc-security

.gitlab/JOBOWNERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ golang_deps_commenter @DataDog/agent-runtimes
3737
# Binary build
3838
build_system-probe* @DataDog/ebpf-platform
3939
build_sd-agent* @DataDog/agent-discovery
40-
build_dd-procmgrd* @DataDog/agent-runtimes
4140
cluster_agent_cloudfoundry-build* @Datadog/agent-integrations
4241
cluster_agent-build* @DataDog/container-integrations
4342
cluster_agent_fips-build* @DataDog/container-integrations

.gitlab/build/binary_build/dd_procmgrd.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.gitlab/build/package_build/linux.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,14 @@
1616
- mkdir -p /tmp/sd-agent
1717
- cp $CI_PROJECT_DIR/sd-agent-build-outputs/sd-agent /tmp/sd-agent/sd-agent
1818
- chmod 0755 /tmp/sd-agent/sd-agent
19-
# Extract dd-procmgrd pre-built binary
20-
- tar -xf $CI_PROJECT_DIR/dd-procmgrd-build-outputs.tar.xz
21-
- mkdir -p /tmp/dd-procmgrd
22-
- cp $CI_PROJECT_DIR/dd-procmgrd-build-outputs/dd-procmgrd /tmp/dd-procmgrd/dd-procmgrd
23-
- chmod 0755 /tmp/dd-procmgrd/dd-procmgrd
24-
- dda inv -- -e omnibus.build --base-dir $OMNIBUS_BASE_DIR --skip-deps --go-mod-cache="$GOPATH/pkg/mod" --system-probe-bin=/tmp/system-probe --sd-agent-bin=/tmp/sd-agent/sd-agent --dd-procmgrd-bin=/tmp/dd-procmgrd/dd-procmgrd --flavor "$FLAVOR" --config-directory "$CONFIG_DIR" --install-directory "$INSTALL_DIR"
19+
- dda inv -- -e omnibus.build --base-dir $OMNIBUS_BASE_DIR --skip-deps --go-mod-cache="$GOPATH/pkg/mod" --system-probe-bin=/tmp/system-probe --sd-agent-bin=/tmp/sd-agent/sd-agent --with-dd-procmgrd --flavor "$FLAVOR" --config-directory "$CONFIG_DIR" --install-directory "$INSTALL_DIR"
2520
- ls -la $OMNIBUS_PACKAGE_DIR
2621
- !reference [.upload_sbom_artifacts]
2722

2823
.agent_build_common:
29-
extends: .bazel:defs:cache:omnibus-transition
24+
extends:
25+
- .bazel:defs:cache:omnibus-transition
26+
- .rust_internal_registry # TODO(agent-build): bazelify
3027
rules:
3128
- !reference [.except_mergequeue]
3229
- when: on_success
@@ -45,7 +42,7 @@
4542
.agent_build_x86:
4643
image: registry.ddbuild.io/ci/datadog-agent-buildimages/linux$CI_IMAGE_LINUX_SUFFIX:$CI_IMAGE_LINUX
4744
tags: ["arch:amd64", "specific:true"]
48-
needs: ["build_system-probe-x64", "build_sd-agent-x64", "build_dd-procmgrd-x64", "go_deps", "generate_minimized_btfs_x64"]
45+
needs: ["build_system-probe-x64", "build_sd-agent-x64", "go_deps", "generate_minimized_btfs_x64"]
4946
variables:
5047
PACKAGE_ARCH: amd64
5148
DD_CC: "x86_64-unknown-linux-gnu-gcc"
@@ -56,7 +53,7 @@
5653
image: registry.ddbuild.io/ci/datadog-agent-buildimages/linux$CI_IMAGE_LINUX_SUFFIX:$CI_IMAGE_LINUX
5754
tags: ["arch:arm64", "specific:true"]
5855
needs:
59-
["build_system-probe-arm64", "build_sd-agent-arm64", "build_dd-procmgrd-arm64", "go_deps", "generate_minimized_btfs_arm64"]
56+
["build_system-probe-arm64", "build_sd-agent-arm64", "go_deps", "generate_minimized_btfs_arm64"]
6057
variables:
6158
PACKAGE_ARCH: arm64
6259
DD_CC: "aarch64-unknown-linux-gnu-gcc"

omnibus/config/software/datadog-agent.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@
219219
end
220220

221221
# dd-procmgrd (process manager daemon)
222-
if ENV['DD_PROCMGRD_BIN'] && linux_target?
223-
copy ENV['DD_PROCMGRD_BIN'], "#{install_dir}/embedded/bin/dd-procmgrd"
222+
if ENV['WITH_DD_PROCMGRD'] == 'true'
223+
command_on_repo_root "bazel run --config=dd-procmgrd-release //pkg/procmgr/rust:install -- --destdir=#{install_dir}/embedded/bin", :env => env, :live_stream => Omnibus.logger.live_stream(:info)
224224
end
225225

226226
# Security agent

tasks/omnibus.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def get_omnibus_env(
8686
hardened_runtime=False,
8787
system_probe_bin=None,
8888
sd_agent_bin=None,
89-
dd_procmgrd_bin=None,
89+
with_dd_procmgrd=False,
9090
go_mod_cache=None,
9191
flavor=AgentFlavor.base,
9292
pip_config_file="pip.conf",
@@ -141,8 +141,8 @@ def get_omnibus_env(
141141
env['SYSTEM_PROBE_BIN'] = system_probe_bin
142142
if sd_agent_bin:
143143
env['SD_AGENT_BIN'] = sd_agent_bin
144-
if dd_procmgrd_bin:
145-
env['DD_PROCMGRD_BIN'] = dd_procmgrd_bin
144+
if with_dd_procmgrd:
145+
env['WITH_DD_PROCMGRD'] = 'true'
146146
env['AGENT_FLAVOR'] = flavor.name
147147

148148
if custom_config_dir:
@@ -208,7 +208,7 @@ def build(
208208
hardened_runtime=False,
209209
system_probe_bin=None,
210210
sd_agent_bin=None,
211-
dd_procmgrd_bin=None,
211+
with_dd_procmgrd=False,
212212
go_mod_cache=None,
213213
python_mirror=None,
214214
pip_config_file="pip.conf",
@@ -242,7 +242,7 @@ def build(
242242
hardened_runtime=hardened_runtime,
243243
system_probe_bin=system_probe_bin,
244244
sd_agent_bin=sd_agent_bin,
245-
dd_procmgrd_bin=dd_procmgrd_bin,
245+
with_dd_procmgrd=with_dd_procmgrd,
246246
go_mod_cache=go_mod_cache,
247247
flavor=flavor,
248248
pip_config_file=pip_config_file,
@@ -387,7 +387,7 @@ def manifest(
387387
hardened_runtime=False,
388388
system_probe_bin=None,
389389
sd_agent_bin=None,
390-
dd_procmgrd_bin=None,
390+
with_dd_procmgrd=False,
391391
go_mod_cache=None,
392392
):
393393
flavor = AgentFlavor[flavor]
@@ -400,7 +400,7 @@ def manifest(
400400
hardened_runtime=hardened_runtime,
401401
system_probe_bin=system_probe_bin,
402402
sd_agent_bin=sd_agent_bin,
403-
dd_procmgrd_bin=dd_procmgrd_bin,
403+
with_dd_procmgrd=with_dd_procmgrd,
404404
go_mod_cache=go_mod_cache,
405405
flavor=flavor,
406406
)

0 commit comments

Comments
 (0)