fix: Prevent Docker multi-arch race condition (fixes #328) (#334)

* fix: Prevent Docker multi-arch race condition (fixes #328)

Resolves race condition where docker-build.yml and release.yml both
push to 'latest' tag simultaneously, causing temporary ARM64-only
manifest that breaks AMD64 users.

Root Cause Analysis:
- During v2.20.0 release, 5 workflows ran concurrently on same commit
- docker-build.yml (triggered by main push + v* tag)
- release.yml (triggered by package.json version change)
- Both workflows pushed to 'latest' tag with no coordination
- Temporal window existed where only ARM64 platform was available

Changes - docker-build.yml:
- Remove v* tag trigger (let release.yml handle versioned releases)
- Add concurrency group to prevent overlapping runs on same branch
- Enable build cache (change no-cache: true -> false)
- Add cache-from/cache-to for consistency with release.yml
- Add multi-arch manifest verification after push

Changes - release.yml:
- Update concurrency group to be ref-specific (release-${{ github.ref }})
- Add multi-arch manifest verification for 'latest' tag
- Add multi-arch manifest verification for version tag
- Add 5s delay before verification to ensure registry processes push

Impact:
 Eliminates race condition between workflows
 Ensures 'latest' tag always has both AMD64 and ARM64
 Faster builds (caching enabled in docker-build.yml)
 Automatic verification catches incomplete pushes
 Clearer separation: docker-build.yml for CI, release.yml for releases

Testing:
- TypeScript compilation passes
- YAML syntax validated
- Will test on feature branch before merge

Closes #328

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

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Address code review - use shared concurrency group and add retry logic

Critical fixes based on code review feedback:

1. CRITICAL: Fixed concurrency groups to be shared between workflows
   - Changed from workflow-specific groups to shared 'docker-push-${{ github.ref }}'
   - This actually prevents the race condition (previous groups were isolated)
   - Both workflows now serialize Docker pushes to prevent simultaneous updates

2. Added retry logic with exponential backoff
   - Replaced fixed 5s sleep with intelligent retry mechanism
   - Retries up to 5 times with exponential backoff: 2s, 4s, 8s, 16s
   - Accounts for registry propagation delays
   - Fails fast if manifest is still incomplete after all retries

3. Improved Railway build job
   - Added 'needs: build' dependency to ensure sequential execution
   - Enabled caching (no-cache: false) for faster builds
   - Added cache-from/cache-to for consistency

4. Enhanced verification messaging
   - Clarified version tag format (without 'v' prefix)
   - Added attempt counters and wait time indicators
   - Better error messages with full manifest output

Previous Issue:
- docker-build.yml used group: docker-build-${{ github.ref }}
- release.yml used group: release-${{ github.ref }}
- These are DIFFERENT groups, so no serialization occurred

Fixed:
- Both now use group: docker-push-${{ github.ref }}
- Workflows will wait for each other to complete
- Race condition eliminated

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

Co-Authored-By: Claude <noreply@anthropic.com>

* chore: bump version to 2.20.1 and update CHANGELOG

Version Changes:
- package.json: 2.20.0 → 2.20.1
- package.runtime.json: 2.19.6 → 2.20.1 (sync with main version)

CHANGELOG Updates:
- Added comprehensive v2.20.1 entry documenting Issue #328 fix
- Detailed problem analysis with race condition timeline
- Root cause explanation (separate concurrency groups)
- Complete list of fixes and improvements
- Before/after comparison showing impact
- Technical details on concurrency serialization and retry logic
- References to issue #328, PR #334, and code review

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

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Romuald Członkowski
2025-10-18 20:32:20 +02:00
committed by GitHub
parent 5881304ed8
commit 05f68b8ea1
5 changed files with 318 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "n8n-mcp-runtime",
"version": "2.19.6",
"version": "2.20.1",
"description": "n8n MCP Server Runtime Dependencies Only",
"private": true,
"dependencies": {