argocd-commenter
argocd-commenter copied to clipboard
Preview environments using ApplicationSets
Context
ArgoCD has a concept of ApplicationSets, which are basically templates for ArgoCD Applications. These offer various different Generators to essentially template full Apps from some data source.
One very interesting looking generator is the Pull Request Generator, which will generate one Application for each pull request in a repository. The templated Application manifest may use any of the template variables that the generator provides, such as branch name or PR number.
This, in theory already lets you implement per-PR preview environments purely in ArgoCD.
Where argocd-commenter comes in
I'd like to use GitHub deployment statuses for preview environments as described above. The readme already has an example on how to use deployment statuses with argocd-commenter. However, that example doesn't use ApplicationSets, but rather manually commits a copy of the Application into the sync repository for every pull request.
What I'd love to be able to do is somehow have argocd-commenter (in GitHub deployment mode, not comment mode) work with the pull request generator:
- someone creates a PR
- argocd picks up the PR, templates an application, creates resources
- argocd-commenter sees this and (through arcane magic) creates/updates a deployment status for the pull request, linking to a known preview url (a combination of repo+branch+sha, maybe?)
- PR gets merged or closed
- the pull request generator deletes the application and cleans up after itself
- argocd-commenter updates the deployment status accordingly
GitHub deployments already support "transient environments" that are meant to come and go for things like temporary previews.
Additional information
I know this is a big and very vague feature request, and I'm sorry if it's out of scope for argocd-commenter.
I just love the way GitHub deployment statuses are presented to the user. I tried making something like this a while ago, but realized I was (accidentally) trying to build argocd+argocd-commenter from scratch :b
soo.. let me know what you think!