Skip to content

fix(ci): gate release on npm registry propagation - #5572

Open
svozza wants to merge 1 commit into
mainfrom
fix/5564-npm-registry-propagation-gate
Open

fix(ci): gate release on npm registry propagation#5572
svozza wants to merge 1 commit into
mainfrom
fix/5564-npm-registry-propagation-gate

Conversation

@svozza

@svozza svozza commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

publish_layer's cdk synth runs npm i @aws-lambda-powertools/<pkg>@<version> seconds after npm publish returns, before registry.npmjs.org actually serves the new versions. needs: publish-npm only guarantees publish returned, not that the registry resolves the versions, so the layer build intermittently fails with a misleading ETARGET / No matching version found (as in the v2.35.0 release), which blocks every downstream job. This adds a registry-availability gate plus a retry so the release either waits or fails with an accurate reason.

If the gate does time out because of registry eventual consistency, it is safe to simply re-run the failed job once npm catches up — nothing needs to be republished.

Changes

  • Add .github/scripts/verify_npm_publish.sh: after publishing, poll the registry for every non-private workspace version (version document + dist.tarball) until it is served, failing after 7 minutes with a message that names the pending versions and explains the ETARGET symptom, rather than letting it surface later.
  • Wire a Verify npm registry propagation step into the publish-npm job, so publish_layer and create_tag (both needs: publish-npm) transitively wait.
  • Retry the layer bundling npm i with exponential backoff in layers/src/layer-publisher-stack.ts, which also protects the manual publish_layer dispatch path.

Testing

Rehearsed end-to-end against a full stubbed copy of the release pipeline (npm publish, AWS, and CDK deploy edges stubbed; job graph, gating, and artifact flow kept real):

  • Happy path: with the versions live on the registry, the Verify npm registry propagation step passes against the real registry and the layer build's cdk synth/npm i succeeds; the pipeline proceeds.
  • Negative path: with a version unavailable, the gate fails loudly — naming the pending version and the ETARGET symptom rather than surfacing a bare ETARGET downstream — and publish_layer/create_tag are skipped.

Issue number: closes #5564


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

Comment thread layers/src/layer-publisher-stack.ts Fixed
@svozza
svozza requested a review from dreamorosi August 20, 2026 10:12
@svozza
svozza force-pushed the fix/5564-npm-registry-propagation-gate branch 2 times, most recently from 0e2224b to fec4389 Compare August 20, 2026 10:22
Comment thread layers/src/layer-publisher-stack.ts Fixed
@svozza
svozza force-pushed the fix/5564-npm-registry-propagation-gate branch from fec4389 to 075c190 Compare August 20, 2026 10:31
publish_layer's cdk synth runs npm i @aws-lambda-powertools/<pkg>@<version>
seconds after npm publish returns, before the registry actually serves the new
versions, so the layer build intermittently failed with a misleading
'ETARGET / No matching version found' that blocked every downstream job.

- Add .github/scripts/verify_npm_publish.sh: after publishing, poll the registry
  for every non-private workspace version (version doc + tarball) until served,
  timing out after 7 minutes with an accurate message instead of a downstream
  ETARGET. Wired into the publish-npm job, so publish_layer/create_tag (which
  need: publish-npm) transitively wait.
- Retry the layer bundling npm i with exponential backoff in
  layer-publisher-stack.ts, covering the manual publish_layer dispatch too.

Closes #5564
@svozza
svozza force-pushed the fix/5564-npm-registry-propagation-gate branch from 075c190 to fb4f446 Compare August 20, 2026 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L PRs between 100-499 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Maintenance: gate publish_layer on npm registry availability to avoid ETARGET race during release

3 participants