Skip to content

Integrate one-pipeline for standardized OCI packaging#321

Draft
pawelchcki wants to merge 100 commits intomasterfrom
pawel/one-pipeline
Draft

Integrate one-pipeline for standardized OCI packaging#321
pawelchcki wants to merge 100 commits intomasterfrom
pawel/one-pipeline

Conversation

@pawelchcki
Copy link
Contributor

Summary

  • Integrate the shared one-pipeline template from libdatadog-build to standardize OCI packaging, publishing, and promotion
  • Replace custom ssi-package-merge and ssi-package-push jobs with one-pipeline's package-oci → publish → promote flow
  • Split ssi-package-create into ssi-build (stops at ssi-package-assemble) + prepare-oci-package.sh (bridges artifacts into one-pipeline)

Changes

File Change
.gitlab/one-pipeline.locked.yml New — includes shared one-pipeline template
.gitlab/prepare-oci-package.sh New — copies ssi-build artifacts into sources/ for datadog-package create
.gitlab-ci.yml Add one-pipeline include, OCI variables, build/shared-pipeline stages, package-oci needs wiring
.gitlab/ssi-package.yml Rename ssi-package-createssi-build, remove merge/push jobs
docker-bake.hcl Add output to ssi-package-assemble to export to filesystem

Test plan

  • docker buildx bake --print ssi-package-assemble-amd64 shows the output directive
  • Push to branch and verify pipeline creates shared-pipeline stage jobs from one-pipeline
  • Verify ssi-build job produces artifacts at artifacts/ssi-sources/
  • Verify package-oci job runs prepare-oci-package.sh and creates OCI package

pawelchcki and others added 30 commits January 21, 2026 14:06
…image

The musl toolchain can now be built automatically from build_env/ as a
bake dependency. This removes the need to pre-pull or maintain an external
toolchain image. To use a pre-built image instead, set TOOLCHAIN_IMAGE.

Also normalizes architecture naming (arm64 → aarch64) in Makefile for
macOS compatibility.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…SI builds

- Add inject-browser-sdk as submodule pinned to pawel-buildx-bake branch
- Add docker bake targets for building inject-browser-sdk FFI artifacts
- Add SSI targets (ssi-nginx, ssi-nginx-dev) that output OCI images with RUM enabled
- Modify deps/CMakeLists.txt to support pre-built artifacts from docker bake
- Update Dockerfile.nginx to copy pre-built artifacts instead of cloning repo
- Fix compilation errors in src/rum/injection.cpp (pointer dereference, namespace)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Simplify docker-bake.hcl to only support standard nginx builds.
Removes OPENRESTY_VERSIONS and INGRESS_NGINX_VERSIONS variables,
their corresponding build targets, and group definitions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove WAF_OPTIONS variable and waf_to_dir helper function
- Remove WAF from nginx target matrix, args, and output paths
- Delete unused packaging/Dockerfile.ingress and packaging/Dockerfile.openresty

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add a PUSH variable that switches SSI target outputs between
type=docker (default) and type=registry when PUSH=true, enabling
images to be pushed to ghcr.io.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add Docker Bake targets and scripts for creating multi-arch OCI packages
for the nginx SSI module using the datadog-packages tooling.

New targets:
- ssi-package-assemble[-dev]: Assembles nginx modules into package structure
- ssi-package-create[-dev]: Creates per-arch OCI packages
- ssi-package-merge[-dev]: Merges into multi-arch OCI index

New scripts:
- bin/generate-ssi-oci-package.sh: Full build (all nginx versions)
- bin/generate-ssi-oci-package-dev.sh: Dev build (1.28.1 + 1.29.4 only)

The packaging targets chain automatically via Docker Bake context
dependencies, so running a single command builds nginx modules,
assembles sources, and creates OCI packages.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use dockerfile-inline in bake to dynamically generate COPY statements
from NGINX_VERSIONS variables, eliminating duplication between bake
file and Dockerfiles.

- Add ssi-nginx-modules[-dev] collector targets that combine all
  nginx build outputs into a single image
- Simplify Dockerfile.ssi-sources to single COPY from collector
- Remove Dockerfile.ssi-sources-dev (now unified)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add pipeline jobs that build multi-arch SSI OCI packages using
docker buildx bake. Per-arch builds run in parallel on DinD runners,
then merge into a single merged.tar artifact.
The CI Gatekeeper blocks third-party registry images. Use
registry.ddbuild.io/images/mirror/docker:27 instead.
The docker:27 image is not available in the internal registry mirror.
Use the existing test image (Alpine-based with docker-cli-compose)
and install docker-cli-buildx at runtime.
Use CI_JOB_TOKEN to authenticate submodule clones via the
gitlab.ddbuild.io mirror of DataDog GitHub repos.
The inject-browser-sdk and datadog-packages submodules use absolute
GitHub URLs which the GitLab runners cannot access. Enable
GIT_SUBMODULE_FORCE_HTTPS to rewrite them via CI_JOB_TOKEN.
Disable automatic submodule strategy and instead:
1. Rewrite github.com/DataDog URLs to gitlab.ddbuild.io via CI_JOB_TOKEN
2. Sync and update submodules manually in before_script
The test image doesn't include git. Install it alongside
docker-cli-buildx before running submodule commands.
Let the runner handle submodule cloning via GIT_SUBMODULE_STRATEGY
with GIT_CONFIG_COUNT/KEY/VALUE to rewrite GitHub URLs to the
gitlab.ddbuild.io mirror using CI_JOB_TOKEN.
Replace COPY vendor + -mod=vendor with go mod download so the build
doesn't require a pre-generated vendor directory.
ssi-package-create: 8 CPU / 16Gi (builds 18 nginx modules with
4-way parallelism via buildkitd.toml)
ssi-package-merge: 4 CPU / 8Gi (lightweight merge of per-arch tars)
BuildKit: 4 -> 16 parallel build steps
ssi-package-create: 32 CPU / 64Gi
ssi-package-merge: 8 CPU / 16Gi
go mod download fails inside BuildKit due to private GitHub deps.
Revert Dockerfile to use -mod=vendor and generate vendor dir via
docker run golang:1.24-alpine before the bake.
The datadog-package tool depends on github.com/DataDog/go-service-authn
(private). Configure git URL rewrite and GOPRIVATE inside the container
so go mod vendor can fetch it via gitlab.ddbuild.io mirror.
Pushes the multi-arch OCI package to
registry.ddbuild.io/ci/nginx-datadog/ssi-package:<commit-sha>
using skopeo after the merge step completes.
Add pipeline jobs to build multi-arch SSI OCI packages for all
supported nginx versions, merge them into a single multi-arch
image index, and push to the internal registry.

New jobs:
- ssi-package-create: builds per-arch OCI packages using docker
  buildx bake (parallel matrix for amd64/arm64)
- ssi-package-merge: combines per-arch packages into merged.tar
- ssi-package-push: pushes the multi-arch OCI index to
  registry.ddbuild.io/ci/nginx-datadog/ssi-package:<commit_sha>

New files:
- .gitlab/ssi-package.yml: job definitions
- buildkitd.toml: BuildKit max-parallelism config
…propagation

- Extract case-insensitive parse_bool() for consistent boolean env var
  parsing across DD_RUM_ENABLED and trackResources/trackLongTasks/
  trackUserInteractions (accepts true/false/1/0/yes/no/on/off)
- Use ngx_pcalloc instead of ngx_palloc for error message buffers to
  ensure null-termination after ngx_snprintf
- Guard against empty values vector in make_rum_json_config
- Add null check on snippet_create_from_json in on_datadog_rum_config
- Propagate return value of datadog_rum_merge_loc_config
- Add unit tests for parse_bool, truthy/falsy variants, empty values
Add support for configuring RUM via DD_RUM_* environment variables as
fallback defaults. Nginx `datadog_rum_config` directive values always
take precedence over env vars on a per-field basis. When no directive
exists and valid env vars are present, RUM auto-enables.

Environment variables: DD_RUM_ENABLED, DD_RUM_APPLICATION_ID,
DD_RUM_CLIENT_TOKEN, DD_RUM_SITE, DD_RUM_SERVICE, DD_RUM_ENV,
DD_RUM_VERSION, DD_RUM_SESSION_SAMPLE_RATE,
DD_RUM_SESSION_REPLAY_SAMPLE_RATE, DD_RUM_TRACK_RESOURCES,
DD_RUM_TRACK_LONG_TASKS, DD_RUM_TRACK_USER_INTERACTIONS,
DD_RUM_REMOTE_CONFIGURATION_ID.

Precedence rules:
- `datadog_rum on/off` always wins over DD_RUM_ENABLED
- `datadog_rum_config` fields always win over DD_RUM_* env vars
- DD_RUM_ENABLED=false explicitly disables even with config env vars
- Unrecognized DD_RUM_ENABLED values log a warning and skip auto-enable

Also includes:
- Case-insensitive parse_bool() for boolean env var parsing
- Fix std::stod crash with std::strtod for sample rate parsing
- Fix snippet memory leak on config error path
- Guard against rum_enable=1 with null snippet (prevents segfault)
- Null-terminated error messages via ngx_pcalloc
- Empty values vector guard in make_rum_json_config
- Use FetchContent for inject-browser-sdk dependency
- RUM integration tests and C++ unit tests
- RUM CI pipeline in GitLab
Resolve conflicts taking origin/master's refactored RUM code:
- Use rum_config_map type alias and inline constexpr env mappings
- Rename DD_RUM_ENV -> DD_RUM_ENVIRONMENT, DD_RUM_VERSION -> DD_RUM_MAJOR_VERSION
- Use conf_err helper, unique_ptr for snippets, extracted helper functions
- Use self.assertIn/assertIsNone in tests instead of bare assert
- Remove duplicate CI job definitions
Build and test nginx-rum for all supported nginx versions (1.24.0
through 1.29.5) instead of just the subset of latest patch releases.
Replace custom ssi-package-merge and ssi-package-push jobs with the
shared one-pipeline template from libdatadog-build, which handles
datadog-package create, multi-arch merging, publishing, and promotion.

The ssi-package-create job is split: ssi-build now runs
ssi-package-assemble (stopping before datadog-package create), and
prepare-oci-package.sh bridges the artifacts into one-pipeline's
package-oci job.
@codecov-commenter
Copy link

codecov-commenter commented Mar 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.85%. Comparing base (b9e382b) to head (82fd18b).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #321   +/-   ##
=======================================
  Coverage   68.85%   68.85%           
=======================================
  Files          56       56           
  Lines        7471     7471           
  Branches     1058     1058           
=======================================
  Hits         5144     5144           
  Misses       1820     1820           
  Partials      507      507           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Without this, one-pipeline derives it from CI_PROJECT_NAME suffix
("datadog") giving "apm-library-datadog-package" instead of the
correct "apm-library-nginx-package".
@pawelchcki
Copy link
Contributor Author

Keeping in draft until improvements to CI reliability land

# Conflicts:
#	.gitlab/build-and-test-all.yml
… tests

- Update NGINX_VERSION in system-tests workflow from 1.29.5 to 1.29.6
  to match the upstream system-tests Dockerfile
- Add retry (max 2) to the GitLab coverage job for transient Vault failures
- Apply formatting to test_injection.py
Allow ssi-build to start immediately without waiting for
build-and-test-fast stage to complete.
The ssi-build job needs to clone the private inject-browser-sdk repo
during Docker builds. Pass GIT_INSTEADOF_URL through bake to rewrite
github.com/DataDog/ URLs to use the GitLab CI token.
Building 18 nginx versions with RUM in parallel fills the disk.
Instead of compiling all nginx modules from scratch inside Docker buildx
(32 CPU, 64Gi RAM), collect pre-built RUM modules from build-nginx-rum-fast
(fast pipeline) and build-nginx-rum-all (release tags) and restructure
them for OCI packaging.

- ssi-build: lightweight alpine job, needs build-nginx-rum-fast
- ssi-build-all: same assembly, needs build-nginx-rum-all, release tags only
- Revert buildkitd max-parallelism to 16 (disk issue no longer applies)
Gatekeeper policy blocks third-party registries on the CI runners.
Use the existing nginx_musl_toolchain image from the internal registry.
Create block/allow test files for the SSI injection requirements test
and set REQUIREMENTS_BLOCK_JSON_PATH / REQUIREMENTS_ALLOW_JSON_PATH
variables so the one-pipeline shared job can find them.
The one-pipeline requirements_json_test expects packaging/sources/requirements.json
to define native dependency support and deny rules. For nginx, we support
glibc and musl on x64/arm64 with no deny rules (the injector matches nginx
by binary path, no process-level filtering needed).
The nginx SSI package has no process-level deny rules in requirements.json
(injection is controlled by package name matching, not binary path filtering),
so there are no block test cases to validate.
The kubernetes-injection-test-ecr-publish job fails because
ci.nginx-datadog.apm-ecosystems-reliability-profile doesn't exist
in AWS SSM. This manual job copies it from ci.system-tests to
nginx-datadog, httpd-datadog, and inject-browser-sdk.

Remove this job after running it once.
Same image as kubernetes-injection-test-ecr-publish, which already has
aws-cli and the right IAM credentials.
.pre stage gets dropped by one-pipeline shared config.
The ECR publish job requires an AWS SSM parameter that doesn't exist
for nginx-datadog and can't be created from CI (IAM boundaries).
Disable it until infra sets up the parameter.
Disabling with when:never breaks the pipeline because
configure_system_tests needs this job. Use allow_failure instead
until the SSM parameter is set up.
…rage

- Add set -eo pipefail, shopt -s nullglob, empty-glob validation, and
  quoted dirname in ssi-package.yml assembly script
- Sync docker-bake.hcl NGINX_VERSIONS with CI (add 1.25.x, 1.28.2,
  1.29.5, 1.29.6) and update SSI_DEV to latest stable/mainline
- Add arm64+musl test case in requirements-allow.json
- Use set -euo pipefail in prepare-oci-package.sh
- Add explanatory comment on package-oci optional needs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants