fix(ci): resolve Docker build race condition #46

Merged
cpfarhood merged 1 commits from fix/ci-race-condition into main 2026-02-23 21:18:05 +00:00
cpfarhood commented 2026-02-23 21:06:09 +00:00 (Migrated from github.com)

Summary

Fixes a race condition where release-unified.yaml and build-and-push.yaml would both build and push the Docker image during releases, with the losing build potentially overwriting :latest with a stale image (missing tools like crush and opencode).

Root Cause

When release-unified.yaml runs a release:

  1. It pushes a "chore: release version X.Y.Z" commit to main → triggers build-and-push.yaml
  2. It pushes a v* tag → triggers build-and-push.yaml again
  3. It builds the Docker image itself and pushes :latest

This creates up to 3 concurrent Docker builds racing to push :latest. The build-and-push.yaml builds use GHA layer cache which may serve stale layers from before new Dockerfile changes, overwriting the correct :latest image.

Changes

  • Remove tags: ['v*'] triggerrelease-unified.yaml already handles the full release flow (Docker build + Helm chart + GitHub release)
  • Remove duplicate release job — Helm packaging and GitHub release creation are handled by release-unified.yaml
  • Remove semver tag patterns from metadata — not needed without tag trigger
  • Skip builds from github-actions[bot] — prevents the "chore: release version" commit from triggering a racing build

After this fix

Trigger Workflow Action
Push to main (regular) build-and-push.yaml Build + push :latest, :main, :sha-xxx
Push to main (release commit) build-and-push.yaml Skipped (actor is github-actions[bot])
Tag v* push build-and-push.yaml Skipped (trigger removed)
PR to main build-and-push.yaml Build only (no push)
Manual release release-unified.yaml Full release: Docker + Helm + GitHub Release

Test plan

  • Trigger a manual release via release-unified.yaml and verify only one Docker build runs
  • Verify :latest image contains crush and opencode after release
  • Verify regular pushes to main still build and push correctly
  • Verify PRs still build (but don't push)

🤖 Generated with Claude Code

## Summary Fixes a race condition where `release-unified.yaml` and `build-and-push.yaml` would both build and push the Docker image during releases, with the losing build potentially overwriting `:latest` with a stale image (missing tools like `crush` and `opencode`). ### Root Cause When `release-unified.yaml` runs a release: 1. It pushes a "chore: release version X.Y.Z" commit to `main` → triggers `build-and-push.yaml` 2. It pushes a `v*` tag → triggers `build-and-push.yaml` again 3. It builds the Docker image itself and pushes `:latest` This creates **up to 3 concurrent Docker builds** racing to push `:latest`. The `build-and-push.yaml` builds use GHA layer cache which may serve stale layers from before new Dockerfile changes, overwriting the correct `:latest` image. ### Changes - **Remove `tags: ['v*']` trigger** — `release-unified.yaml` already handles the full release flow (Docker build + Helm chart + GitHub release) - **Remove duplicate `release` job** — Helm packaging and GitHub release creation are handled by `release-unified.yaml` - **Remove semver tag patterns from metadata** — not needed without tag trigger - **Skip builds from `github-actions[bot]`** — prevents the "chore: release version" commit from triggering a racing build ### After this fix | Trigger | Workflow | Action | |---------|----------|--------| | Push to main (regular) | `build-and-push.yaml` | Build + push `:latest`, `:main`, `:sha-xxx` | | Push to main (release commit) | `build-and-push.yaml` | **Skipped** (actor is github-actions[bot]) | | Tag `v*` push | `build-and-push.yaml` | **Skipped** (trigger removed) | | PR to main | `build-and-push.yaml` | Build only (no push) | | Manual release | `release-unified.yaml` | Full release: Docker + Helm + GitHub Release | ## Test plan - [ ] Trigger a manual release via `release-unified.yaml` and verify only one Docker build runs - [ ] Verify `:latest` image contains `crush` and `opencode` after release - [ ] Verify regular pushes to main still build and push correctly - [ ] Verify PRs still build (but don't push) 🤖 Generated with [Claude Code](https://claude.ai/code)
Sign in to join this conversation.