[Host Profiler] bundle seccomp profile inside collector image#51545
Conversation
|
@codex review |
|
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
Gitlab CI Configuration ChangesModified Jobs.docker_build_host_profiler_standalone .docker_build_host_profiler_standalone:
before_script:
- cp bin/host-profiler/host-profiler $BUILD_CONTEXT/
- cp cmd/host-profiler/dist/host-profiler-config.yaml $BUILD_CONTEXT/
+ - cp cmd/host-profiler/deploy/seccomp-profile.json $BUILD_CONTEXT/
- ls -l $BUILD_CONTEXT/
retry: 2
rules:
- when: on_success
script:
- TAG_SUFFIX=${TAG_SUFFIX:-}
- BUILD_ARG=${BUILD_ARG:-}
- EXTRA_BUILD_CONTEXT=${ARTIFACTS_BUILD_CONTEXT:+"--build-context artifacts=$ARTIFACTS_BUILD_CONTEXT"}
- "if [[ \"$BUCKET_BRANCH\" == \"nightly\" && ( \"$IMAGE\" =~ \"ci/datadog-agent/agent\"\
\ || \"$IMAGE\" =~ \"ci/datadog-agent/cluster-agent\" || \"$IMAGE\" =~ \"ci/datadog-agent/cws-instrumentation\"\
\ || \"$IMAGE\" =~ \"ci/datadog-agent/secret-generic-connector\" || \"$IMAGE\"\
\ =~ \"ci/datadog-agent/otel-agent\" || \"$IMAGE\" =~ \"ci/datadog-agent/ddot-ebpf\"\
\ ) ]]; then\n export ECR_RELEASE_SUFFIX=\"-nightly\"\nelse\n export ECR_RELEASE_SUFFIX=${CI_COMMIT_TAG+-release}\n\
fi\n"
- AGENT_BASE_IMAGE_TAG=registry.ddbuild.io/ci/datadog-agent/${BASE_IMAGE_NAME:-agent-base-image}${ECR_RELEASE_SUFFIX}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}${BASE_IMAGE_TAG_SUFFIX:-}-$ARCH
- TARGET_TAG=${IMAGE}${ECR_RELEASE_SUFFIX}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}$TAG_SUFFIX-$ARCH
- DOCKER_CACHE_REGISTRY_TARGET="${IMAGE}${TAG_SUFFIX}-${ARCH}:cache"
- CACHE_SOURCE="--cache-from type=registry,ref=${DOCKER_CACHE_REGISTRY_TARGET}"
- CACHE_TO=""
- CACHE_TARGET=${CACHE_TARGET:-}
- "if [[ \"$BUCKET_BRANCH\" == \"nightly\" ]]; then\n DOCKER_NO_CACHE=\"--no-cache\"\
\n CACHE_SOURCE=\"\"\n CACHE_TO=\"--cache-to type=registry,ref=${DOCKER_CACHE_REGISTRY_TARGET},mode=max\"\
\nfi\nif [[ \"$CI_COMMIT_BRANCH\" == \"$CI_DEFAULT_BRANCH\" ]]; then\n CACHE_TO=\"\
--cache-to type=registry,ref=${DOCKER_CACHE_REGISTRY_TARGET},mode=max\"\nfi\n"
- "if [[ \"$DEPLOY_AGENT\" == \"true\" ]]; then\n DOCKER_NO_CACHE=\"--no-cache\"\
\n CACHE_SOURCE=\"\"\nfi\n"
- "if [[ -n \"${CACHE_TO}\" && -n \"${CACHE_TARGET}\" ]]; then\n # Build cacheable\
\ target to only export certain steps to registry.\n # Doing this first build\
\ separately lets us avoid uploading heavy artifacts (such as Agent packages),\n\
\ # that can't be usefully cached, to the remote cache.\n echo \"Building ${CACHE_TARGET}\
\ for cache\"\n # We accept failures on this build, because the build can still\
\ succeed, and the only consequence of\n # failure is that the cache doesn't\
\ get updated, which is not critical.\n # We do send an event to DD to be able\
\ to monitor it.\n\n send_docker_export_failure_event() {\n DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh\
\ $AGENT_API_KEY_ORG2 token) && \\\n curl -X POST \"https://api.datadoghq.com/api/v1/events\"\
\ \\\n -H \"Content-Type: application/json\" \\\n -H \"DD-API-KEY:\
\ ${DD_API_KEY}\" \\\n -d '{\n \"title\": \"docker cache export\
\ failure\",\n \"text\": \"An Agent docker build failed to export the\
\ cache to the remote registry\",\n \"alert_type\": \"error\",\n \
\ \"date_happened\": '\"$(date +%s)\"',\n \"tags\": [\"team:agent-build\"\
, \"pipeline:'${CI_PIPELINE_ID}'\", \"job:'${CI_JOB_NAME}'\", \"job-id:'${CI_JOB_ID}'\"\
]\n }'\n }\n\n docker buildx build --pull --platform linux/$ARCH \\\n\
\ ${CACHE_SOURCE} \\\n ${CACHE_TO} \\\n ${DOCKER_NO_CACHE} \\\n --build-arg\
\ AGENT_BASE_IMAGE_TAG=${AGENT_BASE_IMAGE_TAG} \\\n --build-arg CI \\\n \
\ --build-arg GENERAL_ARTIFACTS_CACHE_BUCKET_URL=${GENERAL_ARTIFACTS_CACHE_BUCKET_URL}\
\ \\\n --build-arg DD_GIT_REPOSITORY_URL=https://github.com/DataDog/datadog-agent\
\ \\\n --build-arg DD_GIT_COMMIT_SHA=${CI_COMMIT_SHA} \\\n --build-arg BASE_IMAGE_REGISTRY\
\ \\\n $BUILD_ARG \\\n ${EXTRA_BUILD_CONTEXT} \\\n --file $BUILD_CONTEXT/Dockerfile\
\ \\\n --target ${CACHE_TARGET} \\\n $BUILD_CONTEXT \\\n || send_docker_export_failure_event\
\ \\\n || true\n\n # On non-deploy pipelines we're fine with relying on the\
\ cache from this point on\n DOCKER_NO_CACHE=\"\"\nfi\n"
- "docker buildx build --push --pull --platform linux/$ARCH \\\n ${CACHE_SOURCE}\
\ \\\n ${DOCKER_NO_CACHE} \\\n --build-arg AGENT_BASE_IMAGE_TAG=${AGENT_BASE_IMAGE_TAG}\
\ \\\n --build-arg CI \\\n --build-arg GENERAL_ARTIFACTS_CACHE_BUCKET_URL=${GENERAL_ARTIFACTS_CACHE_BUCKET_URL}\
\ \\\n --build-arg BASE_IMAGE_REGISTRY \\\n $BUILD_ARG \\\n $TARGET_ARG \\\n\
\ --build-arg DD_GIT_REPOSITORY_URL=https://github.com/DataDog/datadog-agent\
\ \\\n --build-arg DD_GIT_COMMIT_SHA=${CI_COMMIT_SHA} \\\n ${EXTRA_BUILD_CONTEXT}\
\ \\\n --file $BUILD_CONTEXT/Dockerfile \\\n --tag ${TARGET_TAG} \\\n --label\
\ \"org.opencontainers.image.created=$(date --rfc-3339=seconds)\" \\\n --label\
\ \"org.opencontainers.image.authors=Datadog <[email protected]>\" \\\n --label\
\ \"org.opencontainers.image.source=https://github.com/DataDog/datadog-agent\"\
\ \\\n --label \"org.opencontainers.image.version=$(dda inv agent.version)\"\
\ \\\n --label \"org.opencontainers.image.revision=${CI_COMMIT_SHA}\" \\\n --label\
\ \"org.opencontainers.image.vendor=Datadog, Inc.\" \\\n --label \"target=none\"\
\ \\\n $BUILD_CONTEXT"
- FLATTEN_IMAGE=${FLATTEN_IMAGE:-true}
- "if [[ \"$FLATTEN_IMAGE\" == \"true\" ]]; then\n crane flatten -t ${TARGET_TAG}\
\ ${TARGET_TAG}\nfi\n"
- "# Measure Docker image size and generate in-place report\n# This runs after the\
\ main script and won't fail the job if there are issues.\n# This is common for\
\ all Docker image builds\n\nif [[ -n \"$STATIC_QUALITY_GATE_NAME\" ]]; then\n\
\ echo \"\U0001F4CA Starting Docker image measurement...\"\n\n # Construct the\
\ built image reference from build variables\n # This follows the same pattern\
\ used in docker build jobs\n ECR_RELEASE_SUFFIX=${ECR_RELEASE_SUFFIX:-}\n TAG_SUFFIX=${TAG_SUFFIX:-}\n\
\ IMAGE_REF=\"${IMAGE}${ECR_RELEASE_SUFFIX}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}${TAG_SUFFIX}-$ARCH\"\
\n \n echo \"\U0001F50D Measuring Docker image: $IMAGE_REF\"\n\n # Extract\
\ report prefix from gate name (e.g. static_quality_gate_docker_agent_amd64 ->\
\ docker_agent_amd64)\n REPORT_PREFIX=\"${STATIC_QUALITY_GATE_NAME#static_quality_gate_}\"\
\n\n # Generate measurement report using STATIC_QUALITY_GATE_NAME variable\n\
\ dda inv quality-gates.measure-image-local \\\n --image-ref \"$IMAGE_REF\"\
\ \\\n --gate-name \"$STATIC_QUALITY_GATE_NAME\" \\\n --build-job-name \"\
$CI_JOB_NAME\" \\\n --output-path \"${REPORT_PREFIX}_size_report_${CI_PIPELINE_ID}_${CI_COMMIT_SHA:0:8}.yml\"\
\ \\\n --debug || { echo \"\u26A0\uFE0F Docker image measurement failed for\
\ $IMAGE_REF\"; exit 0; }\n\n echo \"\u2705 Docker image measurement completed\"\
\n\n # Upload the report to S3 (same bucket structure as packages)\n BUCKET_BASE_PATH=\"\
s3://dd-ci-artefacts-build-stable/datadog-agent/static_quality_gates/GATE_REPORTS/${CI_COMMIT_SHA}\"\
\n echo \"Uploading report to ${BUCKET_BASE_PATH}\"\n aws s3 cp --only-show-errors\
\ --region us-east-1 --sse AES256 \\\n \"${REPORT_PREFIX}_size_report_${CI_PIPELINE_ID}_${CI_COMMIT_SHA:0:8}.yml\"\
\ \\\n \"${BUCKET_BASE_PATH}/${REPORT_PREFIX}_size_report_${CI_PIPELINE_ID}_${CI_COMMIT_SHA:0:8}.yml\"\
\nelse\n echo \"\u2139\uFE0F Skipping Docker image measurement (no STATIC_QUALITY_GATE_NAME\
\ defined)\"\nfi\n"
stage: container_build
timeout: 30m
variables:
BASE_IMAGE_REGISTRY: registry.ddbuild.io/images/mirror
BUILD_ARG: --target release
BUILD_CONTEXT: Dockerfiles/ddot-ebpf
FLATTEN_IMAGE: false
IMAGE: registry.ddbuild.io/ci/datadog-agent/ddot-ebpf
TAG_SUFFIX: -7docker_build_host_profiler_standalone_amd64 docker_build_host_profiler_standalone_amd64:
before_script:
- cp bin/host-profiler/host-profiler $BUILD_CONTEXT/
- cp cmd/host-profiler/dist/host-profiler-config.yaml $BUILD_CONTEXT/
+ - cp cmd/host-profiler/deploy/seccomp-profile.json $BUILD_CONTEXT/
- ls -l $BUILD_CONTEXT/
image: registry.ddbuild.io/ci/datadog-agent-buildimages/docker_x64$CI_IMAGE_DOCKER_X64_SUFFIX:$CI_IMAGE_DOCKER_X64
needs:
- job: docker_build_base_image_amd64
- job: build_host_profiler_binary_x64
retry: 2
rules:
- when: on_success
script:
- TAG_SUFFIX=${TAG_SUFFIX:-}
- BUILD_ARG=${BUILD_ARG:-}
- EXTRA_BUILD_CONTEXT=${ARTIFACTS_BUILD_CONTEXT:+"--build-context artifacts=$ARTIFACTS_BUILD_CONTEXT"}
- "if [[ \"$BUCKET_BRANCH\" == \"nightly\" && ( \"$IMAGE\" =~ \"ci/datadog-agent/agent\"\
\ || \"$IMAGE\" =~ \"ci/datadog-agent/cluster-agent\" || \"$IMAGE\" =~ \"ci/datadog-agent/cws-instrumentation\"\
\ || \"$IMAGE\" =~ \"ci/datadog-agent/secret-generic-connector\" || \"$IMAGE\"\
\ =~ \"ci/datadog-agent/otel-agent\" || \"$IMAGE\" =~ \"ci/datadog-agent/ddot-ebpf\"\
\ ) ]]; then\n export ECR_RELEASE_SUFFIX=\"-nightly\"\nelse\n export ECR_RELEASE_SUFFIX=${CI_COMMIT_TAG+-release}\n\
fi\n"
- AGENT_BASE_IMAGE_TAG=registry.ddbuild.io/ci/datadog-agent/${BASE_IMAGE_NAME:-agent-base-image}${ECR_RELEASE_SUFFIX}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}${BASE_IMAGE_TAG_SUFFIX:-}-$ARCH
- TARGET_TAG=${IMAGE}${ECR_RELEASE_SUFFIX}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}$TAG_SUFFIX-$ARCH
- DOCKER_CACHE_REGISTRY_TARGET="${IMAGE}${TAG_SUFFIX}-${ARCH}:cache"
- CACHE_SOURCE="--cache-from type=registry,ref=${DOCKER_CACHE_REGISTRY_TARGET}"
- CACHE_TO=""
- CACHE_TARGET=${CACHE_TARGET:-}
- "if [[ \"$BUCKET_BRANCH\" == \"nightly\" ]]; then\n DOCKER_NO_CACHE=\"--no-cache\"\
\n CACHE_SOURCE=\"\"\n CACHE_TO=\"--cache-to type=registry,ref=${DOCKER_CACHE_REGISTRY_TARGET},mode=max\"\
\nfi\nif [[ \"$CI_COMMIT_BRANCH\" == \"$CI_DEFAULT_BRANCH\" ]]; then\n CACHE_TO=\"\
--cache-to type=registry,ref=${DOCKER_CACHE_REGISTRY_TARGET},mode=max\"\nfi\n"
- "if [[ \"$DEPLOY_AGENT\" == \"true\" ]]; then\n DOCKER_NO_CACHE=\"--no-cache\"\
\n CACHE_SOURCE=\"\"\nfi\n"
- "if [[ -n \"${CACHE_TO}\" && -n \"${CACHE_TARGET}\" ]]; then\n # Build cacheable\
\ target to only export certain steps to registry.\n # Doing this first build\
\ separately lets us avoid uploading heavy artifacts (such as Agent packages),\n\
\ # that can't be usefully cached, to the remote cache.\n echo \"Building ${CACHE_TARGET}\
\ for cache\"\n # We accept failures on this build, because the build can still\
\ succeed, and the only consequence of\n # failure is that the cache doesn't\
\ get updated, which is not critical.\n # We do send an event to DD to be able\
\ to monitor it.\n\n send_docker_export_failure_event() {\n DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh\
\ $AGENT_API_KEY_ORG2 token) && \\\n curl -X POST \"https://api.datadoghq.com/api/v1/events\"\
\ \\\n -H \"Content-Type: application/json\" \\\n -H \"DD-API-KEY:\
\ ${DD_API_KEY}\" \\\n -d '{\n \"title\": \"docker cache export\
\ failure\",\n \"text\": \"An Agent docker build failed to export the\
\ cache to the remote registry\",\n \"alert_type\": \"error\",\n \
\ \"date_happened\": '\"$(date +%s)\"',\n \"tags\": [\"team:agent-build\"\
, \"pipeline:'${CI_PIPELINE_ID}'\", \"job:'${CI_JOB_NAME}'\", \"job-id:'${CI_JOB_ID}'\"\
]\n }'\n }\n\n docker buildx build --pull --platform linux/$ARCH \\\n\
\ ${CACHE_SOURCE} \\\n ${CACHE_TO} \\\n ${DOCKER_NO_CACHE} \\\n --build-arg\
\ AGENT_BASE_IMAGE_TAG=${AGENT_BASE_IMAGE_TAG} \\\n --build-arg CI \\\n \
\ --build-arg GENERAL_ARTIFACTS_CACHE_BUCKET_URL=${GENERAL_ARTIFACTS_CACHE_BUCKET_URL}\
\ \\\n --build-arg DD_GIT_REPOSITORY_URL=https://github.com/DataDog/datadog-agent\
\ \\\n --build-arg DD_GIT_COMMIT_SHA=${CI_COMMIT_SHA} \\\n --build-arg BASE_IMAGE_REGISTRY\
\ \\\n $BUILD_ARG \\\n ${EXTRA_BUILD_CONTEXT} \\\n --file $BUILD_CONTEXT/Dockerfile\
\ \\\n --target ${CACHE_TARGET} \\\n $BUILD_CONTEXT \\\n || send_docker_export_failure_event\
\ \\\n || true\n\n # On non-deploy pipelines we're fine with relying on the\
\ cache from this point on\n DOCKER_NO_CACHE=\"\"\nfi\n"
- "docker buildx build --push --pull --platform linux/$ARCH \\\n ${CACHE_SOURCE}\
\ \\\n ${DOCKER_NO_CACHE} \\\n --build-arg AGENT_BASE_IMAGE_TAG=${AGENT_BASE_IMAGE_TAG}\
\ \\\n --build-arg CI \\\n --build-arg GENERAL_ARTIFACTS_CACHE_BUCKET_URL=${GENERAL_ARTIFACTS_CACHE_BUCKET_URL}\
\ \\\n --build-arg BASE_IMAGE_REGISTRY \\\n $BUILD_ARG \\\n $TARGET_ARG \\\n\
\ --build-arg DD_GIT_REPOSITORY_URL=https://github.com/DataDog/datadog-agent\
\ \\\n --build-arg DD_GIT_COMMIT_SHA=${CI_COMMIT_SHA} \\\n ${EXTRA_BUILD_CONTEXT}\
\ \\\n --file $BUILD_CONTEXT/Dockerfile \\\n --tag ${TARGET_TAG} \\\n --label\
\ \"org.opencontainers.image.created=$(date --rfc-3339=seconds)\" \\\n --label\
\ \"org.opencontainers.image.authors=Datadog <[email protected]>\" \\\n --label\
\ \"org.opencontainers.image.source=https://github.com/DataDog/datadog-agent\"\
\ \\\n --label \"org.opencontainers.image.version=$(dda inv agent.version)\"\
\ \\\n --label \"org.opencontainers.image.revision=${CI_COMMIT_SHA}\" \\\n --label\
\ \"org.opencontainers.image.vendor=Datadog, Inc.\" \\\n --label \"target=none\"\
\ \\\n $BUILD_CONTEXT"
- FLATTEN_IMAGE=${FLATTEN_IMAGE:-true}
- "if [[ \"$FLATTEN_IMAGE\" == \"true\" ]]; then\n crane flatten -t ${TARGET_TAG}\
\ ${TARGET_TAG}\nfi\n"
- "# Measure Docker image size and generate in-place report\n# This runs after the\
\ main script and won't fail the job if there are issues.\n# This is common for\
\ all Docker image builds\n\nif [[ -n \"$STATIC_QUALITY_GATE_NAME\" ]]; then\n\
\ echo \"\U0001F4CA Starting Docker image measurement...\"\n\n # Construct the\
\ built image reference from build variables\n # This follows the same pattern\
\ used in docker build jobs\n ECR_RELEASE_SUFFIX=${ECR_RELEASE_SUFFIX:-}\n TAG_SUFFIX=${TAG_SUFFIX:-}\n\
\ IMAGE_REF=\"${IMAGE}${ECR_RELEASE_SUFFIX}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}${TAG_SUFFIX}-$ARCH\"\
\n \n echo \"\U0001F50D Measuring Docker image: $IMAGE_REF\"\n\n # Extract\
\ report prefix from gate name (e.g. static_quality_gate_docker_agent_amd64 ->\
\ docker_agent_amd64)\n REPORT_PREFIX=\"${STATIC_QUALITY_GATE_NAME#static_quality_gate_}\"\
\n\n # Generate measurement report using STATIC_QUALITY_GATE_NAME variable\n\
\ dda inv quality-gates.measure-image-local \\\n --image-ref \"$IMAGE_REF\"\
\ \\\n --gate-name \"$STATIC_QUALITY_GATE_NAME\" \\\n --build-job-name \"\
$CI_JOB_NAME\" \\\n --output-path \"${REPORT_PREFIX}_size_report_${CI_PIPELINE_ID}_${CI_COMMIT_SHA:0:8}.yml\"\
\ \\\n --debug || { echo \"\u26A0\uFE0F Docker image measurement failed for\
\ $IMAGE_REF\"; exit 0; }\n\n echo \"\u2705 Docker image measurement completed\"\
\n\n # Upload the report to S3 (same bucket structure as packages)\n BUCKET_BASE_PATH=\"\
s3://dd-ci-artefacts-build-stable/datadog-agent/static_quality_gates/GATE_REPORTS/${CI_COMMIT_SHA}\"\
\n echo \"Uploading report to ${BUCKET_BASE_PATH}\"\n aws s3 cp --only-show-errors\
\ --region us-east-1 --sse AES256 \\\n \"${REPORT_PREFIX}_size_report_${CI_PIPELINE_ID}_${CI_COMMIT_SHA:0:8}.yml\"\
\ \\\n \"${BUCKET_BASE_PATH}/${REPORT_PREFIX}_size_report_${CI_PIPELINE_ID}_${CI_COMMIT_SHA:0:8}.yml\"\
\nelse\n echo \"\u2139\uFE0F Skipping Docker image measurement (no STATIC_QUALITY_GATE_NAME\
\ defined)\"\nfi\n"
stage: container_build
tags:
- arch:amd64
- specific:true
timeout: 30m
variables:
ARCH: amd64
BASE_IMAGE_REGISTRY: registry.ddbuild.io/images/mirror
BUILD_ARG: --target release
BUILD_CONTEXT: Dockerfiles/ddot-ebpf
FLATTEN_IMAGE: false
IMAGE: registry.ddbuild.io/ci/datadog-agent/ddot-ebpf
STATIC_QUALITY_GATE_NAME: static_quality_gate_docker_host_profiler_amd64
TAG_SUFFIX: -7docker_build_host_profiler_standalone_arm64 docker_build_host_profiler_standalone_arm64:
before_script:
- cp bin/host-profiler/host-profiler $BUILD_CONTEXT/
- cp cmd/host-profiler/dist/host-profiler-config.yaml $BUILD_CONTEXT/
+ - cp cmd/host-profiler/deploy/seccomp-profile.json $BUILD_CONTEXT/
- ls -l $BUILD_CONTEXT/
image: registry.ddbuild.io/ci/datadog-agent-buildimages/docker_arm64$CI_IMAGE_DOCKER_ARM64_SUFFIX:$CI_IMAGE_DOCKER_ARM64
needs:
- job: docker_build_base_image_arm64
- job: build_host_profiler_binary_arm64
retry: 2
rules:
- when: on_success
script:
- TAG_SUFFIX=${TAG_SUFFIX:-}
- BUILD_ARG=${BUILD_ARG:-}
- EXTRA_BUILD_CONTEXT=${ARTIFACTS_BUILD_CONTEXT:+"--build-context artifacts=$ARTIFACTS_BUILD_CONTEXT"}
- "if [[ \"$BUCKET_BRANCH\" == \"nightly\" && ( \"$IMAGE\" =~ \"ci/datadog-agent/agent\"\
\ || \"$IMAGE\" =~ \"ci/datadog-agent/cluster-agent\" || \"$IMAGE\" =~ \"ci/datadog-agent/cws-instrumentation\"\
\ || \"$IMAGE\" =~ \"ci/datadog-agent/secret-generic-connector\" || \"$IMAGE\"\
\ =~ \"ci/datadog-agent/otel-agent\" || \"$IMAGE\" =~ \"ci/datadog-agent/ddot-ebpf\"\
\ ) ]]; then\n export ECR_RELEASE_SUFFIX=\"-nightly\"\nelse\n export ECR_RELEASE_SUFFIX=${CI_COMMIT_TAG+-release}\n\
fi\n"
- AGENT_BASE_IMAGE_TAG=registry.ddbuild.io/ci/datadog-agent/${BASE_IMAGE_NAME:-agent-base-image}${ECR_RELEASE_SUFFIX}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}${BASE_IMAGE_TAG_SUFFIX:-}-$ARCH
- TARGET_TAG=${IMAGE}${ECR_RELEASE_SUFFIX}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}$TAG_SUFFIX-$ARCH
- DOCKER_CACHE_REGISTRY_TARGET="${IMAGE}${TAG_SUFFIX}-${ARCH}:cache"
- CACHE_SOURCE="--cache-from type=registry,ref=${DOCKER_CACHE_REGISTRY_TARGET}"
- CACHE_TO=""
- CACHE_TARGET=${CACHE_TARGET:-}
- "if [[ \"$BUCKET_BRANCH\" == \"nightly\" ]]; then\n DOCKER_NO_CACHE=\"--no-cache\"\
\n CACHE_SOURCE=\"\"\n CACHE_TO=\"--cache-to type=registry,ref=${DOCKER_CACHE_REGISTRY_TARGET},mode=max\"\
\nfi\nif [[ \"$CI_COMMIT_BRANCH\" == \"$CI_DEFAULT_BRANCH\" ]]; then\n CACHE_TO=\"\
--cache-to type=registry,ref=${DOCKER_CACHE_REGISTRY_TARGET},mode=max\"\nfi\n"
- "if [[ \"$DEPLOY_AGENT\" == \"true\" ]]; then\n DOCKER_NO_CACHE=\"--no-cache\"\
\n CACHE_SOURCE=\"\"\nfi\n"
- "if [[ -n \"${CACHE_TO}\" && -n \"${CACHE_TARGET}\" ]]; then\n # Build cacheable\
\ target to only export certain steps to registry.\n # Doing this first build\
\ separately lets us avoid uploading heavy artifacts (such as Agent packages),\n\
\ # that can't be usefully cached, to the remote cache.\n echo \"Building ${CACHE_TARGET}\
\ for cache\"\n # We accept failures on this build, because the build can still\
\ succeed, and the only consequence of\n # failure is that the cache doesn't\
\ get updated, which is not critical.\n # We do send an event to DD to be able\
\ to monitor it.\n\n send_docker_export_failure_event() {\n DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh\
\ $AGENT_API_KEY_ORG2 token) && \\\n curl -X POST \"https://api.datadoghq.com/api/v1/events\"\
\ \\\n -H \"Content-Type: application/json\" \\\n -H \"DD-API-KEY:\
\ ${DD_API_KEY}\" \\\n -d '{\n \"title\": \"docker cache export\
\ failure\",\n \"text\": \"An Agent docker build failed to export the\
\ cache to the remote registry\",\n \"alert_type\": \"error\",\n \
\ \"date_happened\": '\"$(date +%s)\"',\n \"tags\": [\"team:agent-build\"\
, \"pipeline:'${CI_PIPELINE_ID}'\", \"job:'${CI_JOB_NAME}'\", \"job-id:'${CI_JOB_ID}'\"\
]\n }'\n }\n\n docker buildx build --pull --platform linux/$ARCH \\\n\
\ ${CACHE_SOURCE} \\\n ${CACHE_TO} \\\n ${DOCKER_NO_CACHE} \\\n --build-arg\
\ AGENT_BASE_IMAGE_TAG=${AGENT_BASE_IMAGE_TAG} \\\n --build-arg CI \\\n \
\ --build-arg GENERAL_ARTIFACTS_CACHE_BUCKET_URL=${GENERAL_ARTIFACTS_CACHE_BUCKET_URL}\
\ \\\n --build-arg DD_GIT_REPOSITORY_URL=https://github.com/DataDog/datadog-agent\
\ \\\n --build-arg DD_GIT_COMMIT_SHA=${CI_COMMIT_SHA} \\\n --build-arg BASE_IMAGE_REGISTRY\
\ \\\n $BUILD_ARG \\\n ${EXTRA_BUILD_CONTEXT} \\\n --file $BUILD_CONTEXT/Dockerfile\
\ \\\n --target ${CACHE_TARGET} \\\n $BUILD_CONTEXT \\\n || send_docker_export_failure_event\
\ \\\n || true\n\n # On non-deploy pipelines we're fine with relying on the\
\ cache from this point on\n DOCKER_NO_CACHE=\"\"\nfi\n"
- "docker buildx build --push --pull --platform linux/$ARCH \\\n ${CACHE_SOURCE}\
\ \\\n ${DOCKER_NO_CACHE} \\\n --build-arg AGENT_BASE_IMAGE_TAG=${AGENT_BASE_IMAGE_TAG}\
\ \\\n --build-arg CI \\\n --build-arg GENERAL_ARTIFACTS_CACHE_BUCKET_URL=${GENERAL_ARTIFACTS_CACHE_BUCKET_URL}\
\ \\\n --build-arg BASE_IMAGE_REGISTRY \\\n $BUILD_ARG \\\n $TARGET_ARG \\\n\
\ --build-arg DD_GIT_REPOSITORY_URL=https://github.com/DataDog/datadog-agent\
\ \\\n --build-arg DD_GIT_COMMIT_SHA=${CI_COMMIT_SHA} \\\n ${EXTRA_BUILD_CONTEXT}\
\ \\\n --file $BUILD_CONTEXT/Dockerfile \\\n --tag ${TARGET_TAG} \\\n --label\
\ \"org.opencontainers.image.created=$(date --rfc-3339=seconds)\" \\\n --label\
\ \"org.opencontainers.image.authors=Datadog <[email protected]>\" \\\n --label\
\ \"org.opencontainers.image.source=https://github.com/DataDog/datadog-agent\"\
\ \\\n --label \"org.opencontainers.image.version=$(dda inv agent.version)\"\
\ \\\n --label \"org.opencontainers.image.revision=${CI_COMMIT_SHA}\" \\\n --label\
\ \"org.opencontainers.image.vendor=Datadog, Inc.\" \\\n --label \"target=none\"\
\ \\\n $BUILD_CONTEXT"
- FLATTEN_IMAGE=${FLATTEN_IMAGE:-true}
- "if [[ \"$FLATTEN_IMAGE\" == \"true\" ]]; then\n crane flatten -t ${TARGET_TAG}\
\ ${TARGET_TAG}\nfi\n"
- "# Measure Docker image size and generate in-place report\n# This runs after the\
\ main script and won't fail the job if there are issues.\n# This is common for\
\ all Docker image builds\n\nif [[ -n \"$STATIC_QUALITY_GATE_NAME\" ]]; then\n\
\ echo \"\U0001F4CA Starting Docker image measurement...\"\n\n # Construct the\
\ built image reference from build variables\n # This follows the same pattern\
\ used in docker build jobs\n ECR_RELEASE_SUFFIX=${ECR_RELEASE_SUFFIX:-}\n TAG_SUFFIX=${TAG_SUFFIX:-}\n\
\ IMAGE_REF=\"${IMAGE}${ECR_RELEASE_SUFFIX}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}${TAG_SUFFIX}-$ARCH\"\
\n \n echo \"\U0001F50D Measuring Docker image: $IMAGE_REF\"\n\n # Extract\
\ report prefix from gate name (e.g. static_quality_gate_docker_agent_amd64 ->\
\ docker_agent_amd64)\n REPORT_PREFIX=\"${STATIC_QUALITY_GATE_NAME#static_quality_gate_}\"\
\n\n # Generate measurement report using STATIC_QUALITY_GATE_NAME variable\n\
\ dda inv quality-gates.measure-image-local \\\n --image-ref \"$IMAGE_REF\"\
\ \\\n --gate-name \"$STATIC_QUALITY_GATE_NAME\" \\\n --build-job-name \"\
$CI_JOB_NAME\" \\\n --output-path \"${REPORT_PREFIX}_size_report_${CI_PIPELINE_ID}_${CI_COMMIT_SHA:0:8}.yml\"\
\ \\\n --debug || { echo \"\u26A0\uFE0F Docker image measurement failed for\
\ $IMAGE_REF\"; exit 0; }\n\n echo \"\u2705 Docker image measurement completed\"\
\n\n # Upload the report to S3 (same bucket structure as packages)\n BUCKET_BASE_PATH=\"\
s3://dd-ci-artefacts-build-stable/datadog-agent/static_quality_gates/GATE_REPORTS/${CI_COMMIT_SHA}\"\
\n echo \"Uploading report to ${BUCKET_BASE_PATH}\"\n aws s3 cp --only-show-errors\
\ --region us-east-1 --sse AES256 \\\n \"${REPORT_PREFIX}_size_report_${CI_PIPELINE_ID}_${CI_COMMIT_SHA:0:8}.yml\"\
\ \\\n \"${BUCKET_BASE_PATH}/${REPORT_PREFIX}_size_report_${CI_PIPELINE_ID}_${CI_COMMIT_SHA:0:8}.yml\"\
\nelse\n echo \"\u2139\uFE0F Skipping Docker image measurement (no STATIC_QUALITY_GATE_NAME\
\ defined)\"\nfi\n"
stage: container_build
tags:
- arch:arm64
- specific:true
timeout: 30m
variables:
ARCH: arm64
BASE_IMAGE_REGISTRY: registry.ddbuild.io/images/mirror
BUILD_ARG: --target release
BUILD_CONTEXT: Dockerfiles/ddot-ebpf
FLATTEN_IMAGE: false
IMAGE: registry.ddbuild.io/ci/datadog-agent/ddot-ebpf
STATIC_QUALITY_GATE_NAME: static_quality_gate_docker_host_profiler_arm64
TAG_SUFFIX: -7Changes Summary
ℹ️ Diff available in the job log. |
wdhif
left a comment
There was a problem hiding this comment.
Approved for @DataDog/container-platform
Files inventory check summaryFile checks results against ancestor ecd4b7a7: Results for datadog-agent_7.81.0~devel.git.361.e16a404.pipeline.116188110-1_amd64.deb:No change detected |
Static quality checks✅ Please find below the results from static quality gates Successful checksInfo
31 successful checks with minimal change (< 2 KiB)
|
Regression DetectorRegression Detector ResultsMetrics dashboard Baseline: c65a19d Optimization Goals: ✅ No significant changes detected
|
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|---|---|---|---|---|---|---|
| ➖ | docker_containers_cpu | % cpu utilization | +1.16 | [-1.87, +4.20] | 1 | Logs |
Fine details of change detection per experiment
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|---|---|---|---|---|---|---|
| ➖ | docker_containers_cpu | % cpu utilization | +1.16 | [-1.87, +4.20] | 1 | Logs |
| ➖ | tcp_syslog_to_blackhole | ingress throughput | +1.08 | [+0.90, +1.26] | 1 | Logs |
| ➖ | otlp_ingest_logs | memory utilization | +0.49 | [+0.39, +0.58] | 1 | Logs |
| ➖ | ddot_metrics_sum_cumulative | memory utilization | +0.32 | [+0.17, +0.48] | 1 | Logs |
| ➖ | ddot_metrics_sum_delta | memory utilization | +0.26 | [+0.07, +0.45] | 1 | Logs |
| ➖ | quality_gate_idle | memory utilization | +0.21 | [+0.17, +0.26] | 1 | Logs bounds checks dashboard |
| ➖ | file_to_blackhole_0ms_latency | egress throughput | +0.03 | [-0.43, +0.49] | 1 | Logs |
| ➖ | quality_gate_idle_all_features | memory utilization | +0.03 | [-0.01, +0.07] | 1 | Logs bounds checks dashboard |
| ➖ | file_to_blackhole_500ms_latency | egress throughput | +0.01 | [-0.37, +0.40] | 1 | Logs |
| ➖ | uds_dogstatsd_to_api_v3 | ingress throughput | +0.01 | [-0.19, +0.21] | 1 | Logs |
| ➖ | tcp_dd_logs_filter_exclude | ingress throughput | +0.00 | [-0.09, +0.10] | 1 | Logs |
| ➖ | uds_dogstatsd_to_api | ingress throughput | -0.02 | [-0.22, +0.18] | 1 | Logs |
| ➖ | file_to_blackhole_1000ms_latency | egress throughput | -0.02 | [-0.47, +0.43] | 1 | Logs |
| ➖ | uds_dogstatsd_20mb_12k_contexts_20_senders | memory utilization | -0.03 | [-0.08, +0.03] | 1 | Logs |
| ➖ | file_to_blackhole_100ms_latency | egress throughput | -0.03 | [-0.19, +0.13] | 1 | Logs |
| ➖ | otlp_ingest_metrics | memory utilization | -0.04 | [-0.19, +0.12] | 1 | Logs |
| ➖ | docker_containers_memory | memory utilization | -0.07 | [-0.17, +0.02] | 1 | Logs |
| ➖ | file_tree | memory utilization | -0.13 | [-0.18, -0.08] | 1 | Logs |
| ➖ | ddot_metrics_sum_cumulativetodelta_exporter | memory utilization | -0.16 | [-0.40, +0.07] | 1 | Logs |
| ➖ | ddot_logs | memory utilization | -0.46 | [-0.52, -0.39] | 1 | Logs |
| ➖ | quality_gate_logs | % cpu utilization | -0.46 | [-1.50, +0.57] | 1 | Logs bounds checks dashboard |
| ➖ | ddot_metrics | memory utilization | -0.50 | [-0.70, -0.30] | 1 | Logs |
| ➖ | quality_gate_metrics_logs | memory utilization | -0.75 | [-1.00, -0.50] | 1 | Logs bounds checks dashboard |
Bounds Checks: ✅ Passed
| perf | experiment | bounds_check_name | replicates_passed | observed_value | links |
|---|---|---|---|---|---|
| ✅ | docker_containers_cpu | simple_check_run | 10/10 | 713 ≥ 26 | |
| ✅ | docker_containers_memory | memory_usage | 10/10 | 246.26MiB ≤ 370MiB | |
| ✅ | docker_containers_memory | simple_check_run | 10/10 | 715 ≥ 26 | |
| ✅ | file_to_blackhole_0ms_latency | memory_usage | 10/10 | 0.16GiB ≤ 1.20GiB | |
| ✅ | file_to_blackhole_0ms_latency | missed_bytes | 10/10 | 0B = 0B | |
| ✅ | file_to_blackhole_1000ms_latency | memory_usage | 10/10 | 0.20GiB ≤ 1.20GiB | |
| ✅ | file_to_blackhole_1000ms_latency | missed_bytes | 10/10 | 0B = 0B | |
| ✅ | file_to_blackhole_100ms_latency | memory_usage | 10/10 | 0.17GiB ≤ 1.20GiB | |
| ✅ | file_to_blackhole_100ms_latency | missed_bytes | 10/10 | 0B = 0B | |
| ✅ | file_to_blackhole_500ms_latency | memory_usage | 10/10 | 0.18GiB ≤ 1.20GiB | |
| ✅ | file_to_blackhole_500ms_latency | missed_bytes | 10/10 | 0B = 0B | |
| ✅ | quality_gate_idle | intake_connections | 10/10 | 3 ≤ 4 | bounds checks dashboard |
| ✅ | quality_gate_idle | memory_usage | 10/10 | 144.69MiB ≤ 147MiB | bounds checks dashboard |
| ✅ | quality_gate_idle | total_bytes_received | 10/10 | 738.67KiB ≤ 819.20KiB | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | intake_connections | 10/10 | 3 ≤ 4 | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | memory_usage | 10/10 | 478.30MiB ≤ 495MiB | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | total_bytes_received | 10/10 | 1.12MiB ≤ 1.25MiB | bounds checks dashboard |
| ✅ | quality_gate_logs | intake_connections | 10/10 | 3 ≤ 6 | bounds checks dashboard |
| ✅ | quality_gate_logs | memory_usage | 10/10 | 174.95MiB ≤ 195MiB | bounds checks dashboard |
| ✅ | quality_gate_logs | missed_bytes | 10/10 | 0B = 0B | bounds checks dashboard |
| ✅ | quality_gate_logs | total_bytes_received | 10/10 | 263.95MiB ≤ 292MiB | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | cpu_usage | 10/10 | 349.61 ≤ 2000 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | intake_connections | 10/10 | 3 ≤ 6 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | memory_usage | 10/10 | 375.34MiB ≤ 430MiB | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | missed_bytes | 10/10 | 0B = 0B | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | total_bytes_received | 10/10 | 0.94GiB ≤ 1.04GiB | bounds checks dashboard |
Explanation
Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%
Performance changes are noted in the perf column of each table:
- ✅ = significantly better comparison variant performance
- ❌ = significantly worse comparison variant performance
- ➖ = no significant change in performance
A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".
For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:
-
Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.
-
Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.
-
Its configuration does not mark it "erratic".
CI Pass/Fail Decision
✅ Passed. All Quality Gates passed.
- quality_gate_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
- quality_gate_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_idle, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_idle, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
- quality_gate_idle_all_features, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
- quality_gate_idle_all_features, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_idle_all_features, bounds check intake_connections: 10/10 replicas passed. Gate passed.
0dc94cf
into
main
…image (#51545) ### What does this PR do? Bundles seccomp profile inside collector image ### Motivation Before this, the seccomp profile was living in 3 different places: - datadog-operator - datadog's helm-charts - Standalone documentation Bundling the seccomp directly in the image and using it as an initContainer enables us to version the seccomp profile with profiler versions and maintain only one copy. ### Describe how you validated your changes ### Additional Notes Co-authored-by: theo.demagalhaes <[email protected]>
What does this PR do?
Bundles seccomp profile inside collector image
Motivation
Before this, the seccomp profile was living in 3 different places:
Bundling the seccomp directly in the image and using it as an initContainer enables us to version the seccomp profile with profiler versions and maintain only one copy.
Describe how you validated your changes
Additional Notes