Skip to content
Merged
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
91 changes: 66 additions & 25 deletions .claude/skills/release-lambda-layer/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ agent-invocable: true
# Release a new datadog-lambda-js Lambda layer

This mirrors the "Release" section of the SLS Confluence page "Lambda Layer
Node.js" (Commercial + GovCloud). It assumes a Release Candidate has
already been validated (self-monitoring + e2e tests passed) before this
process starts.
Node.js" (Commercial + GovCloud). If any discrepancies are found, inform
the user and ask for directions on which source of truth to follow.

This process pushes git tags, triggers production-publishing GitLab jobs,
publishes to the public npm registry, and creates a public GitHub release.
Expand All @@ -24,37 +23,77 @@ earlier in the same run.
Use this same thread for every update below. Ask the user to post, don't
post on their behalf unless they've explicitly asked you to send Slack
messages for them.
- Confirm a Release Candidate deploy already passed self-monitoring and
e2e tests for this change. Do not start Phase 1 without it.
- The release gate is the e2e run on the tag pipeline (Phase 1, step 11),
not a pre-merge Release Candidate. The Confluence page still has a
"Release Candidate" section (sandbox layers from `main` on self-monitoring
plus e2e); ask the user whether they want one for this release before
starting Phase 1.

## Phase 1 — Commercial release

Reference: https://datadoghq.atlassian.net/wiki/spaces/SLS/pages/3375925277

1. Create a branch for the version bump.
2. Run `yarn upgrade dd-trace` (or `yarn upgrade dd-trace@^a.b.c` for a
specific version) to pick up the latest tracer.
2. Bump **both** dd-trace lines the layers ship. dd-trace v6 requires
Node >= 22, so the layers are split (since #818):

| Layers | dd-trace comes from |
| ---------- | ---------------------------------------------------------------- |
| Node 22+ | v6, resolved from `yarn.lock` |
| Node 18/20 | v5, pinned by hand in `DD_TRACE_V5_VERSION` (`scripts/dd_trace_versions.sh`) |

`yarn upgrade dd-trace` only moves the v6 line. Do all of:
- Look up the latest of each line: `npm view dd-trace@6 version` and
`npm view dd-trace@5 version` (last entry; the pin check compares
against the newest `dd-trace@5`).
- **v6:** on a Node 22+ host, `yarn upgrade dd-trace --ignore-engines`.
This keeps the devDependency range and moves `yarn.lock` to the newest
matching v6. `yarn upgrade dd-trace@^a.b.c` also works but rewrites
`devDependencies["dd-trace"]`, which the peer range below must mirror.
- **v5:** set `DD_TRACE_V5_VERSION` in `scripts/dd_trace_versions.sh` to
the latest v5.
- **Peer range:** set `peerDependencies["dd-trace"]` in `package.json` to
`^<v5 pin> || <devDependencies["dd-trace"]>`, e.g.
`"^5.138.0 || ^6.24.0"`.
- Verify with `./scripts/check_dd_trace_v5_pin.sh` (needs a working
`npm`). Don't rely on CI to catch a stale pin: the GitLab
`publish npm package` job runs this same check, but only after the
`sign layer` jobs have already published every layer to every region.
- The daily `update-deps` workflow's "Update Dependencies" PR also moves
the v6 line, but it upgrades every dependency and never touches the v5
pin — it is not a substitute for this step.
3. If dd-trace changed, refresh the integration test snapshots. The local
RIE-based docker suite is the behavioral gate:
`UPDATE_SNAPSHOTS=true ./integration_tests_local/run.sh`
Rely on the end-to-end test suites for coverage that requires real AWS
Lambda resources.
(all runtimes by default; `RUNTIME_PARAM=18` etc. for one). The old
`./scripts/run_integration_tests.sh` was removed in #826. The
`local integration tests` GitHub workflow runs this suite on Node 18-26
for every PR, so stale snapshots fail the PR checks. Rely on the
end-to-end test suites for coverage that requires real AWS Lambda
resources.
4. Bump `package.json` version to `X.Y.0`:
- Minor version bumps on every release, and **must match the layer
version**.
- Bump major too for breaking changes.
5. Commit as `vX.Y.0`, open a PR, get approval.
6. **Before merging**, confirm a Release Candidate deploy already passed
for this change (per "Before starting" above).
7. Merge the PR. **Tell the user not to merge any other PR until this
6. Merge the PR. **Tell the user not to merge any other PR until this
release finishes** — a concurrent merge can tag the wrong commit.
8. `git checkout main && git pull`
9. `git tag vX.Y.0`
10. `git push --tags origin main` — **guardrail: confirm with the user
before running this.** It kicks off the production build in GitLab and
can't be cleanly undone.
11. In [GitLab tags](https://gitlab.ddbuild.io/DataDog/datadog-lambda-js/-/tags),
7. `git checkout main && git pull`
8. `git tag vX.Y.0`
9. `git push --tags origin main` — **guardrail: confirm with the user
before running this.** It kicks off the production build in GitLab and
can't be cleanly undone.
10. In [GitLab tags](https://gitlab.ddbuild.io/DataDog/datadog-lambda-js/-/tags),
open the pipeline for the new tag.
11. **Release gate: e2e on the tag pipeline.** In that pipeline the
`publish layer sandbox (nodeXX): [us-west-2]` jobs run automatically,
and `e2e-test` then triggers the serverless-e2e-tests pipeline against
those sandbox layers (`e2e-test-status` polls it). Wait for `e2e-test`
to pass before step 12. GitLab does not enforce this: the `sign layer`
jobs don't depend on the e2e stage. If the sandbox publish or e2e
trigger didn't run, have the user start it; if e2e fails, stop and
tell the user, and don't sign. Same GitLab access caveat as step 12
for checking job status.
12. **Guardrail: confirm before triggering**, then run the `sign-layer
(nodeXX)` manual job for every supported runtime. This deploys the
layer to every commercial region.
Expand All @@ -74,9 +113,10 @@ Reference: https://datadoghq.atlassian.net/wiki/spaces/SLS/pages/3375925277
14. **Guardrail: confirm before creating**, then draft a GitHub release on
the [releases page](https://github.com/DataDog/datadog-lambda-js/releases):
- Select the new tag and the previous tag, generate release notes.
- Call out which `dd-trace` version is packaged in this release (from
step 2 of Phase 1) — this is important for users debugging tracer
behavior against a specific layer version.
- Call out which `dd-trace` versions are packaged in this release (from
step 2 of Phase 1): the v5 version in the Node 18/20 layers and the v6
version in the Node 22+ layers — this is important for users
debugging tracer behavior against a specific layer version.
- Paste in layer ARNs for every runtime and region pattern, e.g.:
```
arn:aws:lambda:<AWS_REGION>:464622532012:layer:Datadog-Node18-x:117
Expand Down Expand Up @@ -128,8 +168,9 @@ to stay manual.

## Failure modes

- If integration test snapshots don't update correctly, check the
installed `serverless` framework is v3, not v4:
`npm install -g serverless@3.39.0`.
- If a teammate merges a PR to `main` between step 7 and step 9 of Phase 1,
- If `publish npm package` fails in `check_dd_trace_v5_pin.sh`, stop and
tell the user. The layers for this tag already shipped with the stale v5
tracer, so the fix is a pin bump and a new release — don't edit the
check, re-tag, or publish around it without the user's decision.
- If a teammate merges a PR to `main` between step 6 and step 8 of Phase 1,
stop and confirm with the user which commit should actually be tagged.
Loading