Hello,
First, want to say how neat Argo-cd is and how useful it has been.
I was wondering if anyone has or plans to build a preview environment feature on Argo-cd? This would be similar to a feature that Jenkins-x has that is really neat. I have thoughts on how it could work, but wondered if it made any sense.
Thanks!
@gregdurham preview environments can be done in argo-cd but would need be handled the pipeline. In fact, we have some internal users doing just this. The Jenkinsfile does something to the effect of:
if new PR {
argocd app create app-preview-<pr_number> \
--repo <pr_repo> \
--revision <pr_branch> \
--path <path_in_app> \
--dest-namespace <preview-namespace> \
--dest-cluster <preview-cluster>
argocd app create app-preview-<pr_number>
argocd app sync app-preview-<pr_number>
} else if updated PR {
argocd app sync app-preview-<pr_number>
} else if closed PR {
argocd app delete app-preview-<pr_number>
}
@marcb1 has started working on https://github.com/marcb1/argocd-bot. The bot responds to argo diff command and renders expected changes in affected target clusters.
I think preview environment might be another bot feature. The user might send command e.g. argo preview and bot should run argocd app create app-preview-<pr_number>, send back preview app link and delete app when PR closed.
A wonderingment, could this be a standard feature for configured repos. E.g. Add something to the ConfigMap:
previews:
- repo: http://github.com/foo/bar
namespace: preview
foo: bar
And this would deploy all pull requests for that to an environment.
If that deployment passes or fail, then set the status to the PR:
https://help.github.com/en/articles/about-status-checks
Obviously, deleting when complete.
Resources
@gregdurham - I've been working on this yesterday and I have today and maybe tomorrow morning to complete it. I'd like to get your input on various aspects. Are you free to chat today please?
@alexec are there docs on how your feature works, I want to implement this functionality in my deployment bot, not sure how to leverage your changes. Are you simply relying on webhooks to auto deploy each PR?
Hey @Alexec sorry about the delay! Would love to chat about this and take a look. Thanks for looking into this.
Hi - @marcb1 , we've put this work on hold for the moment as we think about how we want third-party integrations to work.
You can take a look at the POC for this: https://github.com/argoproj/argo-cd/pull/1262/files
Essentially,

Most helpful comment
@marcb1 has started working on https://github.com/marcb1/argocd-bot. The bot responds to
argo diffcommand and renders expected changes in affected target clusters.I think
preview environmentmight be another bot feature. The user might send command e.g.argo previewand bot should runargocd app create app-preview-<pr_number>, send back preview app link and delete app when PR closed.