Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 89 additions & 5 deletions .gitlab/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,16 +206,76 @@ test-integration-linux-amd64:
variables:
TEST_ARCH: amd64

# Builds the macOS integration harness (panoramic, datadog-intake and millstone) for arm64, and caches it in the GitLab
# package registry under a hash of its inputs. When the registry already has the harness for that hash, the job stops.
# test-integration-macos-arm64 takes the harness from the cache. See "The macOS harness cache" in
# docs/development/panoramic.md. Like test-integration-macos-arm64, this job has no rules, so the two jobs run in the
# same pipelines.
build-macos-harness-arm64:
extends:
- .macos-arm64-test-job
stage: e2e
needs: []
# When this job fails, it publishes a failure marker, and the test job fails with an error that links here. Without
# the marker, the test job builds the harness itself. So a failure here doesn't fail the pipeline on its own.
allow_failure: true
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
- scheduler_failure
- api_failure
- data_integrity_failure
- unknown_failure
timeout: 30m
artifacts:
expire_in: 1 week
paths:
- target/cargo-timings/
when: always
variables:
# Stop the script early enough for after_script to publish the failure marker.
RUNNER_SCRIPT_TIMEOUT: 25m
RUNNER_AFTER_SCRIPT_TIMEOUT: 5m
CARGO_TIMINGS: "true"
before_script:
- sysctl hw.ncpu hw.physicalcpu hw.memsize machdep.cpu.brand_string || true
script:
- if python3 ci/tooling/harness_cache.py exists; then exit 0; fi
- make build-integration-harness-host
- python3 ci/tooling/harness_cache.py publish
after_script:
# A canceled job publishes no marker, so the test job builds the harness itself instead of failing.
- if [ "$CI_JOB_STATUS" = "failed" ]; then python3 ci/tooling/harness_cache.py mark-failed; fi

# Runs the integration cases that declare macOS on a macOS runner: a Tart VM on arm64, a bare-metal host on amd64. No
# Docker: panoramic spawns ADP and the Core Agent as real macOS processes. Up to PANORAMIC_HOST_SLOTS cases run at once,
# each in its own host slot: slot 0 uses /tmp/panoramic and the declared ports, and slot k uses /tmp/panoramic-k and the
# ports +10·k. The Datadog Agent is installed into a sandbox under /tmp/saluki-dda by the Makefile target (idempotent:
# re-uses the install across runs if the pinned version is already present). The sandbox install never touches
# /opt/datadog-agent, so any system install on the runner is left alone.
#
# The job builds ADP with $BUILD_PROFILE, the profile that the pipeline ships. Then ci/tooling/get-macos-harness.sh puts
# the harness in target/release/. On arm64, it takes the harness from the cache that build-macos-harness-arm64 fills.
# On amd64, it takes the shared harness from the cache when the cache has it, and builds the harness otherwise.
# ci/tooling/macos_target_dir.py keeps target/release/ between jobs when the job sets MACOS_PERSISTENT_TARGET to "true",
# and does nothing otherwise.
.test-integration-macos-base:
stage: e2e
needs: []
retry: 2
# Retry only infrastructure failures. The script exits with 75 (EX_TEMPFAIL) when a download fails. GitLab retries a
# job that matches `when` or `exit_codes`. See "Retries of the macOS jobs" in docs/development/panoramic.md.
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
- scheduler_failure
- api_failure
- data_integrity_failure
- unknown_failure
exit_codes: [75]
timeout: 48m
id_tokens:
DD_STS_OIDC_TOKEN:
Expand All @@ -234,6 +294,9 @@ test-integration-linux-amd64:
PANORAMIC_LOG_DIR: integration-logs/${CI_JOB_ID}
# Write cargo timing reports, so the build phases can be measured per job.
CARGO_TIMINGS: "true"
# The script runs the Agent installer, and then `make provision-macos-test-env`, which reads the same directories.
MACOS_TEST_AGENT_INSTALL_DIR: /tmp/saluki-dda/datadog-agent
MACOS_TEST_AGENT_DMG_DIR: /tmp/saluki-dda-dmg-cache
before_script:
- unset DD_STS_OIDC_TOKEN DD_API_KEY
# Record the runner's CPU and memory, which the build times depend on.
Expand Down Expand Up @@ -264,14 +327,23 @@ test-integration-linux-amd64:
- bash ci/tooling/macos-listener-sampler.sh stop
# These are the prerequisites of `make test-integration-macos-ci`, one per line so that the log timestamps show the
# duration of each.
# Provisioning is network-bound, so it runs in the background while the CPU-bound builds run.
# get-macos-harness.sh runs `make build-integration-harness-host` when the job doesn't take the harness from the
# cache. Provisioning is network-bound, so it runs in the background while the job builds and fetches.
# macos_target_dir.py runs before the first build, so that every build uses the persistent directory.
#
# make exits with 2 when a recipe fails, whatever the exit code of the recipe. So the job runs the Agent installer
# before make, and keeps its exit code 75 for a failed download. The tool step only installs the Rust version in
# rust-toolchain.toml, cargo-binstall and cargo-auditable, so the job exits with 75 when it fails.
script:
- mkdir -p "$PANORAMIC_LOG_DIR"
- make provision-macos-test-env > "$PANORAMIC_LOG_DIR/provision.log" 2>&1 &
- (python3 ci/tooling/install_macos_agent.py --install-dir "$MACOS_TEST_AGENT_INSTALL_DIR" --cache-dir "$MACOS_TEST_AGENT_DMG_DIR" && make provision-macos-test-env) > "$PANORAMIC_LOG_DIR/provision.log" 2>&1 &
- PROVISION_PID=$!
- make build-integration-harness-host
- python3 ci/tooling/macos_target_dir.py link --profile release
- make cargo-install-cargo-auditable || exit 75
- make build-adp-host
- if wait "$PROVISION_PID"; then cat "$PANORAMIC_LOG_DIR/provision.log"; else cat "$PANORAMIC_LOG_DIR/provision.log"; exit 1; fi
- bash ci/tooling/get-macos-harness.sh
# zsh reserves `status`, so the exit code goes in `provision_status`.
- if wait "$PROVISION_PID"; then cat "$PANORAMIC_LOG_DIR/provision.log"; else provision_status=$?; cat "$PANORAMIC_LOG_DIR/provision.log"; exit "$provision_status"; fi
# Temporary: record the listeners while the cases run, to check the first runs with several host slots.
- bash ci/tooling/macos-listener-sampler.sh start "$PANORAMIC_LOG_DIR/host-diag/listeners.txt"
- make test-integration-macos-run
Expand Down Expand Up @@ -300,6 +372,10 @@ test-integration-macos-arm64:
- .test-integration-macos-base
variables:
PANORAMIC_HOST_SLOTS: "4"
# The seconds that get-macos-harness.sh waits for build-macos-harness-arm64, which starts with this job. The wait
# covers a build job that is a few minutes slower than the ADP build here. After the wait, a local harness build
# still fits in RUNNER_SCRIPT_TIMEOUT.
HARNESS_CACHE_WAIT: "480"

test-integration-macos-amd64:
extends:
Expand All @@ -309,3 +385,11 @@ test-integration-macos-amd64:
variables:
# One case at a time until dogstatsd-replay-unix is checked with several host slots on Intel.
PANORAMIC_HOST_SLOTS: "1"
# The hosts keep their disk between jobs, so cargo builds only what changed since the last job on the host. Tag
# pipelines build ADP with the optimized-release profile, which stays in the checkout and builds from scratch. See
# "The persistent build directory of the amd64 macOS jobs" in docs/development/panoramic.md.
MACOS_PERSISTENT_TARGET: "true"
# No job builds the harness for amd64 ahead of this job. So get-macos-harness.sh looks for the shared harness once,
# and builds the harness when the cache doesn't have it. On the default branch, it then publishes that harness.
HARNESS_CACHE_WAIT: "0"
HARNESS_CACHE_PUBLISH: "true"
2 changes: 2 additions & 0 deletions .gitlab/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ check-correctness-fixtures:
stage: test
script:
- python3 -m unittest -v ci/tooling/test_panoramic_junit.py
- make test-harness-cache
- make test-macos-target-dir
- make generate-correctness-fixtures
- git diff --exit-code || (echo "Correctness case fixtures not up-to-date. Run 'make generate-correctness-fixtures' locally and commit."; exit 1)

Expand Down
10 changes: 5 additions & 5 deletions .gitlab/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ test-integration-windows-amd64:
DD_STS_OIDC_TOKEN:
aud: dd-sts
needs: []
# Matches the retry policy on the linux/darwin integration jobs (see `.test-integration-linux-base` and
# `.test-integration-macos-base` in .gitlab/e2e.yml). This is a last-resort net stacked under
# the in-harness mitigations, not the primary fix: a retry re-runs the whole job, including the
# cargo build and a possible cold pull of the multi-GB build image, so it is expensive and it
# only helps for failures that don't reproduce.
# Matches the retry policy of the Linux integration jobs (`.test-integration-linux-base` in
# .gitlab/e2e.yml). This is a last-resort net stacked under the in-harness mitigations, not the
# primary fix: a retry re-runs the whole job, including the cargo build and a possible cold pull
# of the multi-GB build image, so it is expensive and it only helps for failures that don't
# reproduce.
retry: 2
# Leave time outside the script budgets for the Cargo cache and test artifacts.
timeout: 55m
Expand Down
Loading
Loading