Skip to content

Commit 126052a

Browse files
committed
frfr
1 parent 5c15e99 commit 126052a

4 files changed

Lines changed: 40 additions & 18 deletions

File tree

‎.github/workflows/integration_tests_local.yml‎

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,30 @@ jobs:
2525
strategy:
2626
fail-fast: false
2727
matrix:
28-
node_major: ["18", "20", "22", "24", "26"]
28+
# Host Node must match the Lambda runtime so yarn installs the
29+
# matching dd-trace line (v5 on 18/20, v6 on 22+) with working
30+
# native prebuilds. Packing v6 on Node 18 (--ignore-engines) is
31+
# what local Node 22+ never hits.
32+
include:
33+
- node_major: "18"
34+
node_version: "18.12"
35+
- node_major: "20"
36+
node_version: "20.19"
37+
- node_major: "22"
38+
node_version: "22.11"
39+
- node_major: "24"
40+
node_version: "24.11"
41+
- node_major: "26"
42+
node_version: "26.1"
2943

3044
steps:
3145
- name: Checkout
3246
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
3347

34-
- name: Set up Node 18.12
48+
- name: Set up Node ${{ matrix.node_version }}
3549
uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3.9.1
3650
with:
37-
node-version: 18.12
51+
node-version: ${{ matrix.node_version }}
3852

3953
- name: Run local container integration tests (nodejs${{ matrix.node_major }}.x)
4054
run: PLATFORM=linux/amd64 RUNTIME_PARAM=${{ matrix.node_major }} ./integration_tests_local/run.sh

‎integration_tests_local/README.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ PLATFORM=linux/amd64 ./integration_tests_local/run.sh
4747
On a tree that pins dd-trace v6 (which older runtimes cannot install), the
4848
pack step installs through `scripts/install_deps.sh` with
4949
`TARGET_NODE_MAJOR=$RUNTIME_PARAM` and the container fixtures get a matching
50-
`DD_TRACE_VERSION` build-arg. Run per-runtime there, like CI does: a full
51-
sweep packs only once, so its layer fixture would carry the first leg's
52-
tracer line into every other leg.
50+
`DD_TRACE_VERSION` build-arg. Packing the v6 line needs host Node 22+ (CI
51+
sets `setup-node` to the matrix runtime for that reason). Run per-runtime
52+
there, like CI does: a full sweep packs only once, so its layer fixture
53+
would carry the first leg's tracer line into every other leg.
5354

5455
The case names are:
5556

‎integration_tests_local/run.sh‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -385,15 +385,11 @@ if [ -z "$SKIP_PACK" ]; then
385385
echo "Packing local datadog-lambda-js for container tests"
386386
cd "$repo_dir"
387387
if [ -f "$repo_dir/scripts/install_deps.sh" ]; then
388-
# dd-trace v6 world: the repo pins a tracer whose engines may reject
389-
# the host node (e.g. v6 requires node >=22 while CI hosts node 18).
390388
# install_deps.sh installs the tracer line matching the target
391-
# runtime, rewriting package.json/yarn.lock and restoring them via a
392-
# trap on exit, so the worktree is left untouched.
393-
# NOTE: in the v6 world a full local sweep packs once with
394-
# TARGET_NODE_MAJOR=$RUNTIME_PARAM (default 22); run per-runtime like
395-
# CI does (RUNTIME_PARAM=18 ./integration_tests_local/run.sh) so the
396-
# layer fixture's pinned dd-trace matches each leg.
389+
# runtime (v5 on 18/20, v6 on 22+). v6 install requires host Node 22+.
390+
# A full sweep packs once; run per-runtime like CI
391+
# (RUNTIME_PARAM=18 ./integration_tests_local/run.sh) so the layer
392+
# fixture's pinned dd-trace matches each leg.
397393
TARGET_NODE_MAJOR=${RUNTIME_PARAM:-22} "$repo_dir/scripts/install_deps.sh"
398394
else
399395
yarn install --frozen-lockfile

‎scripts/install_deps.sh‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
# USAGE: [TARGET_NODE_MAJOR=22] ./scripts/install_deps.sh [extra yarn args...]
1313
#
1414
# TARGET_NODE_MAJOR defaults to the Node major running this script. Set it
15-
# explicitly when the host Node version differs from the runtime being built
16-
# for, e.g. the GitLab CI image runs Node 18 but builds for every runtime.
15+
# when the host differs from the runtime being built for (e.g. Node 22
16+
# packing a Node 18 fixture, which pins v5). Installing v6 still requires
17+
# a host of Node 22+ so native prebuilds resolve.
1718

1819
set -e
1920

@@ -29,9 +30,19 @@ if [ -z "$TARGET_NODE_MAJOR" ]; then
2930
fi
3031

3132
dd_trace_override=$(dd_trace_version_for_node_major "$TARGET_NODE_MAJOR")
33+
host_major=$(node -p "process.versions.node.split('.')[0]")
3234

33-
# --ignore-engines is needed on both paths: dd-trace v6 refuses to install on
34-
# hosts older than Node 22 even when it is only being built for a newer runtime.
35+
# v6's optional native addons (pprof, appsec, oxc-parser) ship prebuilds for
36+
# Node 22+ only. --ignore-engines would let yarn extract the tarball on
37+
# Node 18, then node-gyp-build fails and the tree is unusable. Pin v5 instead.
38+
if [ -z "$dd_trace_override" ] && [ "$host_major" -lt "$DD_TRACE_V6_MIN_NODE_MAJOR" ]; then
39+
echo "dd-trace v6 cannot be installed on Node ${host_major} (engines.node >= ${DD_TRACE_V6_MIN_NODE_MAJOR})." >&2
40+
echo "Use Node ${DD_TRACE_V6_MIN_NODE_MAJOR}+, or set TARGET_NODE_MAJOR to 18 or 20 to pin v5." >&2
41+
exit 1
42+
fi
43+
44+
# Nested packages still declare engines that reject some hosts; yarn 1
45+
# otherwise fails the whole install on an engines mismatch.
3546
yarn_args=("--ignore-engines")
3647

3748
if [ -n "$dd_trace_override" ]; then

0 commit comments

Comments
 (0)