Skip to content

Commit e15242f

Browse files
committed
Merge branch 'main' into rayz/trigger-otlp-ingest-metrics-experiment
2 parents 4eae01b + 1520fa1 commit e15242f

758 files changed

Lines changed: 21641 additions & 12988 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/workflows/test-devcontainer-update.yml

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

.github/workflows/test-devcontainer.yml

Lines changed: 91 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,74 @@
11
name: test devcontainer
22

33
on:
4-
workflow_call:
5-
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
67
pull_request:
78
branches:
89
- main
9-
paths:
10-
- .github/workflows/test-devcontainer.yml
10+
workflow_dispatch:
1111

12-
permissions: {}
12+
permissions:
13+
contents: read
1314

1415
jobs:
16+
detect-changes:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
changes: "${{ steps.images.outcome == 'success' || steps.files.outcome == 'success' }}"
20+
21+
steps:
22+
- name: Fetch changed files (PR)
23+
if: github.event_name == 'pull_request'
24+
env:
25+
GH_TOKEN: "${{ github.token }}"
26+
run: |
27+
gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files --paginate \
28+
| jq -s 'add' > pr-files.json
29+
30+
- name: Fetch changed files (push)
31+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
32+
if: github.event_name == 'push'
33+
with:
34+
persist-credentials: false
35+
fetch-depth: 2
36+
37+
- name: Build changed files list
38+
run: |
39+
if [ "${{ github.event_name }}" = "pull_request" ]; then
40+
jq -r '.[].filename' pr-files.json | sort -u > changed-files.txt
41+
jq -r '.[] | select(.filename==".gitlab-ci.yml") | .patch // empty' pr-files.json > gitlab-ci.patch
42+
else
43+
git diff --name-only HEAD~1 HEAD | sort -u > changed-files.txt
44+
git diff HEAD~1 HEAD -- .gitlab-ci.yml > gitlab-ci.patch || true
45+
fi
46+
47+
- name: Detect CI image changes
48+
id: images
49+
run: |
50+
if grep -E '^[-+] +CI_IMAGE_[^:]+: v' gitlab-ci.patch >/dev/null; then
51+
echo "changed=true" >> "$GITHUB_OUTPUT"
52+
else
53+
echo "changed=false" >> "$GITHUB_OUTPUT"
54+
fi
55+
56+
- name: Detect files of interest changes
57+
id: files
58+
run: |
59+
cat > files-of-interest.txt <<'EOF'
60+
.github/workflows/test-devcontainer.yml
61+
EOF
62+
63+
if grep -Fx -f files-of-interest.txt changed-files.txt >/dev/null; then
64+
echo "changed=true" >> "$GITHUB_OUTPUT"
65+
else
66+
echo "changed=false" >> "$GITHUB_OUTPUT"
67+
fi
68+
1569
test:
70+
needs: detect-changes
71+
if: ${{ needs.detect-changes.outputs.changes == 'true' }}
1672
runs-on: ${{ matrix.os }}
1773
strategy:
1874
fail-fast: false
@@ -23,7 +79,8 @@ jobs:
2379
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2480
with:
2581
persist-credentials: false
26-
fetch-depth: 0
82+
fetch-depth: 1000
83+
fetch-tags: true
2784

2885
- name: Setup Node.js
2986
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
@@ -33,6 +90,23 @@ jobs:
3390
with:
3491
features: legacy-tasks
3592

93+
- name: Free disk space
94+
run: |
95+
df -h
96+
echo "::group::Android"
97+
sudo rm -rf /usr/local/lib/android
98+
echo "::endgroup::"
99+
echo "::group::.NET"
100+
sudo rm -rf /usr/share/dotnet
101+
echo "::endgroup::"
102+
echo "::group::Haskell"
103+
sudo rm -rf /opt/ghc
104+
echo "::endgroup::"
105+
echo "::group::CodeQL"
106+
sudo rm -rf /opt/hostedtoolcache/CodeQL
107+
echo "::endgroup::"
108+
df -h
109+
36110
- name: Build image
37111
run: |
38112
git clone https://github.com/DataDog/datadog-agent-buildimages.git
@@ -52,5 +126,16 @@ jobs:
52126
- name: Start Dev Container
53127
run: devcontainer up --workspace-folder .
54128

129+
- name: Grant the datadog user access to host Docker socket
130+
run: |
131+
docker exec -u root datadog_agent_devcontainer sh -lc '
132+
set -e
133+
sock=/var/run/docker.sock
134+
gid=$(stat -c %g "$sock")
135+
getent group "$gid" >/dev/null || groupadd -g "$gid" dockersock
136+
gname=$(getent group "$gid" | cut -d: -f1)
137+
id -nG datadog | tr " " "\n" | grep -qx "$gname" || usermod -aG "$gname" datadog
138+
'
139+
55140
- name: Test Agent build
56141
run: devcontainer exec --workspace-folder . dda inv agent.hacky-dev-image-build --target-image=agent

.gitlab-ci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,21 +164,21 @@ variables:
164164
# Build images versions
165165
# To use images from datadog-agent-buildimages dev branches, set the corresponding
166166
# SUFFIX variable to
167-
CI_IMAGE_BTF_GEN: v79330459-0f2eff53
167+
CI_IMAGE_BTF_GEN: v79781370-ed414087
168168
CI_IMAGE_BTF_GEN_SUFFIX: ""
169-
CI_IMAGE_DOCKER_X64: v79330459-0f2eff53
169+
CI_IMAGE_DOCKER_X64: v79781370-ed414087
170170
CI_IMAGE_DOCKER_X64_SUFFIX: ""
171-
CI_IMAGE_DOCKER_ARM64: v79330459-0f2eff53
171+
CI_IMAGE_DOCKER_ARM64: v79781370-ed414087
172172
CI_IMAGE_DOCKER_ARM64_SUFFIX: ""
173-
CI_IMAGE_GITLAB_AGENT_DEPLOY: v79330459-0f2eff53
173+
CI_IMAGE_GITLAB_AGENT_DEPLOY: v79781370-ed414087
174174
CI_IMAGE_GITLAB_AGENT_DEPLOY_SUFFIX: ""
175-
CI_IMAGE_LINUX: v79330459-0f2eff53
175+
CI_IMAGE_LINUX: v79781370-ed414087
176176
CI_IMAGE_LINUX_SUFFIX: ""
177-
CI_IMAGE_RPM_X64: v79330459-0f2eff53
177+
CI_IMAGE_RPM_X64: v79781370-ed414087
178178
CI_IMAGE_RPM_X64_SUFFIX: ""
179-
CI_IMAGE_RPM_ARM64: v79330459-0f2eff53
179+
CI_IMAGE_RPM_ARM64: v79781370-ed414087
180180
CI_IMAGE_RPM_ARM64_SUFFIX: ""
181-
CI_IMAGE_RPM_ARMHF: v79330459-0f2eff53
181+
CI_IMAGE_RPM_ARMHF: v79781370-ed414087
182182
CI_IMAGE_RPM_ARMHF_SUFFIX: ""
183183
CI_IMAGE_WIN_LTSC2022_X64: v79330459-0f2eff53
184184
CI_IMAGE_WIN_LTSC2022_X64_SUFFIX: ""
@@ -1115,7 +1115,7 @@ workflow:
11151115
- !reference [.except_mergequeue]
11161116
- changes:
11171117
paths:
1118-
- pkg/fleet/installer/packages/embedded/templates/**/*.service
1118+
- pkg/fleet/installer/packages/embedded/tmpl/**/*.service
11191119
compare_to: $COMPARE_TO_BRANCH
11201120
- when: manual
11211121
allow_failure: true

.gitlab/bazel/build-deps.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ bazel:build-deps:windows-amd64:
4646
variables:
4747
ARCH: x64
4848
SCRIPT: |-
49-
echo "🟡 TODO(regis): compilation errors remain - limiting to a working subset for the time being"
50-
bazel build '@zlib//...' '@libffi//:ffi'
49+
[Console]::WriteLine("🟡 TODO(regis): compilation errors remain - limiting to a working subset for the time being")
50+
bazel build '@zlib//...' '@libffi//:ffi' '@xz//...'
5151
# bazel build @bzip2//...

.gitlab/bazel/defs.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
.bazel:ext:windows:
2727
extends: .windows_docker_default
2828
timeout: 60m # pulling images alone can take more than 30m
29-
allow_failure: true
30-
retry: 0
3129
variables:
3230
GIT_DEPTH: 2
3331
script:
@@ -53,4 +51,4 @@
5351
--volume="${RUNNER_TEMP_PROJECT_DIR}:$RUNNER_TEMP_PROJECT_DIR"
5452
--workdir="$CI_PROJECT_DIR"
5553
"$WINBUILDIMAGE"
56-
powershell -NonInteractive -NoLogo -NoProfile -OutputFormat Text -EncodedCommand $EncodedCommand
54+
powershell -NonInteractive -NoLogo -NoProfile -InputFormat Text -OutputFormat Text -EncodedCommand $EncodedCommand

.gitlab/benchmarks/benchmarks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ benchmark:
33
# This base image is created here: https://gitlab.ddbuild.io/DataDog/apm-reliability/benchmarking-platform
44
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/benchmarking-platform:trace-agent_microbenchmarks
55
timeout: 1h
6-
rules:
7-
!reference [.on_trace_agent_changes_or_manual]
6+
rules: !reference [.on_trace_agent_changes_or_manual]
87
interruptible: true
98
needs: ["setup_agent_version"]
109
tags: ["team:apm-k8s-tweaked-metal-datadog-agent", "specific:true"]
1110
script:
1211
- export ARTIFACTS_DIR="$(pwd)/artifacts" && mkdir -p $ARTIFACTS_DIR
1312
- export BUILDIMAGES_COMMIT="${CI_IMAGE_LINUX#*-}"
13+
- export BASE_BRANCH="$(cat release.json | jq ".base_branch" | tr -d '"')"
1414
- export DDA_VERSION="$(curl -s https://raw.githubusercontent.com/DataDog/datadog-agent-buildimages/${BUILDIMAGES_COMMIT}/dda.env | awk -F= '/^DDA_VERSION=/ {print $2}')"
1515
- pip install "git+https://github.com/DataDog/datadog-agent-dev.git@${DDA_VERSION}"
1616
- dda self dep sync -f legacy-tasks

.gitlab/container_build/common.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
.static_quality_gate_docker: |
3+
# Measure Docker image size and generate in-place report
4+
# This runs after the main script and won't fail the job if there are issues.
5+
# This is common for all Docker image builds
6+
7+
if [[ -n "$STATIC_QUALITY_GATE_NAME" ]]; then
8+
echo "📊 Starting Docker image measurement..."
9+
10+
# Construct the built image reference from build variables
11+
# This follows the same pattern used in docker build jobs
12+
ECR_RELEASE_SUFFIX=${ECR_RELEASE_SUFFIX:-}
13+
TAG_SUFFIX=${TAG_SUFFIX:-}
14+
IMAGE_REF="${IMAGE}${ECR_RELEASE_SUFFIX}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}${TAG_SUFFIX}-$ARCH"
15+
16+
echo "🔍 Measuring Docker image: $IMAGE_REF"
17+
18+
# Extract report prefix from gate name (e.g. static_quality_gate_docker_agent_amd64 -> docker_agent_amd64)
19+
REPORT_PREFIX="${STATIC_QUALITY_GATE_NAME#static_quality_gate_}"
20+
21+
# Generate measurement report using STATIC_QUALITY_GATE_NAME variable
22+
dda inv quality-gates.measure-image-local \
23+
--image-ref "$IMAGE_REF" \
24+
--gate-name "$STATIC_QUALITY_GATE_NAME" \
25+
--build-job-name "$CI_JOB_NAME" \
26+
--output-path "${REPORT_PREFIX}_size_report_${CI_PIPELINE_ID}_${CI_COMMIT_SHA:0:8}.yml" \
27+
--debug || { echo "⚠️ Docker image measurement failed for $IMAGE_REF"; exit 0; }
28+
29+
echo "✅ Docker image measurement completed"
30+
31+
# Upload the report to S3 (same bucket structure as packages)
32+
BUCKET_BASE_PATH="s3://dd-ci-artefacts-build-stable/datadog-agent/static_quality_gates/GATE_REPORTS/${CI_COMMIT_SHA}"
33+
echo "Uploading report to ${BUCKET_BASE_PATH}"
34+
aws s3 cp --only-show-errors --region us-east-1 --sse AES256 \
35+
"${REPORT_PREFIX}_size_report_${CI_PIPELINE_ID}_${CI_COMMIT_SHA:0:8}.yml" \
36+
"${BUCKET_BASE_PATH}/${REPORT_PREFIX}_size_report_${CI_PIPELINE_ID}_${CI_COMMIT_SHA:0:8}.yml"
37+
else
38+
echo "ℹ️ Skipping Docker image measurement (no STATIC_QUALITY_GATE_NAME defined)"
39+
fi
40+
41+
.static_quality_gate_report_path: "**/*_size_report_*.yml"

.gitlab/container_build/docker_linux.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
if [[ "$FLATTEN_IMAGE" == "true" ]]; then
8989
crane flatten -t ${TARGET_TAG} ${TARGET_TAG}
9090
fi
91+
- !reference [.static_quality_gate_docker]
9192
# Workaround for temporary network failures
9293
retry: 2
9394
timeout: 30m
@@ -140,6 +141,7 @@ docker_build_agent7:
140141
variables:
141142
TAG_SUFFIX: -7
142143
BUILD_ARG: --build-arg DD_AGENT_ARTIFACT=datadog-agent-7*-amd64.tar.xz
144+
STATIC_QUALITY_GATE_NAME: "static_quality_gate_docker_agent_amd64"
143145

144146
# TODO: Move these single-machine-performance jobs to
145147
# .gitlab/deploy_containers/deploy_containers_a7.yml.
@@ -172,6 +174,7 @@ docker_build_agent7_arm64:
172174
variables:
173175
TAG_SUFFIX: -7
174176
BUILD_ARG: --build-arg DD_AGENT_ARTIFACT=datadog-agent-7*-arm64.tar.xz
177+
STATIC_QUALITY_GATE_NAME: "static_quality_gate_docker_agent_arm64"
175178

176179
# build agent7 fips image
177180
docker_build_fips_agent7:
@@ -198,6 +201,7 @@ docker_build_agent7_jmx:
198201
variables:
199202
TAG_SUFFIX: -7-jmx
200203
BUILD_ARG: --build-arg WITH_JMX=true --build-arg DD_AGENT_ARTIFACT=datadog-agent-7*-amd64.tar.xz
204+
STATIC_QUALITY_GATE_NAME: "static_quality_gate_docker_agent_jmx_amd64"
201205

202206
docker_build_agent7_jmx_arm64:
203207
extends: [.docker_build_arm64, .docker_build_agent7]
@@ -206,6 +210,7 @@ docker_build_agent7_jmx_arm64:
206210
variables:
207211
TAG_SUFFIX: -7-jmx
208212
BUILD_ARG: --build-arg WITH_JMX=true --build-arg DD_AGENT_ARTIFACT=datadog-agent-7*-arm64.tar.xz
213+
STATIC_QUALITY_GATE_NAME: "static_quality_gate_docker_agent_jmx_arm64"
209214

210215
docker_build_fips_agent7_jmx:
211216
extends: [.docker_build_amd64, .docker_build_agent7]
@@ -316,6 +321,8 @@ docker_build_cluster_agent_amd64:
316321
artifacts: true
317322
- job: cws_instrumentation-build_arm64
318323
artifacts: true
324+
variables:
325+
STATIC_QUALITY_GATE_NAME: "static_quality_gate_docker_cluster_agent_amd64"
319326

320327
docker_build_cluster_agent_arm64:
321328
extends: [.docker_build_arm64, .docker_build_cluster_agent]
@@ -326,6 +333,8 @@ docker_build_cluster_agent_arm64:
326333
artifacts: true
327334
- job: cws_instrumentation-build_arm64
328335
artifacts: true
336+
variables:
337+
STATIC_QUALITY_GATE_NAME: "static_quality_gate_docker_cluster_agent_arm64"
329338

330339
.docker_build_cluster_agent_fips:
331340
extends: .docker_build_cluster_agent
@@ -372,12 +381,16 @@ docker_build_cws_instrumentation_amd64:
372381
needs:
373382
- job: cws_instrumentation-build_amd64
374383
artifacts: true
384+
variables:
385+
STATIC_QUALITY_GATE_NAME: "static_quality_gate_docker_cws_instrumentation_amd64"
375386

376387
docker_build_cws_instrumentation_arm64:
377388
extends: [.docker_build_cws_instrumentation, .docker_build_arm64]
378389
needs:
379390
- job: cws_instrumentation-build_arm64
380391
artifacts: true
392+
variables:
393+
STATIC_QUALITY_GATE_NAME: "static_quality_gate_docker_cws_instrumentation_arm64"
381394

382395
# build the dogstatsd image
383396
.docker_build_dogstatsd:
@@ -396,10 +409,14 @@ docker_build_dogstatsd_amd64:
396409
- job: build_dogstatsd_static-binary_x64
397410
artifacts: false
398411
timeout: 20m
412+
variables:
413+
STATIC_QUALITY_GATE_NAME: "static_quality_gate_docker_dogstatsd_amd64"
399414

400415
docker_build_dogstatsd_arm64:
401416
extends: [.docker_build_dogstatsd, .docker_build_arm64, .docker_build_s3]
402417
needs:
403418
- job: build_dogstatsd_static-binary_arm64
404419
artifacts: false
405420
timeout: 20m
421+
variables:
422+
STATIC_QUALITY_GATE_NAME: "static_quality_gate_docker_dogstatsd_arm64"

.gitlab/container_build/include.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Contains jobs to build container images of the Agent.
44

55
include:
6+
- .gitlab/container_build/common.yml
67
- .gitlab/container_build/docker_linux.yml
78
- .gitlab/container_build/docker_windows.yml
89
- .gitlab/container_build/fakeintake.yml

0 commit comments

Comments
 (0)