Skip to content

Retry SSI jobs on scenario timeouts and on the pulumi "short write" error - #7608

Merged
ddmatan merged 3 commits into
mainfrom
matan.perry/add-retry-ssi-templates
Aug 28, 2026
Merged

Retry SSI jobs on scenario timeouts and on the pulumi "short write" error#7608
ddmatan merged 3 commits into
mainfrom
matan.perry/add-retry-ssi-templates

Conversation

@ddmatan

@ddmatan ddmatan commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Motivation

Two transient provisioning/CI failures fail an SSI job for good today, and a single one of them blocks the whole release pipeline.

1. Scenario hangs → exit 124. run.sh is wrapped in timeout 3000, so a hung scenario exits 124. That code was not in retry:exit_codes, so the job just died.

2. error: short write: running .... This is what actually blocked the pipeline in the release thread:

command:remote:Command -Amazon_Linux_2_arm64-vm_logs  **creating failed**
error: short write: running "#Wait for the app service redirect some logs..."
13 created, 2 errored

That's pulumi-command losing the SSH transport while streaming a remote command's output — not the remote script failing. Two things worth knowing:

  • the curl inside that script returned HTTP/1.1 200 OK, so the app was up and the VM was fully provisioned;
  • vm_logs is the last provisioning step (virtual_machine_provider.py) and it's purely diagnostic — it copies /var/log out for the artifacts.

So a dropped SSH write while copying logs failed the stack → failed provisioning → every test asserted on provision_install_error → job failed → release blocked.

Changes

  • add 124 to retry:exit_codes in .gitlab/ssi_gitlab-ci.yml
  • add "pulumi_command_short_write": "error: short write: running" to aws_infra_exceptions.json

The second one routes the error through the existing known-infra-error path: destroy the stack, send a result:retry event, pytest.exit(returncode=3) → the job is retried. No new retry mechanism.

Note on the previous version of this PR

The first version also made unknown provisioning failures exit 3 so they'd be retried. Reverted per review — unknown failures keep failing the job, as before. Only errors we've explicitly identified get retried.

Why not make vm_logs non-fatal instead

Pulumi has no per-resource "tolerate failure" option, so that would mean moving the log extraction out of the Pulumi graph entirely. Bigger change than this is worth; happy to do it separately if you'd prefer.

🤖 Written with Claude Code

When Pulumi fails to provision a VM, `_handle_provision_error` matches the error
text against `aws_infra_exceptions.json`. A known message tears the stack down and
exits 3, so GitLab retries the job (`retry:exit_codes`). Anything else was stashed
on the VM object and returned normally, resurfacing later as an assert inside the
tests ("There are previous errors in the virtual machine provisioning steps") —
pytest then exits 1, which reads as a test failure and is never retried.

A single transient infra flake whose message happened not to be in that list would
therefore fail the SSI stage for good and block the release pipeline, needing a
manual retry every time.

Exit 3 on unknown provisioning failures too. A provisioning failure is not a test
result: the tests never ran. Teardown is unchanged — `pytest.exit` unwinds through
`pytest_sessionstart`, which calls `close_targets()` to download the VM logs and
destroy the stack, so each of the 3 attempts starts clean and the logs are still
collected. The Datadog event is unchanged, so `result:fail` now measures exactly
the unknown-provisioning-failure rate, and `aws_infra_exceptions.json` no longer
gates whether a job is retried.

Also add 124 to the onboarding job's retry exit codes, matching the docker SSI job
(`run.sh` is wrapped in `timeout 3000`).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

CODEOWNERS have been resolved as:

.gitlab/ssi_gitlab-ci.yml                                               @DataDog/system-tests-core
utils/virtual_machine/aws_infra_exceptions.json                         @DataDog/system-tests-core

@ddmatan
ddmatan marked this pull request as ready for review August 27, 2026 19:16
@ddmatan
ddmatan requested a review from a team as a code owner August 27, 2026 19:16
@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Aug 27, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

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

@natitsechanski natitsechanski 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.

lgtm

@cbeauchesne cbeauchesne left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AGTM, but @robertomonteromiguel will have a better educated opinion.

@robertomonteromiguel robertomonteromiguel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

agree to include the 124 exit code for the retries (timeout), but not agree to retry the job in the provision failure is unknown

Comment thread utils/virtual_machine/aws_provider.py Outdated
Per review: unknown provisioning failures should keep failing the job,
so revert aws_provider.py to main.

The failure that actually blocked the release pipeline was
`error: short write: running ...` on the vm_logs step. That is
pulumi-command losing the SSH transport while streaming output, not the
remote script failing -- the VM was fully provisioned and vm_logs is the
last, purely diagnostic step. Adding it to aws_infra_exceptions.json
routes it through the existing known-infra-error path.

🤖 Written with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ddmatan ddmatan changed the title Retry the CI job on unknown VM provisioning failures Retry SSI jobs on scenario timeouts and on the pulumi "short write" error Aug 28, 2026
@ddmatan
ddmatan enabled auto-merge (squash) August 28, 2026 15:41
@ddmatan
ddmatan merged commit b8e6df6 into main Aug 28, 2026
1241 checks passed
@ddmatan
ddmatan deleted the matan.perry/add-retry-ssi-templates branch August 28, 2026 17:07
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.

4 participants