int128 / argocd-commenter

Notify ArgoCD Application status via Pull Request comment or GitHub Deployment API
Apache License 2.0
128 stars 16 forks source link

Preview environments using ApplicationSets #1079

Open jemand771 opened 5 months ago

jemand771 commented 5 months ago

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:

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 image

soo.. let me know what you think!

int128 commented 4 weeks ago

I rewrote the e2e-test with an ApplicationSet. In the test, I use the Git files generator to inject argocd-commenter.int128.github.io/deployment-url annotation. https://github.com/int128/argocd-commenter/pull/1121/files#diff-8cb411ab3f1f49b519566dd41f3aa708c1c8a6e1375a48d2733345f5a85a9d8eR20-R21

For the pull request generator, it needs some way to interpolate the annotation.