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

ArgoCD CLI local template #5525

Closed
OmerKahani opened this issue Feb 16, 2021 · 4 comments · Fixed by #10061
Closed

ArgoCD CLI local template #5525

OmerKahani opened this issue Feb 16, 2021 · 4 comments · Fixed by #10061
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest

Comments

@OmerKahani
Copy link
Contributor

OmerKahani commented Feb 16, 2021

Summary

Add CLI command for local templating, mainly when using Helm

Motivation

In order to scan K8s files in PR, they should be templated, but if the application has parameter override, then the user should know how argocd do the templating.

Proposal

add: argocd app template APP_NAME LOCAL_PATH

the output could be to stdout or to a directory

@OmerKahani OmerKahani added the enhancement New feature or request label Feb 16, 2021
@jessesuen
Copy link
Member

We actually do a form of this in argocd app diff --local so it makes sense to have a command for it. But instead of argocd app template it should go under the existing argocd app manifests e.g.:

argocd app manifests APPNAME --local=./path/to/repo

@Cylix
Copy link
Contributor

Cylix commented Oct 30, 2021

Hey all, that sounds like an interesting idea! I'm frequently using argocd app diff --local to preview changes before syncing, but there are a few times I feel something like argocd app manifests --local could come in handy.

If nobody is working on this, I'll get started to implement this!

@fabricepipart1a
Copy link

Hi
I am currently struggling with PR validation with Argo CD like mentioned in this issue. My use case is that I have a PR on the repository watched by Argo and I want to automate the analysis of what has changed in the PR.

As @Cylix seems to be doing, I use argocd app diff --local to get an idea of what has changed.

The problem I have today is when I want to add a new manifest in my repo. argocd app diff --local works fine when the application name is known by Argo CD live instance. If it is not, the command fails.
From there, I see several options that would help me validate the change anyway when I only have manifests in local:

  • argocd app diff --local does not return an error but instead a diff where live is considered empty
  • argocd app list proposes a --local option allowing me to detect the apps that are new compared to the live app list
  • argocd app manifests proposes a --local option allowing me to inspect the manifests that would be generated by my newly introduced app (its definition only exists in local)

@Cylix Do you confirm the changes you're introducing would help for that use case?
Would argocd app manifests APPNAME --local work even if APPNAME is not known by the live instance of Argo ?

@Cylix
Copy link
Contributor

Cylix commented Feb 13, 2022

Hey @fabricepipart1a, I implemented the change in #7658 (pending review).

Unfortunately, this change still relies on APPNAME to be known by the live Argo instance, because I followed the implementation of argocd app diff --local:

  • argocd app manifests --local when APPNAME is known will show the manifests for that app using the local data.
  • argocd app manifests --local when APPNAME is not known will show an error.

argocd app manifests --local using an existing APPNAME not corresponding to your local manifests does work though, but it may interpolate some of that app configuration into the manifests.

crenshaw-dev added a commit that referenced this issue Jul 25, 2022
* feat: argocd app manifests --local option

Signed-off-by: Simon Ninon <simon.ninon@gmail.com>

* fix missing param

Signed-off-by: CI <michael@crenshaw.dev>

* more docs

Signed-off-by: CI <michael@crenshaw.dev>

Co-authored-by: Simon Ninon <simon.ninon@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest
Projects
None yet
5 participants