name: gitops-workflow description: complete lifecycle for making changes, from PR to ArgoCD sync
GitOps Workflow
This skill covers the entire lifecycle of a change in this repository, from creating a branch to verifying the deployment in ArgoCD.
1. Development and PR Creation
[!CAUTION] NEVER push directly to
main. Themainbranch is protected and pushes will be rejected. You MUST always create a feature branch BEFORE committing. If you have already committed tomainby mistake, see the recovery steps below.
- Prepare Main: Ensure you are on the latest
main.git checkout main git pull origin main - Feature Branch: Create a descriptive branch before making any commits.
git checkout -b <branch-name> - Commit & Push:
git add . git commit -m "<commit-message>" git push -u origin <branch-name> - Create PR & Auto-Merge:
gh pr create --fill gh pr merge --auto --merge
Recovery: Accidental Commit to Main
If you've already committed to main, move the commit(s) to a feature branch:
# Create a branch at the current commit
git branch <branch-name>
# Reset main back (soft keeps changes staged)
git reset HEAD~1 --soft
# Discard the staged changes on main (they're safe on the branch)
git checkout -- .
# Switch to the feature branch and push
git checkout <branch-name>
git push -u origin <branch-name>
2. CI Verification and Merge
- Watch Checks: Pause until CI completes.
gh pr checks --watch- If checks fail: Investigate logs immediately:
gh run view --log-failed
- If checks fail: Investigate logs immediately:
- Verify Merge: Confirm the PR has reached the
MERGEDstate.gh pr view --json state -q .state
3. Post-Merge Sync and Deployment
- Update Local Main:
git checkout main git pull origin main - Verify ArgoCD Sync: Confirm the change is applied to the cluster.
# App name is usually the directory name or found in argocd.yaml kubectl get app -n argocd <app-name> - Verify Health: Ensure the application transitions to
HealthyandSynced.
Standards
- Auto-Sync: Most applications have
prune: trueandselfHeal: true. - Diagnostics: If the app is not healthy, use the
k8s-diagnosticskill to investigate.