feat: refactor deployment-guard to v1.1.2 with robust state management #19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🎯 Overview
Complete architectural refactor of the Deployment Guard workflow to v2.0.0, eliminating all fragile temporary file-based state management and fixing critical validation bugs.
🚨 Breaking Changes
verify_image_existencenow defaults totrue(wasfalsein v1.x)falsein your workflow configuration✨ What's New
1. Robust Version Comparison
Complete rewrite of anti-downgrade logic with proper handling of:
-2in25.12.08-2)_abc123in25.12.08_abc123)25.12.08,25.12.08-2,25.12.08_abc,25.12.08-2_abc2. Improved Registry Validation
3. Enhanced Error Reporting
🐛 Bugs Fixed
Bug #1: Rebuild Downgrade Not Detected (Critical)
Issue: v1.x allowed downgrade from
25.12.08-2to25.12.08Root Cause: Only compared base version (YY.MM.DD), ignored rebuild numbers
Fix: Now extracts and compares rebuild numbers when base version is the same
Examples:
25.12.08-2→25.12.08= ✅ Allowed (BUG)25.12.08-2→25.12.08= ❌ Blocked (CORRECT)25.12.08→25.12.08-2= ✅ Allowed (upgrade)25.12.08-2_abc→25.12.08-2_xyz= ✅ Allowed (same version, different hash)Bug #2: Temporary File Race Conditions
Issue: Race conditions with
/tmp/validation_failed.txtfileRoot Cause: Multiple writes to same file, manual cleanup required
Fix: Eliminated ALL temporary files, using in-memory bash arrays
Bug #3: Image Existence Check Failures
Issue: Validation failed for valid private registry images
Root Cause: Only checked Docker Hub canonical image
Fix: Now tries Docker Hub first, then falls back to full image path
Bug #4: Silent Failures in Validation Loops
Issue: Validation could continue after failures
Root Cause: Lack of strict error handling
Fix: Added
set -euo pipefailto all bash scriptsBug #5: Version Pattern Validation Edge Cases
Issue: Malformed tags could pass validation
Root Cause: Regex didn't enforce proper boundaries
Fix: Improved regex validation with proper format checks
🔧 Technical Changes
State Management Architecture
Before (v1.x): Used temporary files
After (v2.0.0): Uses bash arrays
Error Handling
All bash scripts now use strict mode:
set -euo pipefail📝 Documentation
Added comprehensive CHANGELOG.md with:
🧪 Testing
Recommended testing approach:
📊 Test Cases Covered
25.12.08-2→25.12.0825.12.08→25.12.08-225.12.08-2→25.12.08-325.12.08_abc→25.12.08_xyz25.12.07→25.12.0825.12.08→25.12.07🔄 Migration Path
📚 Related Issues
Fixes bugs reported in Deutsche Bank infrastructure validation.
✅ Checklist