Skip to content

[ABLD-525] Build the Linux FIPS installer without cgo (like Go 1.27) - #56351

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
mainfrom
regis.desgroppes/explore-ms-nocgo-opensslcrypto
Oct 23, 2026
Merged

gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
mainfrom
regis.desgroppes/explore-ms-nocgo-opensslcrypto

Conversation

@rdesgroppes

@rdesgroppes rdesgroppes commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

Build the Linux FIPS installer without cgo, honoring its --no-cgo as for the non-FIPS one, through msgo's cgo-less OpenSSL backend.

Set GOEXPERIMENT=ms_nocgo_opensslcrypto for Linux FIPS omnibus builds, which enables that backend, as bazel/rules/msgo/extension.bzl does for the msgo Bazel toolchain.

Write the installer's own version's and the stable version's embedded libraries into its rpath with Go's -r, in that order, and drop the patchelf rewrite of its bootstrap copy from .gitlab/build/packaging/oci.yml.

Check FIPS binaries for vendor/github.com/microsoft/go-crypto-openssl/openssl symbols, which cgo and cgo-less builds both have, instead of the cgo-only _Cfunc__mkcgo_OPENSSL ones.

Make //cmd/installer:installer pure on Linux and drop its FIPS-only cgo override, so that it builds without cgo in both flavors, as omnibus does.

Motivation

The upcoming bazelification will ship //cmd/installer:installer built with #58511's msgo toolchain, which sets ms_nocgo_opensslcrypto, so the omnibus build should establish the same baseline.
Without that experiment, Linux's OpenSSL backend needs cgo, the only reason why the FIPS installer, unlike the non-FIPS one, was built with cgo.

Without cgo, Go's internal linker ignores omnibus' rpath, which -r restores.
The bootstrap copy's patchelf --set-rpath, from #57045, segfaults on such a binary once GNU-stripped, patchelf 0.18.0 included.
Listing both library directories makes that rewrite unnecessary: the installed installer finds its own version's, and the bootstrap, which runs before that version is unpacked, falls back to the stable one's.

Describe how you validated your changes

Checked with msgo 1.26.10 that:

  • dda inv -- -e installer.build --fips-mode --no-cgo, with GOEXPERIMENT=ms_nocgo_opensslcrypto and a versioned --install-path, builds with CGO_ENABLED=0, dynamically linking only libc, libdl and libpthread, OpenSSL being dlopened,
  • once GNU-stripped, as omnibus does, that installer's rpath lists <install_path>/embedded/lib then <package>/stable/embedded/lib, as datadog-agent-finalize.rb now asserts,
  • a stripped binary with that rpath order loads libcrypto from its own version's directory when present, and from the stable one's otherwise,
  • that installer has vendor/github.com/microsoft/go-crypto-openssl/openssl symbols but no _Cfunc__mkcgo_OPENSSL ones, while a cgo FIPS build, like the agent's, has both,
  • //cmd/installer:installer builds with CGO_ENABLED=0 and the same dynamic libraries in the FIPS flavor with the msgo toolchain, and statically in the base flavor.

Checked that //bazel/buildifier:test and dda inv -- -e linter.python pass.

Additional Notes

  • a rules_go binary's CGO_ENABLED comes from pure, not cgo, which only covers the target's own sources, so the Bazel installer was built with cgo in both flavors until now,
  • the non-FIPS Bazel installer therefore becomes static on Linux, as the omnibus-built one already is, while Windows and macOS keep cgo, as omnibus does there,
  • the Bazel //cmd/installer:installer has no such rpath yet, which its FIPS packaging will need,
  • [Fleet] Fix FIPS installer library paths across Agent upgrades #57045's TestFipsUpgradeFromDebRPM exercises the bootstrap's fallback to the stable version's libraries,
  • the agent keeps cgo, for rtloader and the netcgo resolver among others,
  • Go 1.27 removes the experiment and rejects it, its cgo-less backend becoming systemcrypto's own under CGO_ENABLED=0, so both experiment settings go away then,
  • Windows keeps plain systemcrypto, with cgo.

@rdesgroppes rdesgroppes added changelog/no-changelog No changelog entry needed qa/no-code-change No code change in Agent code requiring validation labels Sep 15, 2026
@dd-octo-sts dd-octo-sts Bot added internal Identify a non-fork PR team/agent-build labels Sep 15, 2026
@github-actions github-actions Bot added the short review PR is simple enough to be reviewed quickly label Sep 15, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review by Codex (OpenAI) - workflow run

The patch is correct. The experiment is scoped to Linux FIPS builds and included in the Omnibus build environment and cache key. No actionable regressions found. Full FIPS package builds were not run.

@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 64.68% (+4.28%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 3f5ff9b | Docs | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Static quality checks

✅ Please find below the results from static quality gates
Comparison made with ancestor d53e1b0
📊 Static Quality Gates Dashboard
🔗 SQG Job

Successful checks

Info

Quality gate Change Size (prev → curr → max)
✅ agent_deb_amd64_fips -234.04 KiB (0.03% reduction, +2.16% of buffer) 686.174 → 685.945 → 696.770
✅ agent_rpm_amd64_fips -234.04 KiB (0.03% reduction, +2.16% of buffer) 686.157 → 685.929 → 696.750
✅ agent_rpm_arm64_fips -149.95 KiB (0.02% reduction, +1.31% of buffer) 661.591 → 661.444 → 672.790
✅ agent_suse_amd64_fips -234.04 KiB (0.03% reduction, +2.16% of buffer) 686.157 → 685.929 → 696.750
✅ agent_suse_arm64_fips -149.95 KiB (0.02% reduction, +1.31% of buffer) 661.591 → 661.444 → 672.790
28 successful checks with minimal change (< 2 KiB)
Quality gate Current Size
✅ agent_deb_amd64 754.771 MiB
✅ agent_heroku_amd64 312.351 MiB
✅ agent_msi 663.847 MiB
✅ agent_rpm_amd64 754.755 MiB
✅ agent_rpm_arm64 724.532 MiB
✅ agent_suse_amd64 754.755 MiB
✅ agent_suse_arm64 724.532 MiB
✅ docker_agent_amd64 810.824 MiB
✅ docker_agent_arm64 805.214 MiB
✅ docker_agent_jmx_amd64 1001.689 MiB
✅ docker_agent_jmx_arm64 984.862 MiB
✅ docker_cws_instrumentation_amd64 7.451 MiB
✅ docker_cws_instrumentation_arm64 6.877 MiB
✅ docker_dogstatsd_amd64 40.131 MiB
✅ docker_dogstatsd_arm64 38.131 MiB
✅ docker_host_profiler_amd64 313.600 MiB
✅ docker_host_profiler_arm64 324.403 MiB
✅ dogstatsd_deb_amd64 30.881 MiB
✅ dogstatsd_deb_arm64 28.819 MiB
✅ dogstatsd_rpm_amd64 30.881 MiB
✅ dogstatsd_suse_amd64 30.881 MiB
✅ iot_agent_deb_amd64 47.849 MiB
✅ iot_agent_deb_arm64 44.265 MiB
✅ iot_agent_deb_armhf 45.082 MiB
✅ iot_agent_rpm_amd64 47.850 MiB
✅ iot_agent_suse_amd64 47.849 MiB
✅ docker_cluster_agent_amd64 216.242 MiB
✅ docker_cluster_agent_arm64 228.929 MiB

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Regression Detector

Regression Detector Results

Metrics dashboard
Target profiles
Job ID: b621c638-4aab-4655-84e2-d1881be4ad9b

Baseline: 4ad5ed0
Comparison: b24be0b
Diff

Optimization Goals: ✅ No significant changes detected

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI trials links
➖ quality_gate_security_no_fs_load memory utilization +0.64 [+0.58, +0.70] 1 Logs bounds checks dashboard
➖ dsd_uds_client_drop_detector_cpu % cpu utilization +0.25 [-0.26, +0.77] 1 Logs
➖ quality_gate_metrics_logs memory utilization +0.08 [-0.15, +0.30] 1 Logs bounds checks dashboard
➖ quality_gate_idle memory utilization +0.04 [+0.00, +0.08] 1 Logs bounds checks dashboard
➖ quality_gate_logs % cpu utilization +0.01 [-0.93, +0.96] 1 Logs bounds checks dashboard
➖ quality_gate_idle_all_features memory utilization -0.05 [-0.12, +0.03] 1 Logs bounds checks dashboard
➖ dsd_uds_10mb_3k_timestamped_contexts_memory memory utilization -0.15 [-0.37, +0.07] 1 Logs
➖ quality_gate_security_idle memory utilization -0.16 [-0.19, -0.13] 1 Logs bounds checks dashboard
➖ python_openmetrics % cpu utilization -0.25 [-0.91, +0.40] 1 Logs bounds checks dashboard
➖ quality_gate_private_action_runner memory utilization -0.29 [-0.42, -0.16] 1 Logs bounds checks dashboard
➖ quality_gate_security_mean_fs_load memory utilization -0.34 [-0.38, -0.30] 1 Logs bounds checks dashboard
➖ dsd_uds_10mb_3k_timestamped_contexts_cpu % cpu utilization -0.57 [-0.84, -0.31] 1 Logs

Bounds Checks: ❌ Failed

perf experiment bounds_check_name replicates_passed observed_value links
❌ python_openmetrics checks_execution_time 8/10 112.17 > 100 bounds checks dashboard
✅ python_openmetrics cpu_usage 10/10 1352.53 ≤ 1500 bounds checks dashboard
✅ python_openmetrics memory_usage 10/10 4.29GiB ≤ 4.75GiB bounds checks dashboard
✅ quality_gate_idle intake_connections 10/10 4 ≤ 5 bounds checks dashboard
✅ quality_gate_idle memory_usage 10/10 177.92MiB ≤ 181MiB bounds checks dashboard
✅ quality_gate_idle total_bytes_received 10/10 770.98KiB ≤ 819.20KiB bounds checks dashboard
✅ quality_gate_idle_all_features intake_connections 10/10 2 ≤ 5 bounds checks dashboard
✅ quality_gate_idle_all_features memory_usage 10/10 476.44MiB ≤ 542MiB bounds checks dashboard
✅ quality_gate_idle_all_features total_bytes_received 10/10 1.16MiB ≤ 1.25MiB bounds checks dashboard
✅ quality_gate_logs intake_connections 10/10 17 ≤ 40 bounds checks dashboard
✅ quality_gate_logs memory_usage 10/10 217.10MiB ≤ 228MiB bounds checks dashboard
✅ quality_gate_logs missed_bytes 10/10 0B = 0B bounds checks dashboard
✅ quality_gate_logs total_bytes_received 10/10 263.96MiB ≤ 292MiB bounds checks dashboard
✅ quality_gate_metrics_logs cpu_usage 10/10 433.24 ≤ 2000 bounds checks dashboard
✅ quality_gate_metrics_logs intake_connections 10/10 18 ≤ 40 bounds checks dashboard
✅ quality_gate_metrics_logs memory_usage 10/10 416.71MiB ≤ 455MiB 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.95GiB ≤ 1.04GiB bounds checks dashboard
✅ quality_gate_private_action_runner memory_usage 10/10 75.39MiB ≤ 77MiB bounds checks dashboard
✅ quality_gate_security_idle cpu_usage 10/10 29.77 ≤ 100 bounds checks dashboard
✅ quality_gate_security_idle memory_usage 10/10 327.36MiB ≤ 357MiB bounds checks dashboard
✅ quality_gate_security_mean_fs_load cpu_usage 10/10 42.05 ≤ 200 bounds checks dashboard
✅ quality_gate_security_mean_fs_load memory_usage 10/10 307.44MiB ≤ 337MiB bounds checks dashboard
✅ quality_gate_security_no_fs_load cpu_usage 10/10 28.79 ≤ 100 bounds checks dashboard
✅ quality_gate_security_no_fs_load memory_usage 10/10 317.22MiB ≤ 348MiB 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:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. 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.

  3. Its configuration does not mark it "erratic".

CI Pass/Fail Decision

✅ Passed. All Quality Gates passed.

  • quality_gate_private_action_runner, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_security_mean_fs_load, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_security_mean_fs_load, 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.
  • 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_metrics_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 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_metrics_logs, bounds check memory_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_security_no_fs_load, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_security_no_fs_load, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_security_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_security_idle, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.

@dd-octo-sts dd-octo-sts Bot added the stale label Sep 30, 2026
@rdesgroppes
rdesgroppes force-pushed the regis.desgroppes/explore-ms-nocgo-opensslcrypto branch from addd238 to f4d9547 Compare October 23, 2026 07:11
@github-actions github-actions Bot added medium review PR review might take time and removed short review PR is simple enough to be reviewed quickly labels Oct 23, 2026
@rdesgroppes
rdesgroppes force-pushed the regis.desgroppes/explore-ms-nocgo-opensslcrypto branch from f4d9547 to 13d4088 Compare October 23, 2026 07:13
@rdesgroppes rdesgroppes changed the title Use ms_nocgo_opensslcrypto for the Linux FIPS build [ABLD-525] Build the Linux FIPS installer without cgo Oct 23, 2026
@rdesgroppes
rdesgroppes marked this pull request as ready for review October 23, 2026 07:20
@rdesgroppes
rdesgroppes requested review from a team as code owners October 23, 2026 07:20
@rdesgroppes
rdesgroppes requested a review from mrafi97 October 23, 2026 07:20
@rdesgroppes rdesgroppes changed the title [ABLD-525] Build the Linux FIPS installer without cgo [ABLD-525] Build the Linux FIPS installer without cgo (like Go 1.27) Oct 23, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review by Codex (OpenAI) - workflow run

The patch is correct. The Linux installer’s cgo settings align with the Microsoft Go toolchain experiment, and the updated symbol check supports both cgo and cgo-free FIPS builds. No actionable issues found. Build validation was not run in this read-only environment.

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-10-23 07:29:44 UTC ℹ️ Start processing command /merge


2026-10-23 07:29:51 UTC ℹ️ MergeQueue: Pull request is not mergeable yet

It will be processed automatically as soon as GitHub reports it as mergeable. View in MergeQueue UI.

  • Run /code blockers to see what is blocking it.
  • Run /remove to cancel it.

2026-10-23 12:21:14 UTC ⚠️ MergeQueue: This merge request was unqueued

devflow unqueued this merge request: It did not become mergeable within the expected time

@rdesgroppes
rdesgroppes force-pushed the regis.desgroppes/explore-ms-nocgo-opensslcrypto branch from 13d4088 to 8712914 Compare October 23, 2026 08:15
@dd-octo-sts dd-octo-sts Bot removed the stale label Oct 23, 2026
### What does this PR do?

Build the Linux FIPS installer without cgo, honoring its `--no-cgo` as
for the non-FIPS one, through `msgo`'s cgo-less OpenSSL backend.

Set `GOEXPERIMENT=ms_nocgo_opensslcrypto` for Linux FIPS omnibus builds,
which enables that backend, as `bazel/rules/msgo/extension.bzl` does for
the `msgo` Bazel toolchain.

Write the installer's own version's and the stable version's embedded
libraries into its rpath with Go's `-r`, in that order, and drop the
`patchelf` rewrite of its bootstrap copy from
`.gitlab/build/packaging/oci.yml`.

Check FIPS binaries for
`vendor/github.com/microsoft/go-crypto-openssl/openssl` symbols, which
cgo and cgo-less builds both have, instead of the cgo-only
`_Cfunc__mkcgo_OPENSSL` ones.

Make `//cmd/installer:installer` pure on Linux and drop its FIPS-only
`cgo` override, so that it builds without cgo in both flavors, as
omnibus does.

### Motivation

The upcoming bazelification will ship `//cmd/installer:installer` built
with #58511's `msgo` toolchain, which sets `ms_nocgo_opensslcrypto`, so
the omnibus build should establish the same baseline.
Without that experiment, Linux's OpenSSL backend needs cgo, the only
reason why the FIPS installer, unlike the non-FIPS one, was built with
cgo.

Without cgo, Go's internal linker ignores omnibus' rpath, which `-r`
restores.
The bootstrap copy's `patchelf --set-rpath`, from #57045, segfaults on
such a binary once GNU-stripped, `patchelf` 0.18.0 included.
Listing both library directories makes that rewrite unnecessary: the
installed installer finds its own version's, and the bootstrap, which
runs before that version is unpacked, falls back to the stable one's.

### Describe how you validated your changes

Checked with `msgo` 1.26.10 that:
- `dda inv -- -e installer.build --fips-mode --no-cgo`, with
  `GOEXPERIMENT=ms_nocgo_opensslcrypto` and a versioned
  `--install-path`, builds with `CGO_ENABLED=0`, dynamically linking
  only `libc`, `libdl` and `libpthread`, OpenSSL being `dlopen`ed,
- once GNU-stripped, as omnibus does, that installer's rpath lists
  `<install_path>/embedded/lib` then `<package>/stable/embedded/lib`, as
  `datadog-agent-finalize.rb` now asserts,
- a stripped binary with that rpath order loads `libcrypto` from its own
  version's directory when present, and from the stable one's otherwise,
- that installer has
  `vendor/github.com/microsoft/go-crypto-openssl/openssl` symbols but no
  `_Cfunc__mkcgo_OPENSSL` ones, while a cgo FIPS build, like the
  agent's, has both,
- `//cmd/installer:installer` builds with `CGO_ENABLED=0` and the same
  dynamic libraries in the FIPS flavor with the `msgo` toolchain, and
  statically in the base flavor.

Checked that `//bazel/buildifier:test` and `dda inv -- -e linter.python`
pass.

### Additional Notes

- a `rules_go` binary's `CGO_ENABLED` comes from `pure`, not `cgo`,
  which only covers the target's own sources, so the Bazel installer was
  built with cgo in both flavors until now,
- the non-FIPS Bazel installer therefore becomes static on Linux, as the
  omnibus-built one already is, while Windows and macOS keep cgo, as
  omnibus does there,
- the Bazel `//cmd/installer:installer` has no such rpath yet, which its
  FIPS packaging will need,
- #57045's `TestFipsUpgradeFromDebRPM` exercises the bootstrap's
  fallback to the stable version's libraries,
- the agent keeps cgo, for `rtloader` and the `netcgo` resolver among
  others,
- Go 1.27 removes the experiment and rejects it, its cgo-less backend
  becoming `systemcrypto`'s own under `CGO_ENABLED=0`, so both
  experiment settings go away then,
- Windows keeps plain `systemcrypto`, with cgo.
@rdesgroppes
rdesgroppes force-pushed the regis.desgroppes/explore-ms-nocgo-opensslcrypto branch from 8712914 to 3f5ff9b Compare October 23, 2026 12:46
@dd-octo-sts

dd-octo-sts Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Gitlab CI Configuration Changes

Modified Jobs

.package_oci
  .package_oci:
    artifacts:
      paths:
      - ${OMNIBUS_PACKAGE_DIR}
    before_script:
    - PACKAGE_VERSION="$(dda inv agent.version --url-safe)-1" || exit $?
    - export INSTALL_DIR=${INSTALL_DIR:-/opt/datadog-packages/${OCI_PRODUCT}/${PACKAGE_VERSION}}
    - set +x
    image: registry.ddbuild.io/ci/datadog-agent-buildimages/linux$CI_IMAGE_LINUX_SUFFIX:$CI_IMAGE_LINUX
    rules:
    - if: $CI_COMMIT_BRANCH =~ /^mq-working-branch-/ || ($GIT_BASE_BRANCH != null &&
        $GIT_BASE_BRANCH != "main" && $GIT_BASE_BRANCH !~ /^[67]\.[0-9]+\.x$/)
      when: never
    - when: on_success
    script:
    - "go_bin=\"$(go env GOBIN)\"\nif [ -z \"$go_bin\" ]; then\n  go_bin=\"$(go env\
      \ GOPATH)/bin\"\nfi\nmkdir -p \"$go_bin\" \"$GOPATH/pkg/mod/cache\"\nzstd -dc\
      \ go_tools_bin.tar.zst | tar xf - -C \"$go_bin\"\nzstd -dc modcache_tools.tar.zst\
      \ | tar xf - -C \"$GOPATH/pkg/mod/cache\"\n"
    - rm -f go_tools_bin.tar.zst modcache_tools.tar.zst
    - export PATH=$PATH:$go_bin
    - rm -f $OMNIBUS_PACKAGE_DIR/*-dbg-*.tar.xz
    - ls -l $OMNIBUS_PACKAGE_DIR
    - export PATH="$PATH:$(go env GOPATH)/bin"
    - dda self dep sync -f legacy-tasks
    - OUTPUT_DIR="/tmp/oci_output"
    - mkdir -p ${OUTPUT_DIR}
    - ls $OMNIBUS_PACKAGE_DIR
    - "if [ $(ls $OMNIBUS_PACKAGE_DIR/pipeline-$CI_PIPELINE_ID/*.oci.tar 2> /dev/null\
      \ | wc -l) -ge 1 ]; then\n  echo \"Copying already built images to output dir\"\
      \n  cp $OMNIBUS_PACKAGE_DIR/pipeline-$CI_PIPELINE_ID/*.oci.tar ${OUTPUT_DIR}\n\
      fi\n"
    - "# Resolve a glob pattern to a single file path, printed on stdout.\n# Prints\
      \ a warning to stderr if more than one file matches.\n# Usage: resolve_artifact\
      \ LABEL PATTERN [EXCLUDE]\n#   LABEL:   human-readable name for warning messages\n\
      #   PATTERN: glob string; pass it quoted to prevent expansion at the call site\
      \ \u2014 ls receives it unquoted inside the function\n#   EXCLUDE: optional grep\
      \ -v filter (e.g. \"ddot\" to exclude ddot files)\n# Returns 0 and prints the\
      \ path if a file was found, returns 1 if not.\nresolve_artifact() {\n  local label=\"\
      $1\" pattern=\"$2\" exclude=\"${3:-}\"\n  local matches first count\n  if [ -n\
      \ \"${exclude}\" ]; then\n    matches=$(ls ${pattern} 2>/dev/null | grep -v \"\
      ${exclude}\" || true)\n  else\n    matches=$(ls ${pattern} 2>/dev/null || true)\n\
      \  fi\n  if [ -z \"${matches}\" ]; then\n    echo \"ERROR: ${label} artifact not\
      \ found (pattern: ${pattern})\" >&2\n    return 1\n  fi\n  count=$(echo \"${matches}\"\
      \ | wc -l)\n  first=$(echo \"${matches}\" | head -1)\n  if [ \"${count}\" -gt\
      \ 1 ]; then\n    echo \"WARNING: multiple ${label} artifacts found, using ${first}\"\
      \ >&2\n  fi\n  echo \"${first}\"\n}\nfor ARCH in \"amd64\" \"arm64\"; do\n  if\
      \ [ \"${OCI_PRODUCT}\" = \"datadog-agent\" ]; then\n    # For the main agent,\
      \ exclude DDOT files since DDOT is bundled as an extension\n    INPUT_FILE=$(resolve_artifact\
      \ \"agent\" \"${OMNIBUS_PACKAGE_DIR}${OCI_PRODUCT}-*${ARCH}.tar.xz\" \"ddot\"\
      ) || exit 1\n  else\n    # For other products (like datadog-agent-ddot), don't\
      \ filter\n    INPUT_FILE=$(resolve_artifact \"${OCI_PRODUCT}\" \"${OMNIBUS_PACKAGE_DIR}${OCI_PRODUCT}-*${ARCH}.tar.xz\"\
      ) || exit 1\n  fi\n  OUTPUT_FILE=\"$(basename -a -s .xz ${INPUT_FILE})\"\n  MERGED_FILE=$(basename\
      \ \"${INPUT_FILE}\" | sed \"s/-${ARCH}.tar.xz//\").oci.tar\n  export MERGED_FILE\n\
      \  INPUT_DIR=\"/tmp/input_${ARCH}\"\n  mkdir -p ${INPUT_DIR}\n  echo \"Generating\
      \ OCI for $ARCH.\"\n  echo \"Extracting to temporary input dir $INPUT_FILE ->\
      \ $INPUT_DIR\"\n  tar xJf ${INPUT_FILE} -C ${INPUT_DIR}\n  echo \"Creating OCI\
      \ layer -> ${OUTPUT_DIR}/${OUTPUT_FILE}\"\n  if [ \"${OCI_PRODUCT}\" = \"datadog-agent\"\
      \ ]; then\n    INSTALLER_INPUT_FILE=$(resolve_artifact \"installer\" \"${OMNIBUS_PACKAGE_DIR}datadog-installer-*${ARCH}.tar.xz\"\
      ) || exit 1\n    INSTALLER_INPUT_DIR=\"/tmp/input_installer_${ARCH}\"\n    mkdir\
      \ -p ${INSTALLER_INPUT_DIR}\n    echo \"Extracting installer to temporary input\
      \ dir $INSTALLER_INPUT_FILE -> $INSTALLER_INPUT_DIR\"\n    tar xJf ${INSTALLER_INPUT_FILE}\
      \ -C ${INSTALLER_INPUT_DIR}\n\n    # Extract DDOT\n    DDOT_INPUT_FILE=$(resolve_artifact\
      \ \"DDOT\" \"${OMNIBUS_PACKAGE_DIR}datadog-agent-ddot-*${ARCH}.tar.xz\") || exit\
      \ 1\n    DDOT_EXTENSION_DIR=\"/tmp/ddot_extension_${ARCH}\"\n    mkdir -p \"${DDOT_EXTENSION_DIR}/etc\"\
      \n    echo \"Extracting DDOT ${DDOT_INPUT_FILE} -> ${DDOT_EXTENSION_DIR}\"\n \
      \   tar xJf \"${DDOT_INPUT_FILE}\" --strip-components=2 -C \"${DDOT_EXTENSION_DIR}\"\
      \ opt/\n    tar xJf \"${DDOT_INPUT_FILE}\" --strip-components=1 -C \"${DDOT_EXTENSION_DIR}/etc\"\
      \ etc/\n    EXTRA_FLAGS=\"--configs ${INPUT_DIR}/etc/datadog-agent --installer\
      \ ${INSTALLER_INPUT_DIR}/opt/datadog-packages/datadog-installer/${PACKAGE_VERSION}/bin/installer/installer\
      \ --extension ddot=${DDOT_EXTENSION_DIR}\"\n\n    # Extract DDOT FIPS \u2014 only\
      \ bundled into the FIPS variant manifest, not the base manifest\n    DDOT_FIPS_INPUT_FILE=$(resolve_artifact\
      \ \"DDOT FIPS\" \"${OMNIBUS_PACKAGE_DIR}datadog-fips-agent-ddot-*${ARCH}.tar.xz\"\
      ) || exit 1\n    DDOT_FIPS_EXTENSION_DIR=\"/tmp/ddot_fips_extension_${ARCH}\"\n\
      \    mkdir -p \"${DDOT_FIPS_EXTENSION_DIR}/etc\"\n    echo \"Extracting DDOT FIPS\
      \ ${DDOT_FIPS_INPUT_FILE} -> ${DDOT_FIPS_EXTENSION_DIR}\"\n    tar xJf \"${DDOT_FIPS_INPUT_FILE}\"\
      \ --strip-components=2 -C \"${DDOT_FIPS_EXTENSION_DIR}\" opt/\n    tar xJf \"\
      ${DDOT_FIPS_INPUT_FILE}\" --strip-components=1 -C \"${DDOT_FIPS_EXTENSION_DIR}/etc\"\
      \ etc/\n  fi\n  if [ \"${OCI_PRODUCT}\" = \"datadog-installer\" ]; then\n    EXTRA_FLAGS=\"\
      --installer ${INPUT_DIR}/${INSTALL_DIR}/bin/installer/installer\"\n  fi\n  if\
      \ [ \"${OCI_PRODUCT}\" = \"datadog-agent-ddot\" ]; then\n    EXTRA_FLAGS=\"--configs\
      \ ${INPUT_DIR}/etc/datadog-agent\"\n  fi\n  datadog-package create \\\n    --version\
      \ ${PACKAGE_VERSION} \\\n    --package ${OCI_PRODUCT} \\\n    --os linux \\\n\
      \    --arch ${ARCH} \\\n    --archive --archive-path \"${OUTPUT_DIR}/${OUTPUT_FILE}\"\
      \ \\\n    ${EXTRA_FLAGS} \\\n    ${INPUT_DIR}/${INSTALL_DIR}/\n\n  # Build the\
      \ FIPS-flavored variant (Platform.Variant=\"fips\") into the same OCI index.\n\
      \  # The installer selects this variant when DD_FIPS_MODE=true.\n  if [ \"${OCI_PRODUCT}\"\
      \ = \"datadog-agent\" ]; then\n    FIPS_INPUT_FILE=$(resolve_artifact \"FIPS agent\"\
      \ \"${OMNIBUS_PACKAGE_DIR}datadog-fips-agent-*${ARCH}.tar.xz\" \"ddot\") || exit\
      \ 1\n    FIPS_INPUT_DIR=\"/tmp/input_fips_${ARCH}\"\n  fi\n  if [ \"${OCI_PRODUCT}\"\
      \ = \"datadog-installer\" ]; then\n    FIPS_INPUT_FILE=$(resolve_artifact \"FIPS\
      \ installer\" \"${OMNIBUS_PACKAGE_DIR}datadog-fips-installer-*${ARCH}.tar.xz\"\
      ) || exit 1\n    FIPS_INPUT_DIR=\"/tmp/input_fips_installer_${ARCH}\"\n    FIPS_EXTRA_FLAGS=\"\
      --installer ${FIPS_INPUT_DIR}/${INSTALL_DIR}/bin/installer/installer\"\n  fi\n\
      \  if [ -n \"${FIPS_INPUT_FILE:-}\" ]; then\n    FIPS_OUTPUT_FILE=\"$(basename\
      \ -a -s .xz ${FIPS_INPUT_FILE})\"\n    mkdir -p ${FIPS_INPUT_DIR}\n    echo \"\
      Extracting FIPS ${FIPS_INPUT_FILE} -> ${FIPS_INPUT_DIR}\"\n    tar xJf ${FIPS_INPUT_FILE}\
      \ -C ${FIPS_INPUT_DIR}\n    if [ \"${OCI_PRODUCT}\" = \"datadog-agent\" ]; then\n\
-     \      # Bootstrap runs before unpacking the new Agent, so use the current Agent's\
-     \ FIPS libraries.\n      FIPS_INSTALLER_LAYER=\"${FIPS_INPUT_DIR}/installer.layer\"\
-     \n      # Patch a copy so the installed installer keeps its own library path.\n\
-     \      cp \"${FIPS_INPUT_DIR}/${INSTALL_DIR}/embedded/bin/installer\" \"${FIPS_INSTALLER_LAYER}\"\
-     \n      patchelf --set-rpath /opt/datadog-packages/datadog-agent/stable/embedded/lib\
-     \ \"${FIPS_INSTALLER_LAYER}\"\n      FIPS_EXTRA_FLAGS=\"--configs ${FIPS_INPUT_DIR}/etc/datadog-agent\
?      ------------------------------
+     \      FIPS_EXTRA_FLAGS=\"--configs ${FIPS_INPUT_DIR}/etc/datadog-agent --installer\
?                                                                            ++++++++++++
-     \ --installer ${FIPS_INSTALLER_LAYER} --extension ddot=${DDOT_FIPS_EXTENSION_DIR}\"\
+     \ ${FIPS_INPUT_DIR}/${INSTALL_DIR}/embedded/bin/installer --extension ddot=${DDOT_FIPS_EXTENSION_DIR}\"\
      \n    fi\n    echo \"Creating FIPS OCI layer -> ${OUTPUT_DIR}/${FIPS_OUTPUT_FILE}\"\
      \n    datadog-package create \\\n      --version ${PACKAGE_VERSION} \\\n     \
      \ --package ${OCI_PRODUCT} \\\n      --os linux \\\n      --arch ${ARCH} \\\n\
      \      --variant fips \\\n      --archive --archive-path \"${OUTPUT_DIR}/${FIPS_OUTPUT_FILE}\"\
      \ \\\n      ${FIPS_EXTRA_FLAGS} \\\n      ${FIPS_INPUT_DIR}/${INSTALL_DIR}/\n\
      \    rm -f ${FIPS_INPUT_FILE}\n  fi\n\n  rm -f ${INPUT_FILE}\n  if [ \"${OCI_PRODUCT}\"\
      \ = \"datadog-agent\" ]; then\n    rm -f ${INSTALLER_INPUT_FILE} ${DDOT_INPUT_FILE}\
      \ ${DDOT_FIPS_INPUT_FILE}\n  fi\ndone\n"
    - echo "Aggregating all layers into one package -> ${MERGED_FILE}"
    - ls -l ${OUTPUT_DIR}/
    - "# Keep base manifests first so older installers don't select FIPS by mistake.\n\
      BASE_ARCHIVES=()\nFIPS_ARCHIVES=()\nfor ARCHIVE in \"${OUTPUT_DIR}\"/*.tar; do\n\
      \  case \"$(basename \"${ARCHIVE}\")\" in\n    datadog-fips-*|*-fips.oci.tar)\
      \ FIPS_ARCHIVES+=(\"${ARCHIVE}\") ;;\n    *) BASE_ARCHIVES+=(\"${ARCHIVE}\") ;;\n\
      \  esac\ndone\ndatadog-package merge \"${BASE_ARCHIVES[@]}\" \"${FIPS_ARCHIVES[@]}\"\
      \n"
    - mv merged.tar ${OMNIBUS_PACKAGE_DIR}/${MERGED_FILE}
    stage: packaging
    tags:
    - arch:amd64
    - specific:true
    variables:
      KUBERNETES_CPU_REQUEST: 16
      KUBERNETES_MEMORY_LIMIT: 32Gi
      KUBERNETES_MEMORY_REQUEST: 32Gi
agent_oci
  agent_oci:
    artifacts:
      paths:
      - ${OMNIBUS_PACKAGE_DIR}
    before_script:
    - PACKAGE_VERSION="$(dda inv agent.version --url-safe)-1" || exit $?
    - export INSTALL_DIR=${INSTALL_DIR:-/opt/datadog-packages/${OCI_PRODUCT}/${PACKAGE_VERSION}}
    - set +x
    image: registry.ddbuild.io/ci/datadog-agent-buildimages/linux$CI_IMAGE_LINUX_SUFFIX:$CI_IMAGE_LINUX
    needs:
    - setup_agent_version
    - datadog-agent-oci-x64-a7
    - datadog-agent-oci-arm64-a7
    - datadog-agent-oci-x64-a7-fips
    - datadog-agent-oci-arm64-a7-fips
    - go_tools_deps
    - installer-arm64-oci
    - installer-amd64-oci
    - datadog-otel-agent-x64
    - datadog-otel-agent-arm64
    - datadog-otel-agent-x64-fips
    - datadog-otel-agent-arm64-fips
    - job: agent_win_oci
      optional: true
    - job: agent_win_oci_fips
      optional: true
    rules:
    - if: $CI_COMMIT_BRANCH =~ /^mq-working-branch-/ || ($GIT_BASE_BRANCH != null &&
        $GIT_BASE_BRANCH != "main" && $GIT_BASE_BRANCH !~ /^[67]\.[0-9]+\.x$/)
      when: never
    - when: on_success
    script:
    - "go_bin=\"$(go env GOBIN)\"\nif [ -z \"$go_bin\" ]; then\n  go_bin=\"$(go env\
      \ GOPATH)/bin\"\nfi\nmkdir -p \"$go_bin\" \"$GOPATH/pkg/mod/cache\"\nzstd -dc\
      \ go_tools_bin.tar.zst | tar xf - -C \"$go_bin\"\nzstd -dc modcache_tools.tar.zst\
      \ | tar xf - -C \"$GOPATH/pkg/mod/cache\"\n"
    - rm -f go_tools_bin.tar.zst modcache_tools.tar.zst
    - export PATH=$PATH:$go_bin
    - rm -f $OMNIBUS_PACKAGE_DIR/*-dbg-*.tar.xz
    - ls -l $OMNIBUS_PACKAGE_DIR
    - export PATH="$PATH:$(go env GOPATH)/bin"
    - dda self dep sync -f legacy-tasks
    - OUTPUT_DIR="/tmp/oci_output"
    - mkdir -p ${OUTPUT_DIR}
    - ls $OMNIBUS_PACKAGE_DIR
    - "if [ $(ls $OMNIBUS_PACKAGE_DIR/pipeline-$CI_PIPELINE_ID/*.oci.tar 2> /dev/null\
      \ | wc -l) -ge 1 ]; then\n  echo \"Copying already built images to output dir\"\
      \n  cp $OMNIBUS_PACKAGE_DIR/pipeline-$CI_PIPELINE_ID/*.oci.tar ${OUTPUT_DIR}\n\
      fi\n"
    - "# Resolve a glob pattern to a single file path, printed on stdout.\n# Prints\
      \ a warning to stderr if more than one file matches.\n# Usage: resolve_artifact\
      \ LABEL PATTERN [EXCLUDE]\n#   LABEL:   human-readable name for warning messages\n\
      #   PATTERN: glob string; pass it quoted to prevent expansion at the call site\
      \ \u2014 ls receives it unquoted inside the function\n#   EXCLUDE: optional grep\
      \ -v filter (e.g. \"ddot\" to exclude ddot files)\n# Returns 0 and prints the\
      \ path if a file was found, returns 1 if not.\nresolve_artifact() {\n  local label=\"\
      $1\" pattern=\"$2\" exclude=\"${3:-}\"\n  local matches first count\n  if [ -n\
      \ \"${exclude}\" ]; then\n    matches=$(ls ${pattern} 2>/dev/null | grep -v \"\
      ${exclude}\" || true)\n  else\n    matches=$(ls ${pattern} 2>/dev/null || true)\n\
      \  fi\n  if [ -z \"${matches}\" ]; then\n    echo \"ERROR: ${label} artifact not\
      \ found (pattern: ${pattern})\" >&2\n    return 1\n  fi\n  count=$(echo \"${matches}\"\
      \ | wc -l)\n  first=$(echo \"${matches}\" | head -1)\n  if [ \"${count}\" -gt\
      \ 1 ]; then\n    echo \"WARNING: multiple ${label} artifacts found, using ${first}\"\
      \ >&2\n  fi\n  echo \"${first}\"\n}\nfor ARCH in \"amd64\" \"arm64\"; do\n  if\
      \ [ \"${OCI_PRODUCT}\" = \"datadog-agent\" ]; then\n    # For the main agent,\
      \ exclude DDOT files since DDOT is bundled as an extension\n    INPUT_FILE=$(resolve_artifact\
      \ \"agent\" \"${OMNIBUS_PACKAGE_DIR}${OCI_PRODUCT}-*${ARCH}.tar.xz\" \"ddot\"\
      ) || exit 1\n  else\n    # For other products (like datadog-agent-ddot), don't\
      \ filter\n    INPUT_FILE=$(resolve_artifact \"${OCI_PRODUCT}\" \"${OMNIBUS_PACKAGE_DIR}${OCI_PRODUCT}-*${ARCH}.tar.xz\"\
      ) || exit 1\n  fi\n  OUTPUT_FILE=\"$(basename -a -s .xz ${INPUT_FILE})\"\n  MERGED_FILE=$(basename\
      \ \"${INPUT_FILE}\" | sed \"s/-${ARCH}.tar.xz//\").oci.tar\n  export MERGED_FILE\n\
      \  INPUT_DIR=\"/tmp/input_${ARCH}\"\n  mkdir -p ${INPUT_DIR}\n  echo \"Generating\
      \ OCI for $ARCH.\"\n  echo \"Extracting to temporary input dir $INPUT_FILE ->\
      \ $INPUT_DIR\"\n  tar xJf ${INPUT_FILE} -C ${INPUT_DIR}\n  echo \"Creating OCI\
      \ layer -> ${OUTPUT_DIR}/${OUTPUT_FILE}\"\n  if [ \"${OCI_PRODUCT}\" = \"datadog-agent\"\
      \ ]; then\n    INSTALLER_INPUT_FILE=$(resolve_artifact \"installer\" \"${OMNIBUS_PACKAGE_DIR}datadog-installer-*${ARCH}.tar.xz\"\
      ) || exit 1\n    INSTALLER_INPUT_DIR=\"/tmp/input_installer_${ARCH}\"\n    mkdir\
      \ -p ${INSTALLER_INPUT_DIR}\n    echo \"Extracting installer to temporary input\
      \ dir $INSTALLER_INPUT_FILE -> $INSTALLER_INPUT_DIR\"\n    tar xJf ${INSTALLER_INPUT_FILE}\
      \ -C ${INSTALLER_INPUT_DIR}\n\n    # Extract DDOT\n    DDOT_INPUT_FILE=$(resolve_artifact\
      \ \"DDOT\" \"${OMNIBUS_PACKAGE_DIR}datadog-agent-ddot-*${ARCH}.tar.xz\") || exit\
      \ 1\n    DDOT_EXTENSION_DIR=\"/tmp/ddot_extension_${ARCH}\"\n    mkdir -p \"${DDOT_EXTENSION_DIR}/etc\"\
      \n    echo \"Extracting DDOT ${DDOT_INPUT_FILE} -> ${DDOT_EXTENSION_DIR}\"\n \
      \   tar xJf \"${DDOT_INPUT_FILE}\" --strip-components=2 -C \"${DDOT_EXTENSION_DIR}\"\
      \ opt/\n    tar xJf \"${DDOT_INPUT_FILE}\" --strip-components=1 -C \"${DDOT_EXTENSION_DIR}/etc\"\
      \ etc/\n    EXTRA_FLAGS=\"--configs ${INPUT_DIR}/etc/datadog-agent --installer\
      \ ${INSTALLER_INPUT_DIR}/opt/datadog-packages/datadog-installer/${PACKAGE_VERSION}/bin/installer/installer\
      \ --extension ddot=${DDOT_EXTENSION_DIR}\"\n\n    # Extract DDOT FIPS \u2014 only\
      \ bundled into the FIPS variant manifest, not the base manifest\n    DDOT_FIPS_INPUT_FILE=$(resolve_artifact\
      \ \"DDOT FIPS\" \"${OMNIBUS_PACKAGE_DIR}datadog-fips-agent-ddot-*${ARCH}.tar.xz\"\
      ) || exit 1\n    DDOT_FIPS_EXTENSION_DIR=\"/tmp/ddot_fips_extension_${ARCH}\"\n\
      \    mkdir -p \"${DDOT_FIPS_EXTENSION_DIR}/etc\"\n    echo \"Extracting DDOT FIPS\
      \ ${DDOT_FIPS_INPUT_FILE} -> ${DDOT_FIPS_EXTENSION_DIR}\"\n    tar xJf \"${DDOT_FIPS_INPUT_FILE}\"\
      \ --strip-components=2 -C \"${DDOT_FIPS_EXTENSION_DIR}\" opt/\n    tar xJf \"\
      ${DDOT_FIPS_INPUT_FILE}\" --strip-components=1 -C \"${DDOT_FIPS_EXTENSION_DIR}/etc\"\
      \ etc/\n  fi\n  if [ \"${OCI_PRODUCT}\" = \"datadog-installer\" ]; then\n    EXTRA_FLAGS=\"\
      --installer ${INPUT_DIR}/${INSTALL_DIR}/bin/installer/installer\"\n  fi\n  if\
      \ [ \"${OCI_PRODUCT}\" = \"datadog-agent-ddot\" ]; then\n    EXTRA_FLAGS=\"--configs\
      \ ${INPUT_DIR}/etc/datadog-agent\"\n  fi\n  datadog-package create \\\n    --version\
      \ ${PACKAGE_VERSION} \\\n    --package ${OCI_PRODUCT} \\\n    --os linux \\\n\
      \    --arch ${ARCH} \\\n    --archive --archive-path \"${OUTPUT_DIR}/${OUTPUT_FILE}\"\
      \ \\\n    ${EXTRA_FLAGS} \\\n    ${INPUT_DIR}/${INSTALL_DIR}/\n\n  # Build the\
      \ FIPS-flavored variant (Platform.Variant=\"fips\") into the same OCI index.\n\
      \  # The installer selects this variant when DD_FIPS_MODE=true.\n  if [ \"${OCI_PRODUCT}\"\
      \ = \"datadog-agent\" ]; then\n    FIPS_INPUT_FILE=$(resolve_artifact \"FIPS agent\"\
      \ \"${OMNIBUS_PACKAGE_DIR}datadog-fips-agent-*${ARCH}.tar.xz\" \"ddot\") || exit\
      \ 1\n    FIPS_INPUT_DIR=\"/tmp/input_fips_${ARCH}\"\n  fi\n  if [ \"${OCI_PRODUCT}\"\
      \ = \"datadog-installer\" ]; then\n    FIPS_INPUT_FILE=$(resolve_artifact \"FIPS\
      \ installer\" \"${OMNIBUS_PACKAGE_DIR}datadog-fips-installer-*${ARCH}.tar.xz\"\
      ) || exit 1\n    FIPS_INPUT_DIR=\"/tmp/input_fips_installer_${ARCH}\"\n    FIPS_EXTRA_FLAGS=\"\
      --installer ${FIPS_INPUT_DIR}/${INSTALL_DIR}/bin/installer/installer\"\n  fi\n\
      \  if [ -n \"${FIPS_INPUT_FILE:-}\" ]; then\n    FIPS_OUTPUT_FILE=\"$(basename\
      \ -a -s .xz ${FIPS_INPUT_FILE})\"\n    mkdir -p ${FIPS_INPUT_DIR}\n    echo \"\
      Extracting FIPS ${FIPS_INPUT_FILE} -> ${FIPS_INPUT_DIR}\"\n    tar xJf ${FIPS_INPUT_FILE}\
      \ -C ${FIPS_INPUT_DIR}\n    if [ \"${OCI_PRODUCT}\" = \"datadog-agent\" ]; then\n\
-     \      # Bootstrap runs before unpacking the new Agent, so use the current Agent's\
-     \ FIPS libraries.\n      FIPS_INSTALLER_LAYER=\"${FIPS_INPUT_DIR}/installer.layer\"\
-     \n      # Patch a copy so the installed installer keeps its own library path.\n\
-     \      cp \"${FIPS_INPUT_DIR}/${INSTALL_DIR}/embedded/bin/installer\" \"${FIPS_INSTALLER_LAYER}\"\
-     \n      patchelf --set-rpath /opt/datadog-packages/datadog-agent/stable/embedded/lib\
-     \ \"${FIPS_INSTALLER_LAYER}\"\n      FIPS_EXTRA_FLAGS=\"--configs ${FIPS_INPUT_DIR}/etc/datadog-agent\
?      ------------------------------
+     \      FIPS_EXTRA_FLAGS=\"--configs ${FIPS_INPUT_DIR}/etc/datadog-agent --installer\
?                                                                            ++++++++++++
-     \ --installer ${FIPS_INSTALLER_LAYER} --extension ddot=${DDOT_FIPS_EXTENSION_DIR}\"\
+     \ ${FIPS_INPUT_DIR}/${INSTALL_DIR}/embedded/bin/installer --extension ddot=${DDOT_FIPS_EXTENSION_DIR}\"\
      \n    fi\n    echo \"Creating FIPS OCI layer -> ${OUTPUT_DIR}/${FIPS_OUTPUT_FILE}\"\
      \n    datadog-package create \\\n      --version ${PACKAGE_VERSION} \\\n     \
      \ --package ${OCI_PRODUCT} \\\n      --os linux \\\n      --arch ${ARCH} \\\n\
      \      --variant fips \\\n      --archive --archive-path \"${OUTPUT_DIR}/${FIPS_OUTPUT_FILE}\"\
      \ \\\n      ${FIPS_EXTRA_FLAGS} \\\n      ${FIPS_INPUT_DIR}/${INSTALL_DIR}/\n\
      \    rm -f ${FIPS_INPUT_FILE}\n  fi\n\n  rm -f ${INPUT_FILE}\n  if [ \"${OCI_PRODUCT}\"\
      \ = \"datadog-agent\" ]; then\n    rm -f ${INSTALLER_INPUT_FILE} ${DDOT_INPUT_FILE}\
      \ ${DDOT_FIPS_INPUT_FILE}\n  fi\ndone\n"
    - echo "Aggregating all layers into one package -> ${MERGED_FILE}"
    - ls -l ${OUTPUT_DIR}/
    - "# Keep base manifests first so older installers don't select FIPS by mistake.\n\
      BASE_ARCHIVES=()\nFIPS_ARCHIVES=()\nfor ARCHIVE in \"${OUTPUT_DIR}\"/*.tar; do\n\
      \  case \"$(basename \"${ARCHIVE}\")\" in\n    datadog-fips-*|*-fips.oci.tar)\
      \ FIPS_ARCHIVES+=(\"${ARCHIVE}\") ;;\n    *) BASE_ARCHIVES+=(\"${ARCHIVE}\") ;;\n\
      \  esac\ndone\ndatadog-package merge \"${BASE_ARCHIVES[@]}\" \"${FIPS_ARCHIVES[@]}\"\
      \n"
    - mv merged.tar ${OMNIBUS_PACKAGE_DIR}/${MERGED_FILE}
    stage: packaging
    tags:
    - arch:amd64
    - specific:true
    variables:
      KUBERNETES_CPU_REQUEST: 16
      KUBERNETES_MEMORY_LIMIT: 32Gi
      KUBERNETES_MEMORY_REQUEST: 32Gi
      OCI_PRODUCT: datadog-agent
ddot_oci
  ddot_oci:
    artifacts:
      paths:
      - ${OMNIBUS_PACKAGE_DIR}/*.oci.tar
    before_script:
    - PACKAGE_VERSION="$(dda inv agent.version --url-safe)-1" || exit $?
    - export INSTALL_DIR=${INSTALL_DIR:-/opt/datadog-packages/${OCI_PRODUCT}/${PACKAGE_VERSION}}
    - set +x
    image: registry.ddbuild.io/ci/datadog-agent-buildimages/linux$CI_IMAGE_LINUX_SUFFIX:$CI_IMAGE_LINUX
    needs:
    - setup_agent_version
    - datadog-otel-agent-x64
    - datadog-otel-agent-arm64
    - go_tools_deps
    - job: ddot_win_oci
      optional: true
    rules:
    - if: $CI_COMMIT_BRANCH =~ /^mq-working-branch-/ || ($GIT_BASE_BRANCH != null &&
        $GIT_BASE_BRANCH != "main" && $GIT_BASE_BRANCH !~ /^[67]\.[0-9]+\.x$/)
      when: never
    - when: on_success
    script:
    - "go_bin=\"$(go env GOBIN)\"\nif [ -z \"$go_bin\" ]; then\n  go_bin=\"$(go env\
      \ GOPATH)/bin\"\nfi\nmkdir -p \"$go_bin\" \"$GOPATH/pkg/mod/cache\"\nzstd -dc\
      \ go_tools_bin.tar.zst | tar xf - -C \"$go_bin\"\nzstd -dc modcache_tools.tar.zst\
      \ | tar xf - -C \"$GOPATH/pkg/mod/cache\"\n"
    - rm -f go_tools_bin.tar.zst modcache_tools.tar.zst
    - export PATH=$PATH:$go_bin
    - rm -f $OMNIBUS_PACKAGE_DIR/*-dbg-*.tar.xz
    - ls -l $OMNIBUS_PACKAGE_DIR
    - export PATH="$PATH:$(go env GOPATH)/bin"
    - dda self dep sync -f legacy-tasks
    - OUTPUT_DIR="/tmp/oci_output"
    - mkdir -p ${OUTPUT_DIR}
    - ls $OMNIBUS_PACKAGE_DIR
    - "if [ $(ls $OMNIBUS_PACKAGE_DIR/pipeline-$CI_PIPELINE_ID/*.oci.tar 2> /dev/null\
      \ | wc -l) -ge 1 ]; then\n  echo \"Copying already built images to output dir\"\
      \n  cp $OMNIBUS_PACKAGE_DIR/pipeline-$CI_PIPELINE_ID/*.oci.tar ${OUTPUT_DIR}\n\
      fi\n"
    - "# Resolve a glob pattern to a single file path, printed on stdout.\n# Prints\
      \ a warning to stderr if more than one file matches.\n# Usage: resolve_artifact\
      \ LABEL PATTERN [EXCLUDE]\n#   LABEL:   human-readable name for warning messages\n\
      #   PATTERN: glob string; pass it quoted to prevent expansion at the call site\
      \ \u2014 ls receives it unquoted inside the function\n#   EXCLUDE: optional grep\
      \ -v filter (e.g. \"ddot\" to exclude ddot files)\n# Returns 0 and prints the\
      \ path if a file was found, returns 1 if not.\nresolve_artifact() {\n  local label=\"\
      $1\" pattern=\"$2\" exclude=\"${3:-}\"\n  local matches first count\n  if [ -n\
      \ \"${exclude}\" ]; then\n    matches=$(ls ${pattern} 2>/dev/null | grep -v \"\
      ${exclude}\" || true)\n  else\n    matches=$(ls ${pattern} 2>/dev/null || true)\n\
      \  fi\n  if [ -z \"${matches}\" ]; then\n    echo \"ERROR: ${label} artifact not\
      \ found (pattern: ${pattern})\" >&2\n    return 1\n  fi\n  count=$(echo \"${matches}\"\
      \ | wc -l)\n  first=$(echo \"${matches}\" | head -1)\n  if [ \"${count}\" -gt\
      \ 1 ]; then\n    echo \"WARNING: multiple ${label} artifacts found, using ${first}\"\
      \ >&2\n  fi\n  echo \"${first}\"\n}\nfor ARCH in \"amd64\" \"arm64\"; do\n  if\
      \ [ \"${OCI_PRODUCT}\" = \"datadog-agent\" ]; then\n    # For the main agent,\
      \ exclude DDOT files since DDOT is bundled as an extension\n    INPUT_FILE=$(resolve_artifact\
      \ \"agent\" \"${OMNIBUS_PACKAGE_DIR}${OCI_PRODUCT}-*${ARCH}.tar.xz\" \"ddot\"\
      ) || exit 1\n  else\n    # For other products (like datadog-agent-ddot), don't\
      \ filter\n    INPUT_FILE=$(resolve_artifact \"${OCI_PRODUCT}\" \"${OMNIBUS_PACKAGE_DIR}${OCI_PRODUCT}-*${ARCH}.tar.xz\"\
      ) || exit 1\n  fi\n  OUTPUT_FILE=\"$(basename -a -s .xz ${INPUT_FILE})\"\n  MERGED_FILE=$(basename\
      \ \"${INPUT_FILE}\" | sed \"s/-${ARCH}.tar.xz//\").oci.tar\n  export MERGED_FILE\n\
      \  INPUT_DIR=\"/tmp/input_${ARCH}\"\n  mkdir -p ${INPUT_DIR}\n  echo \"Generating\
      \ OCI for $ARCH.\"\n  echo \"Extracting to temporary input dir $INPUT_FILE ->\
      \ $INPUT_DIR\"\n  tar xJf ${INPUT_FILE} -C ${INPUT_DIR}\n  echo \"Creating OCI\
      \ layer -> ${OUTPUT_DIR}/${OUTPUT_FILE}\"\n  if [ \"${OCI_PRODUCT}\" = \"datadog-agent\"\
      \ ]; then\n    INSTALLER_INPUT_FILE=$(resolve_artifact \"installer\" \"${OMNIBUS_PACKAGE_DIR}datadog-installer-*${ARCH}.tar.xz\"\
      ) || exit 1\n    INSTALLER_INPUT_DIR=\"/tmp/input_installer_${ARCH}\"\n    mkdir\
      \ -p ${INSTALLER_INPUT_DIR}\n    echo \"Extracting installer to temporary input\
      \ dir $INSTALLER_INPUT_FILE -> $INSTALLER_INPUT_DIR\"\n    tar xJf ${INSTALLER_INPUT_FILE}\
      \ -C ${INSTALLER_INPUT_DIR}\n\n    # Extract DDOT\n    DDOT_INPUT_FILE=$(resolve_artifact\
      \ \"DDOT\" \"${OMNIBUS_PACKAGE_DIR}datadog-agent-ddot-*${ARCH}.tar.xz\") || exit\
      \ 1\n    DDOT_EXTENSION_DIR=\"/tmp/ddot_extension_${ARCH}\"\n    mkdir -p \"${DDOT_EXTENSION_DIR}/etc\"\
      \n    echo \"Extracting DDOT ${DDOT_INPUT_FILE} -> ${DDOT_EXTENSION_DIR}\"\n \
      \   tar xJf \"${DDOT_INPUT_FILE}\" --strip-components=2 -C \"${DDOT_EXTENSION_DIR}\"\
      \ opt/\n    tar xJf \"${DDOT_INPUT_FILE}\" --strip-components=1 -C \"${DDOT_EXTENSION_DIR}/etc\"\
      \ etc/\n    EXTRA_FLAGS=\"--configs ${INPUT_DIR}/etc/datadog-agent --installer\
      \ ${INSTALLER_INPUT_DIR}/opt/datadog-packages/datadog-installer/${PACKAGE_VERSION}/bin/installer/installer\
      \ --extension ddot=${DDOT_EXTENSION_DIR}\"\n\n    # Extract DDOT FIPS \u2014 only\
      \ bundled into the FIPS variant manifest, not the base manifest\n    DDOT_FIPS_INPUT_FILE=$(resolve_artifact\
      \ \"DDOT FIPS\" \"${OMNIBUS_PACKAGE_DIR}datadog-fips-agent-ddot-*${ARCH}.tar.xz\"\
      ) || exit 1\n    DDOT_FIPS_EXTENSION_DIR=\"/tmp/ddot_fips_extension_${ARCH}\"\n\
      \    mkdir -p \"${DDOT_FIPS_EXTENSION_DIR}/etc\"\n    echo \"Extracting DDOT FIPS\
      \ ${DDOT_FIPS_INPUT_FILE} -> ${DDOT_FIPS_EXTENSION_DIR}\"\n    tar xJf \"${DDOT_FIPS_INPUT_FILE}\"\
      \ --strip-components=2 -C \"${DDOT_FIPS_EXTENSION_DIR}\" opt/\n    tar xJf \"\
      ${DDOT_FIPS_INPUT_FILE}\" --strip-components=1 -C \"${DDOT_FIPS_EXTENSION_DIR}/etc\"\
      \ etc/\n  fi\n  if [ \"${OCI_PRODUCT}\" = \"datadog-installer\" ]; then\n    EXTRA_FLAGS=\"\
      --installer ${INPUT_DIR}/${INSTALL_DIR}/bin/installer/installer\"\n  fi\n  if\
      \ [ \"${OCI_PRODUCT}\" = \"datadog-agent-ddot\" ]; then\n    EXTRA_FLAGS=\"--configs\
      \ ${INPUT_DIR}/etc/datadog-agent\"\n  fi\n  datadog-package create \\\n    --version\
      \ ${PACKAGE_VERSION} \\\n    --package ${OCI_PRODUCT} \\\n    --os linux \\\n\
      \    --arch ${ARCH} \\\n    --archive --archive-path \"${OUTPUT_DIR}/${OUTPUT_FILE}\"\
      \ \\\n    ${EXTRA_FLAGS} \\\n    ${INPUT_DIR}/${INSTALL_DIR}/\n\n  # Build the\
      \ FIPS-flavored variant (Platform.Variant=\"fips\") into the same OCI index.\n\
      \  # The installer selects this variant when DD_FIPS_MODE=true.\n  if [ \"${OCI_PRODUCT}\"\
      \ = \"datadog-agent\" ]; then\n    FIPS_INPUT_FILE=$(resolve_artifact \"FIPS agent\"\
      \ \"${OMNIBUS_PACKAGE_DIR}datadog-fips-agent-*${ARCH}.tar.xz\" \"ddot\") || exit\
      \ 1\n    FIPS_INPUT_DIR=\"/tmp/input_fips_${ARCH}\"\n  fi\n  if [ \"${OCI_PRODUCT}\"\
      \ = \"datadog-installer\" ]; then\n    FIPS_INPUT_FILE=$(resolve_artifact \"FIPS\
      \ installer\" \"${OMNIBUS_PACKAGE_DIR}datadog-fips-installer-*${ARCH}.tar.xz\"\
      ) || exit 1\n    FIPS_INPUT_DIR=\"/tmp/input_fips_installer_${ARCH}\"\n    FIPS_EXTRA_FLAGS=\"\
      --installer ${FIPS_INPUT_DIR}/${INSTALL_DIR}/bin/installer/installer\"\n  fi\n\
      \  if [ -n \"${FIPS_INPUT_FILE:-}\" ]; then\n    FIPS_OUTPUT_FILE=\"$(basename\
      \ -a -s .xz ${FIPS_INPUT_FILE})\"\n    mkdir -p ${FIPS_INPUT_DIR}\n    echo \"\
      Extracting FIPS ${FIPS_INPUT_FILE} -> ${FIPS_INPUT_DIR}\"\n    tar xJf ${FIPS_INPUT_FILE}\
      \ -C ${FIPS_INPUT_DIR}\n    if [ \"${OCI_PRODUCT}\" = \"datadog-agent\" ]; then\n\
-     \      # Bootstrap runs before unpacking the new Agent, so use the current Agent's\
-     \ FIPS libraries.\n      FIPS_INSTALLER_LAYER=\"${FIPS_INPUT_DIR}/installer.layer\"\
-     \n      # Patch a copy so the installed installer keeps its own library path.\n\
-     \      cp \"${FIPS_INPUT_DIR}/${INSTALL_DIR}/embedded/bin/installer\" \"${FIPS_INSTALLER_LAYER}\"\
-     \n      patchelf --set-rpath /opt/datadog-packages/datadog-agent/stable/embedded/lib\
-     \ \"${FIPS_INSTALLER_LAYER}\"\n      FIPS_EXTRA_FLAGS=\"--configs ${FIPS_INPUT_DIR}/etc/datadog-agent\
?      ------------------------------
+     \      FIPS_EXTRA_FLAGS=\"--configs ${FIPS_INPUT_DIR}/etc/datadog-agent --installer\
?                                                                            ++++++++++++
-     \ --installer ${FIPS_INSTALLER_LAYER} --extension ddot=${DDOT_FIPS_EXTENSION_DIR}\"\
+     \ ${FIPS_INPUT_DIR}/${INSTALL_DIR}/embedded/bin/installer --extension ddot=${DDOT_FIPS_EXTENSION_DIR}\"\
      \n    fi\n    echo \"Creating FIPS OCI layer -> ${OUTPUT_DIR}/${FIPS_OUTPUT_FILE}\"\
      \n    datadog-package create \\\n      --version ${PACKAGE_VERSION} \\\n     \
      \ --package ${OCI_PRODUCT} \\\n      --os linux \\\n      --arch ${ARCH} \\\n\
      \      --variant fips \\\n      --archive --archive-path \"${OUTPUT_DIR}/${FIPS_OUTPUT_FILE}\"\
      \ \\\n      ${FIPS_EXTRA_FLAGS} \\\n      ${FIPS_INPUT_DIR}/${INSTALL_DIR}/\n\
      \    rm -f ${FIPS_INPUT_FILE}\n  fi\n\n  rm -f ${INPUT_FILE}\n  if [ \"${OCI_PRODUCT}\"\
      \ = \"datadog-agent\" ]; then\n    rm -f ${INSTALLER_INPUT_FILE} ${DDOT_INPUT_FILE}\
      \ ${DDOT_FIPS_INPUT_FILE}\n  fi\ndone\n"
    - echo "Aggregating all layers into one package -> ${MERGED_FILE}"
    - ls -l ${OUTPUT_DIR}/
    - "# Keep base manifests first so older installers don't select FIPS by mistake.\n\
      BASE_ARCHIVES=()\nFIPS_ARCHIVES=()\nfor ARCHIVE in \"${OUTPUT_DIR}\"/*.tar; do\n\
      \  case \"$(basename \"${ARCHIVE}\")\" in\n    datadog-fips-*|*-fips.oci.tar)\
      \ FIPS_ARCHIVES+=(\"${ARCHIVE}\") ;;\n    *) BASE_ARCHIVES+=(\"${ARCHIVE}\") ;;\n\
      \  esac\ndone\ndatadog-package merge \"${BASE_ARCHIVES[@]}\" \"${FIPS_ARCHIVES[@]}\"\
      \n"
    - mv merged.tar ${OMNIBUS_PACKAGE_DIR}/${MERGED_FILE}
    stage: packaging
    tags:
    - arch:amd64
    - specific:true
    variables:
      INSTALL_DIR: /opt/datadog-agent
      KUBERNETES_CPU_REQUEST: 16
      KUBERNETES_MEMORY_LIMIT: 32Gi
      KUBERNETES_MEMORY_REQUEST: 32Gi
      OCI_PRODUCT: datadog-agent-ddot
installer_oci
  installer_oci:
    artifacts:
      paths:
      - ${OMNIBUS_PACKAGE_DIR}
    before_script:
    - PACKAGE_VERSION="$(dda inv agent.version --url-safe)-1" || exit $?
    - export INSTALL_DIR=${INSTALL_DIR:-/opt/datadog-packages/${OCI_PRODUCT}/${PACKAGE_VERSION}}
    - set +x
    image: registry.ddbuild.io/ci/datadog-agent-buildimages/linux$CI_IMAGE_LINUX_SUFFIX:$CI_IMAGE_LINUX
    needs:
    - setup_agent_version
    - installer-arm64-oci
    - installer-amd64-oci
    - installer-fips-arm64-oci
    - installer-fips-amd64-oci
    - go_tools_deps
    rules:
    - if: $CI_COMMIT_BRANCH =~ /^mq-working-branch-/ || ($GIT_BASE_BRANCH != null &&
        $GIT_BASE_BRANCH != "main" && $GIT_BASE_BRANCH !~ /^[67]\.[0-9]+\.x$/)
      when: never
    - when: on_success
    script:
    - "go_bin=\"$(go env GOBIN)\"\nif [ -z \"$go_bin\" ]; then\n  go_bin=\"$(go env\
      \ GOPATH)/bin\"\nfi\nmkdir -p \"$go_bin\" \"$GOPATH/pkg/mod/cache\"\nzstd -dc\
      \ go_tools_bin.tar.zst | tar xf - -C \"$go_bin\"\nzstd -dc modcache_tools.tar.zst\
      \ | tar xf - -C \"$GOPATH/pkg/mod/cache\"\n"
    - rm -f go_tools_bin.tar.zst modcache_tools.tar.zst
    - export PATH=$PATH:$go_bin
    - rm -f $OMNIBUS_PACKAGE_DIR/*-dbg-*.tar.xz
    - ls -l $OMNIBUS_PACKAGE_DIR
    - export PATH="$PATH:$(go env GOPATH)/bin"
    - dda self dep sync -f legacy-tasks
    - OUTPUT_DIR="/tmp/oci_output"
    - mkdir -p ${OUTPUT_DIR}
    - ls $OMNIBUS_PACKAGE_DIR
    - "if [ $(ls $OMNIBUS_PACKAGE_DIR/pipeline-$CI_PIPELINE_ID/*.oci.tar 2> /dev/null\
      \ | wc -l) -ge 1 ]; then\n  echo \"Copying already built images to output dir\"\
      \n  cp $OMNIBUS_PACKAGE_DIR/pipeline-$CI_PIPELINE_ID/*.oci.tar ${OUTPUT_DIR}\n\
      fi\n"
    - "# Resolve a glob pattern to a single file path, printed on stdout.\n# Prints\
      \ a warning to stderr if more than one file matches.\n# Usage: resolve_artifact\
      \ LABEL PATTERN [EXCLUDE]\n#   LABEL:   human-readable name for warning messages\n\
      #   PATTERN: glob string; pass it quoted to prevent expansion at the call site\
      \ \u2014 ls receives it unquoted inside the function\n#   EXCLUDE: optional grep\
      \ -v filter (e.g. \"ddot\" to exclude ddot files)\n# Returns 0 and prints the\
      \ path if a file was found, returns 1 if not.\nresolve_artifact() {\n  local label=\"\
      $1\" pattern=\"$2\" exclude=\"${3:-}\"\n  local matches first count\n  if [ -n\
      \ \"${exclude}\" ]; then\n    matches=$(ls ${pattern} 2>/dev/null | grep -v \"\
      ${exclude}\" || true)\n  else\n    matches=$(ls ${pattern} 2>/dev/null || true)\n\
      \  fi\n  if [ -z \"${matches}\" ]; then\n    echo \"ERROR: ${label} artifact not\
      \ found (pattern: ${pattern})\" >&2\n    return 1\n  fi\n  count=$(echo \"${matches}\"\
      \ | wc -l)\n  first=$(echo \"${matches}\" | head -1)\n  if [ \"${count}\" -gt\
      \ 1 ]; then\n    echo \"WARNING: multiple ${label} artifacts found, using ${first}\"\
      \ >&2\n  fi\n  echo \"${first}\"\n}\nfor ARCH in \"amd64\" \"arm64\"; do\n  if\
      \ [ \"${OCI_PRODUCT}\" = \"datadog-agent\" ]; then\n    # For the main agent,\
      \ exclude DDOT files since DDOT is bundled as an extension\n    INPUT_FILE=$(resolve_artifact\
      \ \"agent\" \"${OMNIBUS_PACKAGE_DIR}${OCI_PRODUCT}-*${ARCH}.tar.xz\" \"ddot\"\
      ) || exit 1\n  else\n    # For other products (like datadog-agent-ddot), don't\
      \ filter\n    INPUT_FILE=$(resolve_artifact \"${OCI_PRODUCT}\" \"${OMNIBUS_PACKAGE_DIR}${OCI_PRODUCT}-*${ARCH}.tar.xz\"\
      ) || exit 1\n  fi\n  OUTPUT_FILE=\"$(basename -a -s .xz ${INPUT_FILE})\"\n  MERGED_FILE=$(basename\
      \ \"${INPUT_FILE}\" | sed \"s/-${ARCH}.tar.xz//\").oci.tar\n  export MERGED_FILE\n\
      \  INPUT_DIR=\"/tmp/input_${ARCH}\"\n  mkdir -p ${INPUT_DIR}\n  echo \"Generating\
      \ OCI for $ARCH.\"\n  echo \"Extracting to temporary input dir $INPUT_FILE ->\
      \ $INPUT_DIR\"\n  tar xJf ${INPUT_FILE} -C ${INPUT_DIR}\n  echo \"Creating OCI\
      \ layer -> ${OUTPUT_DIR}/${OUTPUT_FILE}\"\n  if [ \"${OCI_PRODUCT}\" = \"datadog-agent\"\
      \ ]; then\n    INSTALLER_INPUT_FILE=$(resolve_artifact \"installer\" \"${OMNIBUS_PACKAGE_DIR}datadog-installer-*${ARCH}.tar.xz\"\
      ) || exit 1\n    INSTALLER_INPUT_DIR=\"/tmp/input_installer_${ARCH}\"\n    mkdir\
      \ -p ${INSTALLER_INPUT_DIR}\n    echo \"Extracting installer to temporary input\
      \ dir $INSTALLER_INPUT_FILE -> $INSTALLER_INPUT_DIR\"\n    tar xJf ${INSTALLER_INPUT_FILE}\
      \ -C ${INSTALLER_INPUT_DIR}\n\n    # Extract DDOT\n    DDOT_INPUT_FILE=$(resolve_artifact\
      \ \"DDOT\" \"${OMNIBUS_PACKAGE_DIR}datadog-agent-ddot-*${ARCH}.tar.xz\") || exit\
      \ 1\n    DDOT_EXTENSION_DIR=\"/tmp/ddot_extension_${ARCH}\"\n    mkdir -p \"${DDOT_EXTENSION_DIR}/etc\"\
      \n    echo \"Extracting DDOT ${DDOT_INPUT_FILE} -> ${DDOT_EXTENSION_DIR}\"\n \
      \   tar xJf \"${DDOT_INPUT_FILE}\" --strip-components=2 -C \"${DDOT_EXTENSION_DIR}\"\
      \ opt/\n    tar xJf \"${DDOT_INPUT_FILE}\" --strip-components=1 -C \"${DDOT_EXTENSION_DIR}/etc\"\
      \ etc/\n    EXTRA_FLAGS=\"--configs ${INPUT_DIR}/etc/datadog-agent --installer\
      \ ${INSTALLER_INPUT_DIR}/opt/datadog-packages/datadog-installer/${PACKAGE_VERSION}/bin/installer/installer\
      \ --extension ddot=${DDOT_EXTENSION_DIR}\"\n\n    # Extract DDOT FIPS \u2014 only\
      \ bundled into the FIPS variant manifest, not the base manifest\n    DDOT_FIPS_INPUT_FILE=$(resolve_artifact\
      \ \"DDOT FIPS\" \"${OMNIBUS_PACKAGE_DIR}datadog-fips-agent-ddot-*${ARCH}.tar.xz\"\
      ) || exit 1\n    DDOT_FIPS_EXTENSION_DIR=\"/tmp/ddot_fips_extension_${ARCH}\"\n\
      \    mkdir -p \"${DDOT_FIPS_EXTENSION_DIR}/etc\"\n    echo \"Extracting DDOT FIPS\
      \ ${DDOT_FIPS_INPUT_FILE} -> ${DDOT_FIPS_EXTENSION_DIR}\"\n    tar xJf \"${DDOT_FIPS_INPUT_FILE}\"\
      \ --strip-components=2 -C \"${DDOT_FIPS_EXTENSION_DIR}\" opt/\n    tar xJf \"\
      ${DDOT_FIPS_INPUT_FILE}\" --strip-components=1 -C \"${DDOT_FIPS_EXTENSION_DIR}/etc\"\
      \ etc/\n  fi\n  if [ \"${OCI_PRODUCT}\" = \"datadog-installer\" ]; then\n    EXTRA_FLAGS=\"\
      --installer ${INPUT_DIR}/${INSTALL_DIR}/bin/installer/installer\"\n  fi\n  if\
      \ [ \"${OCI_PRODUCT}\" = \"datadog-agent-ddot\" ]; then\n    EXTRA_FLAGS=\"--configs\
      \ ${INPUT_DIR}/etc/datadog-agent\"\n  fi\n  datadog-package create \\\n    --version\
      \ ${PACKAGE_VERSION} \\\n    --package ${OCI_PRODUCT} \\\n    --os linux \\\n\
      \    --arch ${ARCH} \\\n    --archive --archive-path \"${OUTPUT_DIR}/${OUTPUT_FILE}\"\
      \ \\\n    ${EXTRA_FLAGS} \\\n    ${INPUT_DIR}/${INSTALL_DIR}/\n\n  # Build the\
      \ FIPS-flavored variant (Platform.Variant=\"fips\") into the same OCI index.\n\
      \  # The installer selects this variant when DD_FIPS_MODE=true.\n  if [ \"${OCI_PRODUCT}\"\
      \ = \"datadog-agent\" ]; then\n    FIPS_INPUT_FILE=$(resolve_artifact \"FIPS agent\"\
      \ \"${OMNIBUS_PACKAGE_DIR}datadog-fips-agent-*${ARCH}.tar.xz\" \"ddot\") || exit\
      \ 1\n    FIPS_INPUT_DIR=\"/tmp/input_fips_${ARCH}\"\n  fi\n  if [ \"${OCI_PRODUCT}\"\
      \ = \"datadog-installer\" ]; then\n    FIPS_INPUT_FILE=$(resolve_artifact \"FIPS\
      \ installer\" \"${OMNIBUS_PACKAGE_DIR}datadog-fips-installer-*${ARCH}.tar.xz\"\
      ) || exit 1\n    FIPS_INPUT_DIR=\"/tmp/input_fips_installer_${ARCH}\"\n    FIPS_EXTRA_FLAGS=\"\
      --installer ${FIPS_INPUT_DIR}/${INSTALL_DIR}/bin/installer/installer\"\n  fi\n\
      \  if [ -n \"${FIPS_INPUT_FILE:-}\" ]; then\n    FIPS_OUTPUT_FILE=\"$(basename\
      \ -a -s .xz ${FIPS_INPUT_FILE})\"\n    mkdir -p ${FIPS_INPUT_DIR}\n    echo \"\
      Extracting FIPS ${FIPS_INPUT_FILE} -> ${FIPS_INPUT_DIR}\"\n    tar xJf ${FIPS_INPUT_FILE}\
      \ -C ${FIPS_INPUT_DIR}\n    if [ \"${OCI_PRODUCT}\" = \"datadog-agent\" ]; then\n\
-     \      # Bootstrap runs before unpacking the new Agent, so use the current Agent's\
-     \ FIPS libraries.\n      FIPS_INSTALLER_LAYER=\"${FIPS_INPUT_DIR}/installer.layer\"\
-     \n      # Patch a copy so the installed installer keeps its own library path.\n\
-     \      cp \"${FIPS_INPUT_DIR}/${INSTALL_DIR}/embedded/bin/installer\" \"${FIPS_INSTALLER_LAYER}\"\
-     \n      patchelf --set-rpath /opt/datadog-packages/datadog-agent/stable/embedded/lib\
-     \ \"${FIPS_INSTALLER_LAYER}\"\n      FIPS_EXTRA_FLAGS=\"--configs ${FIPS_INPUT_DIR}/etc/datadog-agent\
?      ------------------------------
+     \      FIPS_EXTRA_FLAGS=\"--configs ${FIPS_INPUT_DIR}/etc/datadog-agent --installer\
?                                                                            ++++++++++++
-     \ --installer ${FIPS_INSTALLER_LAYER} --extension ddot=${DDOT_FIPS_EXTENSION_DIR}\"\
+     \ ${FIPS_INPUT_DIR}/${INSTALL_DIR}/embedded/bin/installer --extension ddot=${DDOT_FIPS_EXTENSION_DIR}\"\
      \n    fi\n    echo \"Creating FIPS OCI layer -> ${OUTPUT_DIR}/${FIPS_OUTPUT_FILE}\"\
      \n    datadog-package create \\\n      --version ${PACKAGE_VERSION} \\\n     \
      \ --package ${OCI_PRODUCT} \\\n      --os linux \\\n      --arch ${ARCH} \\\n\
      \      --variant fips \\\n      --archive --archive-path \"${OUTPUT_DIR}/${FIPS_OUTPUT_FILE}\"\
      \ \\\n      ${FIPS_EXTRA_FLAGS} \\\n      ${FIPS_INPUT_DIR}/${INSTALL_DIR}/\n\
      \    rm -f ${FIPS_INPUT_FILE}\n  fi\n\n  rm -f ${INPUT_FILE}\n  if [ \"${OCI_PRODUCT}\"\
      \ = \"datadog-agent\" ]; then\n    rm -f ${INSTALLER_INPUT_FILE} ${DDOT_INPUT_FILE}\
      \ ${DDOT_FIPS_INPUT_FILE}\n  fi\ndone\n"
    - echo "Aggregating all layers into one package -> ${MERGED_FILE}"
    - ls -l ${OUTPUT_DIR}/
    - "# Keep base manifests first so older installers don't select FIPS by mistake.\n\
      BASE_ARCHIVES=()\nFIPS_ARCHIVES=()\nfor ARCHIVE in \"${OUTPUT_DIR}\"/*.tar; do\n\
      \  case \"$(basename \"${ARCHIVE}\")\" in\n    datadog-fips-*|*-fips.oci.tar)\
      \ FIPS_ARCHIVES+=(\"${ARCHIVE}\") ;;\n    *) BASE_ARCHIVES+=(\"${ARCHIVE}\") ;;\n\
      \  esac\ndone\ndatadog-package merge \"${BASE_ARCHIVES[@]}\" \"${FIPS_ARCHIVES[@]}\"\
      \n"
    - mv merged.tar ${OMNIBUS_PACKAGE_DIR}/${MERGED_FILE}
    stage: packaging
    tags:
    - arch:amd64
    - specific:true
    variables:
      KUBERNETES_CPU_REQUEST: 16
      KUBERNETES_MEMORY_LIMIT: 32Gi
      KUBERNETES_MEMORY_REQUEST: 32Gi
      OCI_PRODUCT: datadog-installer

Changes Summary

Removed Modified Added Renamed
0 4 0 0

ℹ️ Diff available in the job log.

@DataDog DataDog deleted a comment from dd-octo-sts Bot Oct 23, 2026
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit b24be0b into main Oct 23, 2026
531 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the regis.desgroppes/explore-ms-nocgo-opensslcrypto branch October 23, 2026 17:43
@github-actions github-actions Bot added this to the 7.86.0 milestone Oct 23, 2026
rdesgroppes added a commit that referenced this pull request Nov 11, 2026
### What does this PR do?

Request FIPS builds with
`--platforms=//bazel/platforms:<os>_<arch>_fips`, whose `flags` select
the `msgo` SDK, instead of the retired `fips` value of
`//packages/agent:flavor`.
Key the FIPS `config_setting`s, `@openssl`'s and the FIPS package names
on the `//bazel/platforms:fips` constraint, and have the omnibus helpers
pass the FIPS platform.
Register a test toolchain so that `bazel test` works on FIPS platforms,
and remove the unused macOS FIPS platforms.
This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS
binaries load, nor lifting the #59511 refusal, which depends on it.

### Motivation

The FIPS platforms' constraint selected nothing, and the `fips` flavor
selected the FIPS tags but kept the upstream SDK, both silently
producing non-FIPS binaries, which #59511 had to refuse.
Since #58511 made `msgo` a toolchain, a platform can carry both the
constraint and the SDK choice.

### Describe how you validated your changes

- `//cmd/agent` builds with `msgo` and the FIPS tags on the FIPS
  platforms, `requirefips` being Linux-only, and with the upstream SDK
  and no FIPS tags on the others,
- the agent, installer, loader and packaging targets, and `@openssl`,
  analyze with no ambiguous `select()` on the Linux and Windows
  platforms, FIPS or not,
- `bazel test` passes on a FIPS platform.

### Additional Notes

The FIPS platforms set `sdk_name` through `platform(flags = ...)`,
because deriving it from the constraint would take patching rules_go's
`go_transition` or duplicating its `toolchain()` matrix.
The retired flavor value now fails the analysis of packaging targets.
Prerequisites:
- #56351
- #56865
- #57078
- #57223
- #58511
- #58530
- #59501
- #59511
- #59840
- #59871
- #59875
- #60181
rdesgroppes added a commit that referenced this pull request Nov 11, 2026
### What does this PR do?

Request FIPS builds with
`--platforms=//bazel/platforms:<os>_<arch>_fips`, whose `flags` select
the `msgo` SDK, instead of the retired `fips` value of
`//packages/agent:flavor`.
Key the FIPS `config_setting`s, `@openssl`'s and the FIPS package names
on the `//bazel/platforms:fips` constraint, and have the omnibus helpers
pass the FIPS platform.
Register a test toolchain so that `bazel test` works on FIPS platforms,
and remove the unused macOS FIPS platforms.
This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS
binaries load, nor lifting the #59511 refusal, which depends on it.

### Motivation

The FIPS platforms' constraint selected nothing, and the `fips` flavor
selected the FIPS tags but kept the upstream SDK, both silently
producing non-FIPS binaries, which #59511 had to refuse.
Since #58511 made `msgo` a toolchain, a platform can carry both the
constraint and the SDK choice.

### Describe how you validated your changes

- `//cmd/agent` builds with `msgo` and the FIPS tags on the FIPS
  platforms, `requirefips` being Linux-only, and with the upstream SDK
  and no FIPS tags on the others,
- the agent, installer, loader and packaging targets, and `@openssl`,
  analyze with no ambiguous `select()` on the Linux and Windows
  platforms, FIPS or not,
- `bazel test` passes on a FIPS platform.

### Additional Notes

The FIPS platforms set `sdk_name` through `platform(flags = ...)`,
because deriving it from the constraint would take patching rules_go's
`go_transition` or duplicating its `toolchain()` matrix.
The retired flavor value now fails the analysis of packaging targets.
`//cmd/dogstatsd` drops its `cgo` select, whose FIPS branch was a no-op,
leaving `dd_agent_go_binary`'s identical default.
Prerequisites:
- #56351
- #56865
- #57078
- #57223
- #58511
- #58530
- #59501
- #59511
- #59840
- #59871
- #59875
- #60181
rdesgroppes added a commit that referenced this pull request Nov 11, 2026
### What does this PR do?

Request FIPS builds with
`--platforms=//bazel/platforms:<os>_<arch>_fips`, whose `flags` select
the `msgo` SDK, instead of the retired `fips` value of
`//packages/agent:flavor`.
Key the FIPS `config_setting`s, `@openssl`'s and the FIPS package names
on the `//bazel/platforms:fips` constraint, and have the omnibus helpers
pass the FIPS platform.
Register a test toolchain so that `bazel test` works on FIPS platforms,
and remove the unused macOS FIPS platforms.
This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS
binaries load, nor lifting the #59511 refusal, which depends on it.

### Motivation

The FIPS platforms' constraint selected nothing, and the `fips` flavor
selected the FIPS tags but kept the upstream SDK, both silently
producing non-FIPS binaries, which #59511 had to refuse.
Since #58511 made `msgo` a toolchain, a platform can carry both the
constraint and the SDK choice.

### Describe how you validated your changes

- `//cmd/agent` builds with `msgo` and the FIPS tags on the FIPS
  platforms, `requirefips` being Linux-only, and with the upstream SDK
  and no FIPS tags on the others,
- the agent, installer, loader and packaging targets, and `@openssl`,
  analyze with no ambiguous `select()` on the Linux and Windows
  platforms, FIPS or not,
- `bazel test` passes on a FIPS platform.

### Additional Notes

The FIPS platforms set `sdk_name` through `platform(flags = ...)`,
because deriving it from the constraint would take patching rules_go's
`go_transition` or duplicating its `toolchain()` matrix.
The retired flavor value now fails the analysis of packaging targets.
`//cmd/dogstatsd` drops its `cgo` select, whose FIPS branch was a no-op,
leaving `dd_agent_go_binary`'s identical default.
Prerequisites:
- #56351
- #56865
- #57078
- #57223
- #58511
- #58530
- #59501
- #59511
- #59840
- #59871
- #59875
- #60181
rdesgroppes added a commit that referenced this pull request Nov 11, 2026
### What does this PR do?

Request FIPS builds with
`--platforms=//bazel/platforms:<os>_<arch>_fips`, whose `flags` select
the `msgo` SDK, instead of the retired `fips` value of
`//packages/agent:flavor`.
Key the FIPS `config_setting`s, `@openssl`'s and the FIPS package names
on the `//bazel/platforms:fips` constraint, and have the omnibus helpers
pass the FIPS platform.
Register a test toolchain so that `bazel test` works on FIPS platforms,
and remove the unused macOS FIPS platforms.
Have the installer's symbol test require `msgo`'s OpenSSL or CNG
backend on the Linux or Windows FIPS platforms, and reject it elsewhere.
This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS
binaries load, nor lifting the #59511 refusal, which depends on it.

### Motivation

The FIPS platforms' constraint selected nothing, and the `fips` flavor
selected the FIPS tags but kept the upstream SDK, both silently
producing non-FIPS binaries, which #59511 had to refuse.
Since #58511 made `msgo` a toolchain, a platform can carry both the
constraint and the SDK choice.

### Describe how you validated your changes

- `//cmd/agent` builds with `msgo` and the FIPS tags on the FIPS
  platforms, `requirefips` being Linux-only, and with the upstream SDK
  and no FIPS tags on the others,
- the agent, installer, loader and packaging targets, and `@openssl`,
  analyze with no ambiguous `select()` on the Linux and Windows
  platforms, FIPS or not,
- `bazel test` passes on a FIPS platform,
- the installer's symbol test passes on the Linux and Windows FIPS
  platforms, and fails when expecting a package the binary lacks.

### Additional Notes

The FIPS platforms set `sdk_name` through `platform(flags = ...)`,
because deriving it from the constraint would take patching rules_go's
`go_transition` or duplicating its `toolchain()` matrix.
The retired flavor value now fails the analysis of packaging targets.
`//cmd/dogstatsd` drops its `cgo` select, whose FIPS branch was a no-op,
leaving `dd_agent_go_binary`'s identical default.
`//cmd/loader:trace_loader_all_files` only excludes Windows, like
`:loader`, instead of listing Linux and macOS.
Prerequisites:
- #56351
- #56865
- #57078
- #57223
- #58511
- #58530
- #59501
- #59511
- #59840
- #59871
- #59875
- #60181
rdesgroppes added a commit that referenced this pull request Nov 11, 2026
### What does this PR do?

Request FIPS builds with
`--platforms=//bazel/platforms:<os>_<arch>_fips`, whose `flags` select
the `msgo` SDK, instead of the retired `fips` value of
`//packages/agent:flavor`.
Key the FIPS `config_setting`s, `@openssl`'s and the FIPS package names
on the `//bazel/platforms:fips` constraint, and have the omnibus helpers
pass the FIPS platform.
Register a test toolchain so that `bazel test` works on FIPS platforms,
and remove the unused macOS FIPS platforms.
Have the installer's symbol test require `msgo`'s OpenSSL or CNG
backend on the Linux or Windows FIPS platforms, and reject it elsewhere.
This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS
binaries load, nor lifting the #59511 refusal, which depends on it.

### Motivation

The FIPS platforms' constraint selected nothing, and the `fips` flavor
selected the FIPS tags but kept the upstream SDK, both silently
producing non-FIPS binaries, which #59511 had to refuse.
Since #58511 made `msgo` a toolchain, a platform can carry both the
constraint and the SDK choice.

### Describe how you validated your changes

- `//cmd/agent` builds with `msgo` and the FIPS tags on the FIPS
  platforms, `requirefips` being Linux-only, and with the upstream SDK
  and no FIPS tags on the others,
- the agent, installer, loader and packaging targets, and `@openssl`,
  analyze with no ambiguous `select()` on the Linux and Windows
  platforms, FIPS or not,
- `bazel test` passes on a FIPS platform,
- the installer's symbol test passes on the Linux and Windows FIPS
  platforms, and fails when expecting a package the binary lacks.

### Additional Notes

The FIPS platforms set `sdk_name` through `platform(flags = ...)`,
because deriving it from the constraint would take patching rules_go's
`go_transition` or duplicating its `toolchain()` matrix.
The retired flavor value now fails the analysis of packaging targets.
`//cmd/dogstatsd` drops its `cgo` select, whose FIPS branch was a no-op,
leaving `dd_agent_go_binary`'s identical default.
`//cmd/loader:trace_loader_all_files` only excludes Windows, like
`:loader`, instead of listing Linux and macOS.
Prerequisites:
- #56351
- #56865
- #57078
- #57223
- #58511
- #58530
- #59501
- #59511
- #59840
- #59871
- #59875
- #60181
rdesgroppes added a commit that referenced this pull request Nov 11, 2026
### What does this PR do?

Request FIPS builds with
`--platforms=//bazel/platforms:<os>_<arch>_fips`, whose `flags` select
the `msgo` SDK, instead of the retired `fips` value of
`//packages/agent:flavor`.
Key the FIPS `config_setting`s, `@openssl`'s and the FIPS package names
on the `//bazel/platforms:fips` constraint, and have the omnibus helpers
pass the FIPS platform.
Register a test toolchain so that `bazel test` works on FIPS platforms,
and remove the unused macOS FIPS platforms.
Have the installer's symbol test require `msgo`'s OpenSSL or CNG
backend on the Linux or Windows FIPS platforms, and reject it elsewhere.
This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS
binaries load, nor lifting the #59511 refusal, which depends on it.

### Motivation

The FIPS platforms' constraint selected nothing, and the `fips` flavor
selected the FIPS tags but kept the upstream SDK, both silently
producing non-FIPS binaries, which #59511 had to refuse.
Since #58511 made `msgo` a toolchain, a platform can carry both the
constraint and the SDK choice.

### Describe how you validated your changes

- `//cmd/agent` builds with `msgo` and the FIPS tags on the FIPS
  platforms, `requirefips` being Linux-only, and with the upstream SDK
  and no FIPS tags on the others,
- the agent, installer, loader and packaging targets, and `@openssl`,
  analyze with no ambiguous `select()` on the Linux and Windows
  platforms, FIPS or not,
- `bazel test` passes on a FIPS platform,
- the installer's symbol test passes on the Linux and Windows FIPS
  platforms, and fails when expecting a package the binary lacks.

### Additional Notes

The FIPS platforms set `sdk_name` through `platform(flags = ...)`,
because deriving it from the constraint would take patching rules_go's
`go_transition` or duplicating its `toolchain()` matrix.
The retired flavor value now fails the analysis of packaging targets.
`//cmd/dogstatsd` drops its `cgo` select, whose FIPS branch was a no-op,
leaving `dd_agent_go_binary`'s identical default.
`//cmd/loader:trace_loader_all_files` only excludes Windows, like
`:loader`, instead of listing Linux and macOS.
Prerequisites:
- #56351
- #56865
- #57078
- #57223
- #58511
- #58530
- #59501
- #59511
- #59840
- #59871
- #59875
- #60181
rdesgroppes added a commit that referenced this pull request Nov 11, 2026
### What does this PR do?

Request FIPS builds with
`--platforms=//bazel/platforms:<os>_<arch>_fips`, whose `flags` select
the `msgo` SDK, instead of the retired `fips` value of
`//packages/agent:flavor`.
Key the FIPS `config_setting`s, `@openssl`'s and the FIPS package names
on the `//bazel/platforms:fips` constraint, and have the omnibus helpers
pass the FIPS platform.
Register a test toolchain so that `bazel test` works on FIPS platforms,
and remove the unused macOS FIPS platforms.
Have the installer's symbol test require `msgo`'s OpenSSL or CNG
backend on the Linux or Windows FIPS platforms, and reject it elsewhere.
This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS
binaries load, nor lifting the #59511 refusal, which depends on it.

### Motivation

The FIPS platforms' constraint selected nothing, and the `fips` flavor
selected the FIPS tags but kept the upstream SDK, both silently
producing non-FIPS binaries, which #59511 had to refuse.
Since #58511 made `msgo` a toolchain, a platform can carry both the
constraint and the SDK choice.

### Describe how you validated your changes

- `//cmd/agent` builds with `msgo` and the FIPS tags on the FIPS
  platforms, `requirefips` being Linux-only, and with the upstream SDK
  and no FIPS tags on the others,
- the agent, installer, loader and packaging targets, and `@openssl`,
  analyze with no ambiguous `select()` on the Linux and Windows
  platforms, FIPS or not,
- `bazel test` passes on a FIPS platform,
- the installer's symbol test passes on the Linux and Windows FIPS
  platforms, and fails when expecting a package the binary lacks.

### Additional Notes

The FIPS platforms set `sdk_name` through `platform(flags = ...)`,
because deriving it from the constraint would take patching rules_go's
`go_transition` or duplicating its `toolchain()` matrix.
The retired flavor value now fails the analysis of packaging targets.
`//cmd/dogstatsd` drops its `cgo` select, whose FIPS branch was a no-op,
leaving `dd_agent_go_binary`'s identical default.
`//cmd/loader:trace_loader_all_files` only excludes Windows, like
`:loader`, instead of listing Linux and macOS.
Prerequisites:
- #56351
- #56865
- #57078
- #57223
- #58511
- #58530
- #59501
- #59511
- #59840
- #59871
- #59875
- #60181
rdesgroppes added a commit that referenced this pull request Nov 11, 2026
### What does this PR do?

Request FIPS builds with
`--platforms=//bazel/platforms:<os>_<arch>_fips`, whose `flags` select
the `msgo` SDK, instead of the retired `fips` value of
`//packages/agent:flavor`.
Key the FIPS `config_setting`s, `@openssl`'s and the FIPS package names
on the `//bazel/platforms:fips` constraint, and have the omnibus helpers
pass the FIPS platform.
Register a test toolchain so that `bazel test` works on FIPS platforms,
and remove the unused macOS FIPS platforms.
Have the installer's symbol test require `msgo`'s OpenSSL or CNG
backend on the Linux or Windows FIPS platforms, and reject it elsewhere.
This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS
binaries load, nor lifting the #59511 refusal, which depends on it.

### Motivation

The FIPS platforms' constraint selected nothing, and the `fips` flavor
selected the FIPS tags but kept the upstream SDK, both silently
producing non-FIPS binaries, which #59511 had to refuse.
Since #58511 made `msgo` a toolchain, a platform can carry both the
constraint and the SDK choice.

### Describe how you validated your changes

- `//cmd/agent` builds with `msgo` and the FIPS tags on the FIPS
  platforms, `requirefips` being Linux-only, and with the upstream SDK
  and no FIPS tags on the others,
- the agent, installer, loader and packaging targets, and `@openssl`,
  analyze with no ambiguous `select()` on the Linux and Windows
  platforms, FIPS or not,
- `bazel test` passes on a FIPS platform,
- the installer's symbol test passes on the Linux and Windows FIPS
  platforms, and fails when expecting a package the binary lacks.

### Additional Notes

The FIPS platforms set `sdk_name` through `platform(flags = ...)`,
because deriving it from the constraint would take patching rules_go's
`go_transition` or duplicating its `toolchain()` matrix.
The retired flavor value now fails the analysis of packaging targets.
`//cmd/dogstatsd` drops its `cgo` select, whose FIPS branch was a no-op,
leaving `dd_agent_go_binary`'s identical default.
`//cmd/loader:trace_loader_all_files` only excludes Windows, like
`:loader`, instead of listing Linux and macOS.
Prerequisites:
- #56351
- #56865
- #57078
- #57223
- #58511
- #58530
- #59501
- #59511
- #59840
- #59871
- #59875
- #60181
rdesgroppes added a commit that referenced this pull request Nov 11, 2026
### What does this PR do?

Request FIPS builds with
`--platforms=//bazel/platforms:<os>_<arch>_fips`, whose `flags` select
the `msgo` SDK, instead of the retired `fips` value of
`//packages/agent:flavor`.
Key the FIPS `config_setting`s, `@openssl`'s and the FIPS package names
on the `//bazel/platforms:fips` constraint, and have the omnibus helpers
pass the FIPS platform.
Register a test toolchain so that `bazel test` works on FIPS platforms,
and remove the unused macOS FIPS platforms.
Have the installer's symbol test require `msgo`'s OpenSSL or CNG
backend on the Linux or Windows FIPS platforms, and reject it elsewhere.
This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS
binaries load, nor lifting the #59511 refusal, which depends on it.

### Motivation

The FIPS platforms' constraint selected nothing, and the `fips` flavor
selected the FIPS tags but kept the upstream SDK, both silently
producing non-FIPS binaries, which #59511 had to refuse.
Since #58511 made `msgo` a toolchain, a platform can carry both the
constraint and the SDK choice.

### Describe how you validated your changes

- `//cmd/agent` builds with `msgo` and the FIPS tags on the FIPS
  platforms, `requirefips` being Linux-only, and with the upstream SDK
  and no FIPS tags on the others,
- the agent, installer, loader and packaging targets, and `@openssl`,
  analyze with no ambiguous `select()` on the Linux and Windows
  platforms, FIPS or not,
- `bazel test` passes on a FIPS platform,
- the installer's symbol test passes on the Linux and Windows FIPS
  platforms, and fails when expecting a package the binary lacks.

### Additional Notes

The FIPS platforms set `sdk_name` through `platform(flags = ...)`,
because deriving it from the constraint would take patching rules_go's
`go_transition` or duplicating its `toolchain()` matrix.
The retired flavor value now fails the analysis of packaging targets.
`//cmd/dogstatsd` drops its `cgo` select, whose FIPS branch was a no-op,
leaving `dd_agent_go_binary`'s identical default.
`//cmd/loader:trace_loader_all_files` only excludes Windows, like
`:loader`, instead of listing Linux and macOS.
Prerequisites:
- #56351
- #56865
- #57078
- #57223
- #58511
- #58530
- #59501
- #59511
- #59840
- #59871
- #59875
- #60181
rdesgroppes added a commit that referenced this pull request Nov 11, 2026
### What does this PR do?

Request FIPS builds with
`--platforms=//bazel/platforms:<os>_<cpu>_fips`, whose `flags` select
the `msgo` SDK, instead of the retired `fips` value of
`//packages/agent:flavor`.
Key the FIPS `config_setting`s, `@openssl`'s and the FIPS package names
on the `//bazel/platforms:fips` constraint, and have the omnibus helpers
pass the FIPS platform.
Register a test toolchain so that `bazel test` works on FIPS platforms,
and remove the unused macOS FIPS platforms.
Have the installer's symbol test require `msgo`'s OpenSSL or CNG
backend on the Linux or Windows FIPS platforms, and reject it elsewhere.
This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS
binaries load, nor lifting the #59511 refusal, which depends on it.

### Motivation

The FIPS platforms' constraint selected nothing, and the `fips` flavor
selected the FIPS tags but kept the upstream SDK, both silently
producing non-FIPS binaries, which #59511 had to refuse.
Since #58511 made `msgo` a toolchain, a platform can carry both the
constraint and the SDK choice.

### Describe how you validated your changes

- `//cmd/agent` builds with `msgo` and the FIPS tags on the FIPS
  platforms, `requirefips` being Linux-only, and with the upstream SDK
  and no FIPS tags on the others,
- the agent, installer, loader and packaging targets, and `@openssl`,
  analyze with no ambiguous `select()` on the Linux and Windows
  platforms, FIPS or not,
- `bazel test` passes on a FIPS platform,
- the installer's symbol test passes on the Linux and Windows FIPS
  platforms, and fails when expecting a package the binary lacks.

### Additional Notes

The FIPS platforms set `sdk_name` through `platform(flags = ...)`,
because deriving it from the constraint would take patching rules_go's
`go_transition` or duplicating its `toolchain()` matrix.
The retired flavor value now fails the analysis of packaging targets.
`//cmd/dogstatsd` drops its `cgo` select, whose FIPS branch was a no-op,
#58511's `msgo` SDK building its OpenSSL backend without cgo through
`ms_nocgo_opensslcrypto`, the default of `msgo` 1.27
(https://devblogs.microsoft.com/go/go-1-27-0-1-microsoft-build-now-available/),
leaving `dd_agent_go_binary`'s identical default.
`//cmd/loader:trace_loader_all_files` only excludes Windows, like
`:loader`, instead of listing Linux and macOS.
Prerequisites:
- #56351
- #56865
- #57078
- #57223
- #58511
- #58530
- #59501
- #59511
- #59840
- #59871
- #59875
- #60181
rdesgroppes added a commit that referenced this pull request Nov 11, 2026
### What does this PR do?

Request FIPS builds with
`--platforms=//bazel/platforms:<os>_<cpu>_fips`, whose `flags` select
the `msgo` SDK, instead of the retired `fips` value of
`//packages/agent:flavor`.
Key the FIPS `config_setting`s, `@openssl`'s and the FIPS package names
on the `//bazel/platforms:fips` constraint, and have the omnibus helpers
pass the FIPS platform.
Register a test toolchain so that `bazel test` works on FIPS platforms,
and remove the unused macOS FIPS platforms.
Have the installer's symbol test require `msgo`'s OpenSSL or CNG
backend on the Linux or Windows FIPS platforms, and reject it elsewhere.
This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS
binaries load, nor lifting #59511's guard against them, which depends
on it.

### Motivation

The FIPS platforms' constraint selected nothing, and the `fips` flavor
selected the FIPS tags but kept the upstream SDK, both silently
producing non-FIPS binaries, which #59511 had to block.
Since #58511 made `msgo` a toolchain, the platform now carries both the
constraint and the SDK choice.

### Describe how you validated your changes

- `//cmd/agent` builds with `msgo` and the FIPS tags on the FIPS
  platforms, `requirefips` being Linux-only, and with the upstream SDK
  and no FIPS tags on the others,
- the agent, installer, loader and packaging targets, and `@openssl`,
  analyze with no ambiguous `select()` on the Linux and Windows
  platforms, FIPS or not,
- `bazel test` passes on a FIPS platform,
- the installer's symbol test passes on the Linux and Windows FIPS
  platforms, and fails when expecting a package the binary lacks.

### Additional Notes

The retired flavor value now fails the analysis of packaging targets.
`//cmd/dogstatsd` drops its `cgo` select, whose FIPS branch was a no-op,
#58511's `msgo` SDK building its OpenSSL backend without cgo through
`ms_nocgo_opensslcrypto`, the default of `msgo` 1.27
(https://devblogs.microsoft.com/go/go-1-27-0-1-microsoft-build-now-available/),
leaving `dd_agent_go_binary`'s identical default.
`//cmd/loader:trace_loader_all_files` only excludes Windows, like
`:loader`, instead of listing Linux and macOS.
Groundwork:
- #56351
- #56865
- #57078
- #57223
- #58511
- #58530
- #59501
- #59511
- #59840
- #60181
gh-worker-dd-mergequeue-cf854d Bot pushed a commit that referenced this pull request Nov 12, 2026
### What does this PR do?
Request FIPS builds with `--platforms=//bazel/platforms:<os>_<cpu>_fips`, whose `flags` select the `msgo` SDK, instead of the retired `fips` value of `//packages/agent:flavor`.

Key the FIPS `config_setting`s, `@openssl`'s and the FIPS package names on the `//bazel/platforms:fips` constraint, and have the omnibus helpers pass the FIPS platform.

Register a test toolchain so that `bazel test` works on FIPS platforms, and remove the unused macOS FIPS platforms.

Have the installer's symbol test require `msgo`'s OpenSSL or CNG backend on the Linux or Windows FIPS platforms, and reject it elsewhere.

:bulb: This doesn't cover the RUNPATH of the OpenSSL that Bazel-built FIPS binaries load, nor lifting #59511's guard against them, which will be addressed in:
- #60204.

### Motivation
The FIPS platforms' constraint selected nothing, and the `fips` flavor selected the FIPS tags but kept the upstream SDK, both silently producing non-FIPS binaries, which #59511 had to block.

Since #58511 made `msgo` a toolchain, the platform now carries both the constraint and the SDK choice.

### Describe how you validated your changes
- `//cmd/agent` builds with `msgo` and the FIPS tags on the FIPS platforms, `requirefips` being Linux-only, and with the upstream SDK and no FIPS tags on the others,
- the agent, installer, loader and packaging targets, and `@openssl`, analyze with no ambiguous `select()` on the Linux and Windows platforms, FIPS or not,
- `bazel test` passes on a FIPS platform,
- the installer's symbol test passes on the Linux and Windows FIPS platforms, and fails when expecting a package the binary lacks.

### Additional Notes
The retired flavor value now fails the analysis of packaging targets.

`//cmd/dogstatsd` drops its `cgo` select, whose FIPS branch was a no-op, #58511's `msgo` SDK building its OpenSSL backend without cgo through `ms_nocgo_opensslcrypto`, the default of [`msgo` 1.27](https://devblogs.microsoft.com/go/go-1-27-0-1-microsoft-build-now-available/), leaving `dd_agent_go_binary`'s identical default.

`//cmd/loader:trace_loader_all_files` only excludes Windows, like `:loader`, instead of listing Linux and macOS.

Groundwork:
- #56351
- #56865
- #57078
- #57223
- #58511
- #58530
- #59501
- #59511
- #59840
- #60181

Co-authored-by: regis.desgroppes <[email protected]>
rdesgroppes added a commit that referenced this pull request Nov 12, 2026
### What does this PR do?

Give Linux FIPS Go binaries a RUNPATH to `$(INSTALL_DIR)/embedded/lib`
with Go's `-r` in `dd_agent_go_binary`, so that `msgo` loads the
embedded OpenSSL.
Let `--enable-bazel` build tasks request FIPS through a `fips_backend`
of `bazel()` and `build_binary_with_bazel`, which selects the FIPS
target platform as `AGENT_FLAVOR=fips` already does, instead of failing
as #59511 made them.
This doesn't cover the installer's fallback to the stable version's
libraries, which `tasks/installer.py` adds under `datadog-packages`.

### Motivation

Bazel-built FIPS binaries had no RUNPATH, so `msgo` loaded the system
OpenSSL, or panicked without one, which is why #59511 blocked FIPS
`--enable-bazel` builds.
Go's internal linker ignores the omnibus rpath, which `-r` restores, as
#56351 does for the omnibus-built installer.

### Describe how you validated your changes

- the FIPS installer, built without cgo, has
  `<install_dir>/embedded/lib` as `DT_RUNPATH` and loads
  `libcrypto.so.3` from there, falling back to the system one,
- the FIPS agent, built with cgo, lists that directory first, and keeps
  it through `replace_prefix` in `--enable-bazel` agent builds,
- non-FIPS binaries keep their RUNPATH,
- `installer.build --enable-bazel --fips-backend msgo` and
  `process-agent.build --enable-bazel --flavor fips` build `msgo` FIPS
  binaries without `AGENT_FLAVOR`, while `--fips-backend boringcrypto`
  still fails.

### Additional Notes

`agent.build`, `process-agent.build` and `otel-agent.build` pass their
flavor's backend, the latter 2 no longer passing the `fips` flavor value
#56440 retired.
rdesgroppes added a commit that referenced this pull request Nov 12, 2026
### What does this PR do?
Give Linux FIPS Go binaries a RUNPATH to their embedded libraries with
Go's `-r` in `dd_agent_go_binary`, so that `msgo` loads the embedded
OpenSSL.

For "versioned" install directories, as under `datadog-packages`, have
that RUNPATH fall back to the "stable" version's libraries, for the
installer, which an upgrade runs _before its version is unpacked_.

:bulb: This is the last prerequisite to lifting #59511's guard against
Bazel-built FIPS binaries, which #60204 will do.

### Motivation
Bazel-built FIPS binaries had no RUNPATH to the embedded libraries, so
`msgo` `dlopen`ed OpenSSL from the default search path, loading the
**system** one (or panicking without one).

Omnibus' `CGO_LDFLAGS`, whose `-rpath` the external linker honors for
cgo binaries, never reach Bazel, whose own rpath only lists its
`$ORIGIN`-relative solib directories, while Go's internal linker, which
cgo-less binaries go through, ignores such flags anyway.

Go's `-r` sets the search path whichever linker writes it, as #56351
does for the omnibus-built installer, listing both directories since
#57045's `patchelf --set-rpath` of the bootstrap copy **segfaults** on
such a binary once stripped.

### Describe how you validated your changes
- the FIPS installer has `<install_dir>/embedded/lib` as `DT_RUNPATH`
  and loads `libcrypto.so.3` from there,
- in a versioned install directory, its RUNPATH then lists the stable
  version's libraries, from which it loads `libcrypto.so.3` when its own
  version lacks it,
- the FIPS agent uses cgo for `rtloader`, so the external linker writes
  its rpath: those directories come first, then Bazel's solib ones,
- `replace_prefix`, which `--enable-bazel` agent builds run, keeps
  `<install_dir>/embedded/lib` in that rpath,
- non-FIPS binaries keep their RUNPATH.

### Additional Notes
The RUNPATH comes from an `EMBEDDED_LIB_DIRS` make variable of
`//bazel/rules/variables`, which already derives `AGENT_PACKAGE_VERSION`
from the install directory.
rdesgroppes added a commit that referenced this pull request Nov 13, 2026
### What does this PR do?
Give Linux FIPS Go binaries a RUNPATH to their embedded libraries with
Go's `-r` in `dd_agent_go_binary`, so that `msgo` loads the embedded
OpenSSL.

For "versioned" install directories, as under `datadog-packages`, have
that RUNPATH fall back to the "stable" version's libraries, for the
installer, which an upgrade runs _before its version is unpacked_.

:bulb: This is the last prerequisite to lifting #59511's guard against
Bazel-built FIPS binaries, which #60204 will do.

### Motivation
Bazel-built FIPS binaries had no RUNPATH to the embedded libraries, so
`msgo` `dlopen`ed OpenSSL from the default search path, loading the
**system** one (or panicking without one).

Omnibus' `CGO_LDFLAGS`, whose `-rpath` the external linker honors for
cgo binaries, never reach Bazel, whose own rpath only lists its
`$ORIGIN`-relative solib directories, while Go's internal linker, which
cgo-less binaries go through, ignores such flags anyway.

Go's `-r` sets the search path whichever linker writes it, as #56351
does for the omnibus-built installer, listing both directories since
#57045's `patchelf --set-rpath` of the bootstrap copy **segfaults** on
such a binary once stripped.

### Describe how you validated your changes
- the FIPS installer has `<install_dir>/embedded/lib` as `DT_RUNPATH`
  and loads `libcrypto.so.3` from there,
- in a versioned install directory, its RUNPATH then lists the stable
  version's libraries, from which it loads `libcrypto.so.3` when its own
  version lacks it,
- the FIPS agent uses cgo for `rtloader`, so the external linker writes
  its rpath: those directories come first, then Bazel's solib ones,
- `replace_prefix`, which `--enable-bazel` agent builds run, keeps
  `<install_dir>/embedded/lib` in that rpath,
- non-FIPS binaries keep their RUNPATH.

### Additional Notes
The RUNPATH comes from an `EMBEDDED_LIB_DIRS` make variable of
`//bazel/rules/variables`, which already derives `AGENT_PACKAGE_VERSION`
from the install directory.
gh-worker-dd-mergequeue-cf854d Bot pushed a commit that referenced this pull request Nov 13, 2026
…#60334)

### What does this PR do?
Give Linux FIPS Go binaries a RUNPATH to their embedded libraries with Go's `-r` in `dd_agent_go_binary`, so that `msgo` loads the embedded OpenSSL.

For "versioned" install directories, as under `datadog-packages`, have that RUNPATH fall back to the "stable" version's libraries, for the installer, which an upgrade runs _before its version is unpacked_.

This is the last prerequisite to lifting #59511's guard against Bazel-built FIPS binaries, which #60204 will do.

### Motivation
Bazel-built FIPS binaries had no RUNPATH to the embedded libraries, so `msgo` `dlopen`ed OpenSSL from the default search path, loading the **system** one (or panicking without one).

Omnibus' `CGO_LDFLAGS`, whose `-rpath` the external linker honors for cgo binaries, never reach Bazel, whose own rpath only lists its `$ORIGIN`-relative solib directories, while Go's internal linker, which cgo-less binaries go through, ignores such flags anyway.

Go's `-r` sets the search path whichever linker writes it, as #56351 does for the omnibus-built installer, listing both directories since #57045's `patchelf --set-rpath` of the bootstrap copy **segfaults** on such a binary:
- NixOS/patchelf#146
- NixOS/patchelf#152
- NixOS/patchelf#446
- NixOS/patchelf#674
- NixOS/patchelf#672
- NixOS/patchelf#623

💡 the PR/commit is therefore meant to be reverted when `patchelf` no longer exhibits the issue.

### Describe how you validated your changes
- the FIPS installer has `<install_dir>/embedded/lib` as `DT_RUNPATH` and loads `libcrypto.so.3` from there,
- in a versioned install directory, its RUNPATH then lists the stable version's libraries, from which it loads `libcrypto.so.3` when its own version lacks it,
- the FIPS agent uses cgo for `rtloader`, so the external linker writes its rpath: those directories come first, then Bazel's solib ones,
- `replace_prefix`, which `--enable-bazel` agent builds run, keeps `<install_dir>/embedded/lib` in that rpath,
- non-FIPS binaries keep their RUNPATH.

### Additional Notes
The RUNPATH comes from an `EMBEDDED_LIB_DIRS` make variable of `//bazel/rules/variables`, which already derives `AGENT_PACKAGE_VERSION` from the install directory.

Co-authored-by: regis.desgroppes <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/no-changelog No changelog entry needed internal Identify a non-fork PR medium review PR review might take time qa/no-code-change No code change in Agent code requiring validation team/agent-build team/windows-products

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants