Skip to content

ci(release): add rebase step before versioning to prevent push race#525

Open
charlesmulder wants to merge 3 commits into
RedHatInsights:mainfrom
charlesmulder:cm-rebase-before-release
Open

ci(release): add rebase step before versioning to prevent push race#525
charlesmulder wants to merge 3 commits into
RedHatInsights:mainfrom
charlesmulder:cm-rebase-before-release

Conversation

@charlesmulder

@charlesmulder charlesmulder commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Description

Added rebase steps and deferred npm publish in release action to prevent push failures and orphaned npm versions.

Problem 1 - Push failures: Release jobs check out github.sha (triggering commit), not main tip. When a PR merges to main while a release job is running, git push --follow-tags fails with non-fast-forward error.

Problem 2 - Tag resolution: verify-versions.sh and nx release use git tag --merged HEAD to resolve current version. Stale checkout can't see tags from prior queued releases → false mismatches.

Problem 3 - Orphaned npm versions: nx release --yes publishes to npm before git push. If push fails, npm has new versions but git doesn't → manual recovery required.

Solution:

  1. Rebase before verify-versions (fast-forward, brings in latest tags so --merged HEAD sees them)
  2. nx release --skip-publish (defer npm publish)
  3. Rebase before push (replays version commit if main moved during release)
  4. nx release publish (only after push succeeds)

Already present: Concurrency group with cancel-in-progress: false serializes release jobs.


CI validation: Merge and observe next automated release. Check that:

  • Release job completes successfully
  • Version commits/tags pushed to main
  • Packages published to npm registry
  • No "non-fast-forward" errors in logs
  • No orphaned npm versions if push fails

Anything reviewers should know?

  • Two rebase calls: first is always fast-forward (no local commits), second replays only the version commit
  • --skip-publish prevents publish in main nx release invocation; standalone nx release publish handles publish after push
  • If push fails (edge case: commit lands between rebase and push), re-running is safe — no npm versions published yet
  • Comments explain why each rebase is needed

Checklist

  • Tests: N/A (CI infrastructure change, validated by workflow execution)
  • API: N/A (no API changes)
  • Migrations: N/A (no schema changes)
  • Dependencies: N/A (no dependency changes)
  • Security: N/A (read-only git operations in trusted CI context)

AI disclosure

Assisted by: Claude Code

@charlesmulder
charlesmulder requested a review from a team as a code owner July 21, 2026 15:19
tahmidefaz
tahmidefaz previously approved these changes Jul 21, 2026
justinorringer
justinorringer previously approved these changes Jul 21, 2026
Comment thread .github/actions/release/action.yaml
@charlesmulder
charlesmulder dismissed stale reviews from justinorringer and tahmidefaz via 5f4c815 July 22, 2026 08:17
@charlesmulder
charlesmulder force-pushed the cm-rebase-before-release branch from dd9b86c to 5f4c815 Compare July 22, 2026 08:17
@charlesmulder charlesmulder changed the title ci(release): add rebase step before versioning to prevent push race w… ci(release): add rebase step before versioning to prevent push race Jul 22, 2026
@charlesmulder
charlesmulder marked this pull request as draft July 22, 2026 09:09
@charlesmulder
charlesmulder force-pushed the cm-rebase-before-release branch from 5f4c815 to ce71bd7 Compare July 22, 2026 09:45
@charlesmulder
charlesmulder marked this pull request as ready for review July 22, 2026 09:45
@charlesmulder
charlesmulder marked this pull request as draft July 22, 2026 10:05
Comment thread .github/actions/release/action.yaml
@charlesmulder
charlesmulder force-pushed the cm-rebase-before-release branch 3 times, most recently from a153481 to 0a9f6e2 Compare July 22, 2026 11:11
@charlesmulder
charlesmulder marked this pull request as ready for review July 22, 2026 11:14
@charlesmulder
charlesmulder marked this pull request as draft July 22, 2026 11:19
@charlesmulder
charlesmulder marked this pull request as ready for review July 22, 2026 12:19
@charlesmulder
charlesmulder force-pushed the cm-rebase-before-release branch from b0f09f1 to ae67090 Compare July 22, 2026 13:08
@charlesmulder
charlesmulder marked this pull request as draft July 23, 2026 09:09
@charlesmulder
charlesmulder marked this pull request as ready for review July 23, 2026 11:25
@charlesmulder
charlesmulder force-pushed the cm-rebase-before-release branch from 6cc77f1 to ff7338d Compare July 23, 2026 11:37
if [[ "$disk_ver" == "$tag_ver" && "$disk_ver" == "$npm_ver" ]]; then
status="OK"
marker="✓"
elif [[ "$npm_ver" == "REGISTRY_ERROR" ]]; then

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.

I'm wondering what happens if $npm_ver is "NOT_ON_NPM" here? Do we need another elif?

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.

5 participants