Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preview environments using ApplicationSets #1079

Open
jemand771 opened this issue Mar 31, 2024 · 1 comment
Open

Preview environments using ApplicationSets #1079

jemand771 opened this issue Mar 31, 2024 · 1 comment

Comments

@jemand771
Copy link

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
image

soo.. let me know what you think!

@int128
Copy link
Owner

int128 commented Aug 15, 2024

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.

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

No branches or pull requests

2 participants