Skip to content

Commit 8d4ab40

Browse files
committed
Merge remote-tracking branch 'origin/main' into frank.spano-kube-actions-par
# Conflicts: # cmd/cluster-agent/subcommands/start/command.go # comp/privateactionrunner/impl/BUILD.bazel # comp/privateactionrunner/impl/privateactionrunner.go # pkg/privateactionrunner/bundles/BUILD.bazel # pkg/privateactionrunner/bundles/registry.go # pkg/privateactionrunner/bundles/registry_kubeapiserver.go # pkg/privateactionrunner/runners/BUILD.bazel # pkg/privateactionrunner/runners/workflow_runner.go # pkg/privateactionrunner/runners/workflow_task_executor.go
2 parents 0c1eb75 + 0ae6987 commit 8d4ab40

180 files changed

Lines changed: 14782 additions & 434 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@
384384
/comp/forwarder @DataDog/agent-metric-pipelines
385385
/comp/healthplatform @DataDog/fleet-remediation
386386
/comp/host-profiler @DataDog/opentelemetry-agent @DataDog/profiling-full-host
387+
/comp/kubeactions @DataDog/container-integrations
387388
/comp/logs @DataDog/agent-log-pipelines
388389
/comp/logs-library @DataDog/agent-log-pipelines
389390
/comp/metadata @DataDog/fleet-automation
@@ -523,6 +524,7 @@
523524
/pkg/jmxfetch/ @DataDog/agent-metric-pipelines
524525
/pkg/metrics/ @DataDog/agent-metric-pipelines
525526
/pkg/metrics/metricsource.go @DataDog/agent-metric-pipelines @DataDog/agent-integrations
527+
/pkg/notableevents/ @DataDog/windows-products
526528
/pkg/serializer/ @DataDog/agent-metric-pipelines
527529
/pkg/serializer/internal/metrics/origin_mapping.go @DataDog/agent-metric-pipelines @DataDog/agent-integrations
528530
/pkg/serverless/ @DataDog/serverless-azure-gcp

.gitlab/test/e2e/e2e.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,7 @@ new-e2e-agent-telemetry:
464464
- agent_deb-x64-a7
465465
- agent_deb-x64-a7-fips
466466
- qa_agent_linux
467+
- qa_agent_full
467468
- qa_dca
468469
rules:
469470
- !reference [.on_agenttelemetry_or_e2e_changes]

.gitlab/test/functional_test/regression_detector.yml

Lines changed: 110 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ single_machine_performance-regression_detector-merge_base_check:
4343
echo "Merge base is ${SMP_MERGE_BASE}"
4444
BASELINE_SHA="${SMP_MERGE_BASE}"
4545
fi
46-
- BASELINE_COMMIT_TIME=$(git -c log.showSignature=false show --no-patch --format=%ct ${BASELINE_SHA})
4746
# Setup AWS credentials for single-machine-performance AWS account to check ECR images
4847
- AWS_NAMED_PROFILE="single-machine-performance"
4948
- SMP_ACCOUNT_ID=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SMP_ACCOUNT account_id) || exit $?
@@ -78,7 +77,116 @@ single_machine_performance-regression_detector-merge_base_check:
7877
BASELINE_COMMIT_TIME=$(git -c log.showSignature=false show --no-patch --format=%ct ${BASELINE_SHA})
7978
if [[ ${BASELINE_COMMIT_TIME} -le ${FOUR_DAYS_BEFORE_NOW} ]]
8079
then
81-
echo "ERROR: Merge-base of this branch is too old for SMP. Please update your branch by merging an up-to-date main branch into your branch or by rebasing it on an up-to-date main branch."
80+
echo "ERROR: Baseline commit (${BASELINE_SHA}) for this branch (${CI_COMMIT_BRANCH}) is too old for SMP. Please update your branch by merging or rebasing it onto an up-to-date ${SMP_BASE_BRANCH} branch."
81+
# Updating onto ${SMP_BASE_BRANCH} makes its tip this branch's new
82+
# merge base, so the next pipeline needs a baseline image for that
83+
# tip. A release branch can sit idle long enough for its tip's
84+
# image to age out of ECR, in which case that next pipeline fails
85+
# here too -- costing another image build, which takes 40-60
86+
# minutes once started plus unknown runner queue time. Start the
87+
# build now so it overlaps with the update instead of following it.
88+
#
89+
# Release branches only: a merge base with main has almost always
90+
# been built already by some other recent pipeline, and updating
91+
# onto main costs one pipeline rather than two.
92+
#
93+
# Best-effort -- a failure to trigger is reported but does not
94+
# change this job's outcome, which is a failure either way.
95+
if [[ "$SMP_BASE_BRANCH" =~ ^[0-9]+\.[0-9]+\.x$ ]]
96+
then
97+
SMP_BASE_TIP=$(git rev-parse "origin/${SMP_BASE_BRANCH}")
98+
# Trigger only on a *confirmed* miss. Throttling, expired
99+
# credentials and network errors all leave `describe-images`
100+
# stdout empty too, so the `[[ ! $(...) ]]` test the loop
101+
# above uses cannot tell "no such image" from "could not
102+
# check". Guessing wrong is cheap in that loop -- it steps
103+
# back one commit -- but here it starts an ~860-job pipeline,
104+
# and the two failures correlate: credentials expiring
105+
# mid-loop is itself a way to reach this branch spuriously.
106+
# The distinguishing information is on stderr, so capture
107+
# that and discard stdout. `if VAR=$(...)` is exempt from
108+
# `set -e`.
109+
if SMP_ECR_ERROR=$(aws ecr describe-images --region us-west-2 --profile single-machine-performance --registry-id "${SMP_ACCOUNT_ID}" --repository-name "${SMP_AGENT_TEAM_ID}-agent" --image-ids imageTag="${SMP_BASE_TIP}-7-full-amd64" 2>&1 >/dev/null)
110+
then
111+
echo "A baseline image already exists for the ${SMP_BASE_BRANCH} tip (${SMP_BASE_TIP})"
112+
elif [[ "${SMP_ECR_ERROR}" != *ImageNotFoundException* ]]
113+
then
114+
echo "WARNING: could not determine whether a baseline image exists for the ${SMP_BASE_BRANCH} tip (${SMP_BASE_TIP}), so not triggering a rebuild: ${SMP_ECR_ERROR}"
115+
else
116+
echo "No baseline image exists for the ${SMP_BASE_BRANCH} tip (${SMP_BASE_TIP}) - triggering a pipeline to build one now"
117+
# Report the triggered pipeline's URL rather than an
118+
# expected duration, which would go stale as build times
119+
# and runner queue depths change.
120+
#
121+
# `POST /trigger/pipeline`, not `POST /pipeline`: GitLab
122+
# allowlists `CI_JOB_TOKEN` for the former only, and it
123+
# authenticates through a `token` body parameter rather
124+
# than a header. `tasks/pipeline.py` starts child
125+
# pipelines the same way, for the same reason.
126+
#
127+
# This call therefore cannot be reproduced verbatim outside
128+
# a running job, since job tokens exist only inside one. A
129+
# personal token minted with `dda inv auth.gitlab` works
130+
# the other way around: it may use `POST /pipeline`, but is
131+
# not a valid `token` value for the trigger endpoint, which
132+
# accepts only trigger and job tokens. So the equivalent
133+
# local command is the `PRIVATE-TOKEN` one printed below,
134+
# aimed at a different endpoint on purpose.
135+
#
136+
# `CI_API_V4_URL` is https://gitlab.ddbuild.io/api/v4 and
137+
# `CI_PROJECT_ID` is 4670 for this project.
138+
#
139+
# The trailing `|| true` on both lines keeps this
140+
# best-effort. The runner runs this script under
141+
# `set -eo pipefail`, where a bare `VAR=$(failing-cmd)`
142+
# aborts the block -- which would skip the warning and
143+
# self-service output below, the most useful thing this
144+
# branch prints. `--fail` also makes curl exit nonzero on
145+
# an HTTP error while emitting nothing, and `jq` exits
146+
# nonzero on a non-JSON body, so the empty-string check
147+
# below is what actually detects failure.
148+
SMP_REBUILD_PIPELINE=$(curl --silent --show-error --fail --request POST --data "token=${CI_JOB_TOKEN}" --data "ref=${SMP_BASE_BRANCH}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/trigger/pipeline" || true)
149+
SMP_REBUILD_PIPELINE_URL=$(echo "${SMP_REBUILD_PIPELINE}" | jq -r '.web_url // empty' || true)
150+
if [[ -z "${SMP_REBUILD_PIPELINE_URL}" ]]
151+
then
152+
SMP_REBUILD_TRIGGERED="false"
153+
echo "WARNING: could not trigger a pipeline on ${SMP_BASE_BRANCH} - one may need to be started manually"
154+
else
155+
SMP_REBUILD_TRIGGERED="true"
156+
echo "Triggered ${SMP_REBUILD_PIPELINE_URL} on ${SMP_BASE_BRANCH}"
157+
# Name the job that publishes the image rather than
158+
# linking it. Resolving its URL means listing the
159+
# pipeline's jobs, and GitLab allowlists `CI_JOB_TOKEN`
160+
# for only `GET /job` out of the whole Jobs API, so that
161+
# lookup cannot succeed from here whatever it is given.
162+
echo "The baseline image for ${SMP_BASE_TIP} is published by the single_machine_performance-full-amd64-a7 job, listed at ${SMP_REBUILD_PIPELINE_URL}/builds"
163+
fi
164+
echo "NOTE: this job will keep failing until that image is published to SMP's ECR registry, so wait for it before re-running this job."
165+
# Give a self-service path to starting the build. Needed
166+
# when the trigger above failed, and also when a triggered
167+
# pipeline dies for reasons outside this job -- CI runners
168+
# are taken offline for maintenance periodically, which
169+
# kills the pipelines on them.
170+
#
171+
# `dda inv auth.gitlab` prints feature-flag lines to stdout
172+
# before the token, so the `tail -1` is load-bearing: without
173+
# it those lines land in the header value and curl fails with
174+
# "curl: (43) bad argument".
175+
echo "To start that pipeline yourself -- if the trigger above failed, or if the"
176+
echo "pipeline is cancelled, e.g. by CI runner maintenance -- either open"
177+
echo " https://gitlab.ddbuild.io/DataDog/datadog-agent/-/pipelines/new?ref=${SMP_BASE_BRANCH}"
178+
echo "and click the blue \"New pipeline\" button, or run this command from a"
179+
echo "datadog-agent checkout:"
180+
echo " curl --silent --show-error --fail \\"
181+
echo " --request POST \\"
182+
echo " --header \"PRIVATE-TOKEN: \$(dda inv auth.gitlab | tail -1)\" \\"
183+
echo " --data \"ref=${SMP_BASE_BRANCH}\" \\"
184+
echo " \"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipeline\""
185+
# Report the outcome, not the attempt -- tagging "true"
186+
# unconditionally would hide the trigger's failure rate.
187+
datadog-ci tag --level job --tags smp_baseline_rebuild_triggered:"${SMP_REBUILD_TRIGGERED}"
188+
fi
189+
fi
82190
datadog-ci tag --level job --tags smp_merge_base_failure_reason:"branch_too_old"
83191
exit 1
84192
fi

BUILD.bazel

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ exports_files(glob(
4545
exports_files(["go.mod"])
4646

4747
# TODO(ABLD-519): remove below `gazelle:exclude` directives (automatically updates @bazelify_go_work//:go.work)
48-
# gazelle:exclude cmd/cluster-agent/*.go
49-
# gazelle:exclude cmd/cluster-agent/custommetrics
50-
# gazelle:exclude cmd/cluster-agent/subcommands/*.go
51-
# gazelle:exclude cmd/cluster-agent/subcommands/start
52-
# gazelle:exclude cmd/cluster-agent-cloudfoundry/*go
53-
# gazelle:exclude cmd/cluster-agent-cloudfoundry/subcommands/*.go
5448
# gazelle:exclude cmd/serverless-init/*.go
5549
# rc_tester_v1 imports gopkg.in/DataDog/dd-trace-go.v1, which is not part of the
5650
# Bazel go_deps graph (progs is a separate module outside go.work). Keep this

MODULE.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ bazel_dep(name = "rules_multitool", version = "1.11.1")
7676
bazel_dep(name = "rules_pkg", version = "1.2.0")
7777
bazel_dep(name = "rules_python", version = "2.2.0")
7878
bazel_dep(name = "rules_rs", version = "0.0.27")
79-
bazel_dep(name = "rules_rust", version = "0.71.3")
80-
bazel_dep(name = "rules_rust_prost", version = "0.71.3")
79+
bazel_dep(name = "rules_rust", version = "0.73.0")
80+
bazel_dep(name = "rules_rust_prost", version = "0.73.0")
8181
bazel_dep(name = "rules_shell", version = "0.8.0")
8282
bazel_dep(name = "toml.bzl", version = "0.4.1")
8383
bazel_dep(name = "toolchains_llvm", version = "1.8.0")

MODULE.bazel.lock

Lines changed: 9 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/agent/subcommands/run/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ go_library(
77
name = "run",
88
srcs = [
99
"command.go",
10+
"command_darwin.go",
1011
"command_notwin.go",
1112
"command_snmptraps.go",
1213
"command_windows.go",
@@ -218,6 +219,7 @@ go_library(
218219
"//pkg/config/model",
219220
],
220221
"@rules_go//go/platform:darwin": [
222+
"//comp/notableevents/fx",
221223
"//comp/softwareinventory/fx",
222224
"//pkg/config/model",
223225
],
@@ -234,6 +236,7 @@ go_library(
234236
"//pkg/config/model",
235237
],
236238
"@rules_go//go/platform:ios": [
239+
"//comp/notableevents/fx",
237240
"//comp/softwareinventory/fx",
238241
"//pkg/config/model",
239242
],
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed
2+
// under the Apache License Version 2.0.
3+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
// Copyright 2026-present Datadog, Inc.
5+
6+
//go:build darwin
7+
8+
package run
9+
10+
import (
11+
"go.uber.org/fx"
12+
13+
notableeventsfx "github.com/DataDog/datadog-agent/comp/notableevents/fx"
14+
softwareinventoryfx "github.com/DataDog/datadog-agent/comp/softwareinventory/fx"
15+
)
16+
17+
// getPlatformModules returns the Darwin-specific fx modules for the Agent run command.
18+
func getPlatformModules() fx.Option {
19+
return fx.Options(
20+
softwareinventoryfx.Module(),
21+
notableeventsfx.Module(),
22+
)
23+
}

cmd/agent/subcommands/run/command_notwin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// This product includes software developed at Datadog (https://www.datadoghq.com/).
44
// Copyright 2016-present Datadog, Inc.
55

6-
//go:build !windows
6+
//go:build !windows && !darwin
77

88
package run
99

0 commit comments

Comments
 (0)