Repository navigation
[ABLD-525] Build the Linux FIPS installer without cgo (like Go 1.27) - #56351
Conversation
There was a problem hiding this comment.
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.
Static quality checks✅ Please find below the results from static quality gates Successful checksInfo
28 successful checks with minimal change (< 2 KiB)
|
Regression DetectorRegression Detector ResultsMetrics dashboard Baseline: 4ad5ed0 Optimization Goals: ✅ No significant changes detected
|
| 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:
-
Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.
-
Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.
-
Its configuration does not mark it "erratic".
CI Pass/Fail Decision
✅ Passed. All Quality Gates passed.
- quality_gate_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.
addd238 to
f4d9547
Compare
f4d9547 to
13d4088
Compare
ms_nocgo_opensslcrypto for the Linux FIPS buildThere was a problem hiding this comment.
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.
|
View all feedbacks in Devflow UI.
It will be processed automatically as soon as GitHub reports it as mergeable. View in MergeQueue UI.
devflow unqueued this merge request: It did not become mergeable within the expected time |
13d4088 to
8712914
Compare
### 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.
8712914 to
3f5ff9b
Compare
Gitlab CI Configuration ChangesModified 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: 32Giagent_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-agentddot_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-ddotinstaller_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-installerChanges Summary
ℹ️ Diff available in the job log. |
### 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
### 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
### 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
### 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
### 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
### 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
### 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
### 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
### 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
### 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
### 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
### 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]>
### 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.
### 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.
### 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.
…#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]>
What does this PR do?
Build the Linux FIPS installer without cgo, honoring its
--no-cgoas for the non-FIPS one, throughmsgo's cgo-less OpenSSL backend.Set
GOEXPERIMENT=ms_nocgo_opensslcryptofor Linux FIPS omnibus builds, which enables that backend, asbazel/rules/msgo/extension.bzldoes for themsgoBazel 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 thepatchelfrewrite of its bootstrap copy from.gitlab/build/packaging/oci.yml.Check FIPS binaries for
vendor/github.com/microsoft/go-crypto-openssl/opensslsymbols, which cgo and cgo-less builds both have, instead of the cgo-only_Cfunc__mkcgo_OPENSSLones.Make
//cmd/installer:installerpure on Linux and drop its FIPS-onlycgooverride, so that it builds without cgo in both flavors, as omnibus does.Motivation
The upcoming bazelification will ship
//cmd/installer:installerbuilt with #58511'smsgotoolchain, which setsms_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
-rrestores.The bootstrap copy's
patchelf --set-rpath, from #57045, segfaults on such a binary once GNU-stripped,patchelf0.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
msgo1.26.10 that:dda inv -- -e installer.build --fips-mode --no-cgo, withGOEXPERIMENT=ms_nocgo_opensslcryptoand a versioned--install-path, builds withCGO_ENABLED=0, dynamically linking onlylibc,libdlandlibpthread, OpenSSL beingdlopened,<install_path>/embedded/libthen<package>/stable/embedded/lib, asdatadog-agent-finalize.rbnow asserts,libcryptofrom its own version's directory when present, and from the stable one's otherwise,vendor/github.com/microsoft/go-crypto-openssl/opensslsymbols but no_Cfunc__mkcgo_OPENSSLones, while a cgo FIPS build, like the agent's, has both,//cmd/installer:installerbuilds withCGO_ENABLED=0and the same dynamic libraries in the FIPS flavor with themsgotoolchain, and statically in the base flavor.Checked that
//bazel/buildifier:testanddda inv -- -e linter.pythonpass.Additional Notes
rules_gobinary'sCGO_ENABLEDcomes frompure, notcgo, which only covers the target's own sources, so the Bazel installer was built with cgo in both flavors until now,//cmd/installer:installerhas no such rpath yet, which its FIPS packaging will need,TestFipsUpgradeFromDebRPMexercises the bootstrap's fallback to the stable version's libraries,rtloaderand thenetcgoresolver among others,systemcrypto's own underCGO_ENABLED=0, so both experiment settings go away then,systemcrypto, with cgo.