Skip to content

feat: replace branch preview app-of-apps with ArgoCD ApplicationSet PR generator#49

Merged
Amertz08 merged 1 commit into
mainfrom
cleanup/remove-stale-branch-preview-app
May 15, 2026
Merged

feat: replace branch preview app-of-apps with ArgoCD ApplicationSet PR generator#49
Amertz08 merged 1 commit into
mainfrom
cleanup/remove-stale-branch-preview-app

Conversation

@Amertz08
Copy link
Copy Markdown
Owner

Summary

  • Replaces the manual app-of-apps pattern (GitHub Actions writing Application YAMLs to deploy/argocd/branches/) with an ArgoCD ApplicationSet using the Pull Request generator
  • ArgoCD now polls GitHub directly for open PRs and manages preview Application lifecycle automatically — no more commit noise on main for branch push/delete events
  • Removes reusable-argocd-register.yml and reusable-argocd-cleanup.yml workflows entirely; removes register-branch and cleanup-branch jobs from the API workflow

Behavioral Changes

Aspect Before After
Trigger Branch push PR open
Namespace gitops-example-<safe-branch> gitops-example-pr-<number>
Cleanup Workflow on delete event Automatic on PR close/merge
Branches without PRs Get a preview No preview
Commit noise on main Yes (one per branch push/delete) None
Polling latency Immediate Up to 60 s

Cluster Prerequisites

Before merging, create the GitHub token secret in the cluster:

kubectl -n argocd create secret generic github-token \
  --from-literal=token=<YOUR_TOKEN>

After merging, delete the now-inert umbrella Application:

kubectl -n argocd delete application gitops-example-branches

Test plan

  • Create github-token secret in the argocd namespace
  • Merge this PR
  • Open a test PR on a branch that has had cmd/api/main.go changed (so a branch image exists)
  • Within ~60 s confirm kubectl -n argocd get applications | grep pr- shows gitops-example-pr-<N>
  • Confirm pod is Running in gitops-example-pr-<N> namespace
  • Close/merge the test PR and confirm Application and namespace are removed within ~60 s
  • Push to a branch with no open PR — confirm no Application is created

🤖 Generated with Claude Code

…R generator

ArgoCD now polls GitHub directly for open PRs and manages preview
Application lifecycle automatically, eliminating the git-commit-based
register/cleanup workflows and the commit noise they produced on main.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Amertz08 Amertz08 merged commit e42230d into main May 15, 2026
2 checks passed
@Amertz08 Amertz08 deleted the cleanup/remove-stale-branch-preview-app branch May 15, 2026 16:41
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.

1 participant