Skip to content

Comments

feat: --target-revision | -r flag#594

Merged
Q-Dub merged 3 commits intomainfrom
EAI-1436_feat_target_revision_flag
Feb 19, 2026
Merged

feat: --target-revision | -r flag#594
Q-Dub merged 3 commits intomainfrom
EAI-1436_feat_target_revision_flag

Conversation

@Q-Dub
Copy link
Contributor

@Q-Dub Q-Dub commented Feb 17, 2026

Add --target-revision flag for bootstrap script with git ancestry validation

Summary
This PR introduces a new --target-revision (-r) flag to the cluster-forge bootstrap script, allowing developers to bootstrap clusters from specific git revisions (branches, tags, or commits) while maintaining compatibility guarantees through git ancestry validation.
Problem Statement
Previously, the bootstrap script was hardcoded to use specific versions (v1.8.0-rc2), making it difficult for developers to:

  • Test feature branches during development
  • Bootstrap from specific releases or commits
  • Validate cluster-forge changes before merging
    Additionally, there was a timing issue where ArgoCD applications would initially sync to the hardcoded revision before eventually switching to the intended target revision, causing unnecessary syncs.

Solution
🚀 Feature Implementation (commit 7dc274a)

  • New CLI flag: -r/--target-revision with support for branches, tags, and commits
  • Git ancestry validation: Ensures compatibility by checking that target revision is based on v1.8.0-rc1+
  • Remote branch support: Handles both local branches and origin/branch-name patterns
  • Simplified architecture: Removes pre-v1.8.0 compatibility complexity
  • Enhanced error messages: Clear feedback for unsupported revisions
    🔧 Timing Fix (commit b5a0898)
  • Immediate sync: ArgoCD applications now sync directly to specified revision from creation
  • Architectural consistency: Maintains cluster-values repo override pattern
  • Eliminates delay: No more initial sync to wrong revision followed by correction
    🧹 Template Cleanup (commit ded11b6)
  • Remove v1.7.0 compatibility: Clean up conditional clusterSize logic
  • Simplify template: global.clusterSize now always defined by bootstrap script
  • Updated comments: Remove outdated backwards compatibility references

Usage Examples

  • Bootstrap from a feature branch
    ./scripts/bootstrap.sh -r=EAI-1436_validation cluster.example.com
  • Bootstrap from a specific tag
    ./scripts/bootstrap.sh --target-revision=v1.8.2 prod.example.com
  • Bootstrap from main (default behavior)
    ./scripts/bootstrap.sh cluster.example.com
  • Combined with cluster size
    ./scripts/bootstrap.sh -r=feature-branch -s=small dev.example.com

Validation & Safety

  • ✅ Git ancestry checking: Only allows revisions based on v1.8.0-rc1 or later
  • ✅ Remote branch detection: Automatically finds origin/branch-name if local branch missing
  • ✅ Backwards compatibility: Existing usage patterns continue to work
  • ✅ Clear error messages: Helpful guidance for unsupported revisions
  • ✅ Syntax validation: All bash syntax checks pass

Impact
Benefits

  • 🎯 Developer productivity: Easy testing of feature branches
  • 🚀 Faster feedback: No wrong initial syncs
  • 🧹 Cleaner codebase: Removed technical debt from v1.7.0 era
  • 📋 Better UX: Clear validation and helpful error messages

Files Modified

  • scripts/bootstrap.sh - Core feature implementation (+250/-131 lines)
  • root/templates/cluster-forge.yaml - Template cleanup (-8/+1 lines)
  • root/templates/_helpers.yaml - Minor comment fix (+1 line)
  • scripts/init-gitea-job/values.yaml - Updated defaults (+12/-12 lines)

Testing
The feature has been tested with:

  • ✅ Valid feature branches (e.g., EAI-1436_validation)
  • ✅ Semantic version tags (e.g., v1.8.0, v1.8.2)
  • ✅ Main branch (default behavior)
  • ✅ Remote-only branches (origin/branch-name)
  • ✅ Invalid pre-v1.8.0 revisions (properly rejected)

Breaking Changes: None. All existing bootstrap script usage continues to work as before.

@Q-Dub Q-Dub requested a review from a team as a code owner February 17, 2026 11:46
@Q-Dub Q-Dub marked this pull request as draft February 17, 2026 15:11
@Q-Dub Q-Dub force-pushed the EAI-1436_feat_target_revision_flag branch from 6d4537c to d46b38c Compare February 18, 2026 17:27
Add support for specifying target revision when bootstrapping cluster-forge:
- New -r/--target-revision flag for bootstrap script
- Git ancestry validation ensures only v1.8.0-rc1+ compatible revisions
- Support for branches, tags, and commit hashes
- Handles both local and remote branches (origin/branch-name)
- Enhanced argument parsing with backwards compatibility
- Simplified validation removes pre-v1.8.0 support complexity

The flag allows developers to bootstrap from feature branches while
ensuring compatibility with the v1.8.0+ architecture requirements.
@Q-Dub Q-Dub force-pushed the EAI-1436_feat_target_revision_flag branch from 7b3f80b to ded11b6 Compare February 18, 2026 19:19
@Q-Dub Q-Dub marked this pull request as ready for review February 18, 2026 19:19
@Q-Dub Q-Dub enabled auto-merge February 19, 2026 06:46
Copy link
Contributor

@brownzebra brownzebra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@Q-Dub Q-Dub merged commit ee5db21 into main Feb 19, 2026
4 checks passed
@Q-Dub Q-Dub deleted the EAI-1436_feat_target_revision_flag branch February 19, 2026 10:30
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.

2 participants