Skip to content

fix(tests): make race-safe layer publishing opt-in for the e2e test sandbox job - #1367

Merged
lucaspimentel merged 3 commits into
mainfrom
lpimentel/race-safe-layer-publish
Oct 13, 2026
Merged

lucaspimentel merged 3 commits into
mainfrom
lpimentel/race-safe-layer-publish

Conversation

@lucaspimentel

@lucaspimentel lucaspimentel commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

Overview

Automatic layer publishing (AUTOMATICALLY_BUMP_VERSION=1) predicted the next layer version by listing the current latest and adding 1, then ran a strict publish loop that fails the job when AWS assigns a higher version than predicted. Because layer versions are assigned atomically by AWS at publish time, a concurrent pipeline publishing to the same layer between the list call and the publish call makes the prediction stale, and the job fails with Published version N is greater than the desired version N-1 even though the published version holds this job's own binary.

This PR adds an explicit USE_AWS_ASSIGNED_VERSION flag that publishes once and adopts the version AWS returns, and enables it only for the publish layer e2e sandbox job, which is the job that blocks serverless e2e tests when it fails. All other auto-publishing callers (sandbox, serverless_testing, self-monitoring, govcloud us1-staging-fed) keep the previous latest-plus-one prediction and strict behavior. Fixed-version publishing (prod tags, explicit VERSION) is unchanged and remains strict.

For the e2e job, the exported EXTENSION_LAYER_ARN dotenv artifact now always refers to the version this job actually published, so the downstream e2e-test trigger jobs test the binary from this pipeline.

Testing

  • bash -n .gitlab/scripts/publish_layers.sh passes.
  • Regression tests with a stubbed aws CLI covering five scenarios, all passing:
    • auto mode + USE_AWS_ASSIGNED_VERSION=1 (latest 698, AWS assigns 700): exits 0, one publish-layer-version call, no list-layer-versions calls, dotenv exports the ARN of the AWS-assigned version.
    • auto mode without the flag, AWS assigns above the prediction: exits 1 with greater than the desired version, no dotenv (previous behavior preserved).
    • auto mode without the flag, happy path (latest 698, AWS assigns 699): exits 0, exports :699 ARN.
    • fixed mode VERSION=699, AWS assigns 700: still fails, no dotenv.
    • fixed mode VERSION=699, AWS assigns 699: succeeds, exports :699 ARN.
  • shellcheck findings limited to the pre-existing SC2086/SC2059/SC2016/SC2004 classes already present on main.

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Pipelines

❌ Errors

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 1 Pipeline job failed

DataDog/datadog-lambda-extension | bottlecap (arm64, fips, alpine) — 🔄 Retry may pass, looks flaky

View more details · View in GitLab

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 5f66011 | Docs | View more details | Give us feedback!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Uninitialized internal mode state can unintentionally bypass strict version handling.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds opt-in AWS-assigned layer versioning for e2e sandbox publishing.

Changes:

  • Publishes once and uses AWS’s returned version.
  • Enables this mode only for e2e sandbox jobs.
  • Preserves strict version handling elsewhere.
File summaries
File Description
.gitlab/templates/pipeline.yaml.tpl Enables AWS-assigned versions for e2e sandbox publishing.
.gitlab/scripts/publish_layers.sh Implements publish-once version adoption.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .gitlab/scripts/publish_layers.sh
@lucaspimentel

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-16T21:27:26.097747Z a005a1f Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 767132aaef

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No unresolved review issues were identified.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@lucaspimentel
lucaspimentel force-pushed the lpimentel/race-safe-layer-publish branch 3 times, most recently from 5f94641 to a005a1f Compare September 16, 2026 17:12
@lucaspimentel

Copy link
Copy Markdown
Member Author

@DataDog review

@lucaspimentel
lucaspimentel marked this pull request as ready for review September 16, 2026 21:25
@lucaspimentel
lucaspimentel requested a review from a team as a code owner September 16, 2026 21:25

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Datadog Autotest: PASS

More details

The opt-in path publishes the layer once and uses the AWS version. Other publish modes keep the strict version check.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Datadog Autotest · Commit a005a1f · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

@lucaspimentel

Copy link
Copy Markdown
Member Author

@DataDog review

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Datadog Autotest: PASS

More details

The opt-in job publishes one layer and uses the AWS-assigned version in downstream E2E tests. The predictive and fixed-version paths keep their strict behavior.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Datadog Autotest · Commit a005a1f · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

@lucaspimentel
lucaspimentel force-pushed the lpimentel/race-safe-layer-publish branch 2 times, most recently from 3cd35c3 to 25d34b1 Compare September 18, 2026 14:30
@lucaspimentel lucaspimentel changed the title fix: make race-safe layer publishing opt-in for the e2e sandbox job fix: make race-safe layer publishing opt-in for the e2e test sandbox job Sep 25, 2026
@lucaspimentel lucaspimentel changed the title fix: make race-safe layer publishing opt-in for the e2e test sandbox job fix(tests): make race-safe layer publishing opt-in for the e2e test sandbox job Sep 25, 2026
@lucaspimentel
lucaspimentel force-pushed the lpimentel/race-safe-layer-publish branch from 25d34b1 to f0ce37f Compare October 1, 2026 20:02
@lucaspimentel
lucaspimentel requested review from a team and lym953 and removed request for a team and DarcyRaynerDD October 9, 2026 18:51
@lucaspimentel
lucaspimentel force-pushed the lpimentel/race-safe-layer-publish branch 2 times, most recently from 5304fda to c77bc51 Compare October 13, 2026 15:25
lucaspimentel and others added 3 commits October 13, 2026 13:23
Automatic layer publishing predicted the next version by listing the
current latest, which races with concurrent pipelines and fails when AWS
assigns a higher version than predicted. Add a USE_AWS_ASSIGNED_VERSION
flag that publishes once and uses the version returned by this job's own
publish-layer-version call, and enable it only for the e2e sandbox
publish job so the exported layer ARN always refers to that job's
binary. All other auto-publishing jobs and scripts keep the previous
latest-plus-one prediction and strict publish behavior, and fixed-version
publishing for tags and manual versions is unchanged.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@lucaspimentel
lucaspimentel force-pushed the lpimentel/race-safe-layer-publish branch from c77bc51 to 5f66011 Compare October 13, 2026 17:23
@lucaspimentel
lucaspimentel merged commit 4aa6ae8 into main Oct 13, 2026
60 of 62 checks passed
@lucaspimentel
lucaspimentel deleted the lpimentel/race-safe-layer-publish branch October 13, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants