Skip to content

Recover the release when mvn deploy fails after the Central upload - #16

Merged
DRMacIver merged 1 commit into
mainfrom
release-recover-after-upload
Aug 13, 2026
Merged

Recover the release when mvn deploy fails after the Central upload#16
DRMacIver merged 1 commit into
mainfrom
release-recover-after-upload

Conversation

@DRMacIver

@DRMacIver DRMacIver commented Aug 13, 2026

Copy link
Copy Markdown
Member
Details ## Problem

The release job for v0.4.2 (run 31701259508) successfully uploaded and published to Maven Central, but the central-publishing plugin's wait-until-published poll hit a transient 502 from Sonatype and failed the build:

[INFO] Uploaded bundle successfully, deploymentId: 6446000a-... Deployment will publish automatically
[INFO] Waiting until Deployment 6446000a-... is published
[ERROR] ... Cannot get deployment status. Response status code: 502

Once the bundle is uploaded, the deployment validates and publishes server-side regardless of how the mvn process exits. So the failure aborted release.py after the version was irrevocably going out but before any git bookkeeping: 0.4.2 went live on Central with no version-bump commit, no changelog entry, no v0.4.2 tag, and no GitHub release — and with RELEASE.md still on main, the next push would have attempted to release 0.4.2 again and collided with the published version.

Fix

release.py no longer treats a nonzero mvn deploy exit as unconditionally fatal. It now:

  • streams the mvn output and watches for the plugin's Uploaded bundle successfully marker;
  • on failure after a successful upload, polls the Central Publisher API (/api/v1/publisher/published, using the existing CENTRAL_TOKEN_* credentials) for up to 10 minutes, and continues with the commit/tag/GitHub release once the version is live;
  • on failure without an upload, does a single published-check before re-raising. This makes a failed release job safely re-runnable: the re-run's upload is rejected as a duplicate of the already-published version, the check sees the version live, and the bookkeeping completes.

If the version never shows up as published, the original failure is re-raised and the job fails exactly as before.

The recovery paths are exercised by stubbing run_deploy/is_published: deploy-fails-but-published continues, deploy-fails-unpublished re-raises immediately, uploaded-but-never-publishes raises after the deadline, missing credentials re-raise without touching the API, and the success path is unchanged.

(The v0.4.2 incident itself was repaired by hand: bookkeeping commit, tag, and GitHub release replayed on main.)

🤖 Generated with Claude Code

The release job for v0.4.2 (run 31701259508) published to Maven Central
but then crashed: the central-publishing plugin's wait-until-published
poll hit a transient 502 and failed the build after the bundle had
already uploaded (deployments publish server-side from that point on).
That aborted release.py before the git bookkeeping, stranding a
published version with no tag, changelog entry, or GitHub release — and
the next release attempt would collide with the already-published
version.

On a nonzero mvn exit, release.py now checks the Central Publisher API
for whether the new version is live before giving up: polling for up to
10 minutes when the upload succeeded (detected from the plugin's output),
or a single check otherwise. If the version is published, the release
continues with the commit/tag/GitHub release. The single check also
makes a failed release job safely re-runnable: the re-run's deploy fails
on the duplicate version, the check sees it live, and the bookkeeping
completes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@DRMacIver
DRMacIver merged commit 7536219 into main Aug 13, 2026
8 checks passed
@DRMacIver
DRMacIver deleted the release-recover-after-upload branch August 13, 2026 13:21
@DRMacIver DRMacIver mentioned this pull request Aug 13, 2026
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.

1 participant