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

The plugins fails with an error but return zero output, so in argocd UI we don't see an error #533

Open
ArtemShevelyukhin opened this issue Aug 8, 2023 · 3 comments

Comments

@ArtemShevelyukhin
Copy link

ArtemShevelyukhin commented Aug 8, 2023

Describe the bug
The plugins fails with an error but return zero output, so in argocd UI we don't see an error

To Reproduce
My git repository, which is specified in the source field, contains only "values.yaml" and "Chart.yaml" files (no templates folder at all) and "Chart.yaml" file has some dependencies
And I try to use the plugin with that configuration

Expected behavior
Plugin returns not zero output and we will see an error on the argocd UI

Screenshots/Verbose output
Please check the third line. As you can see it says Plugin command returned zero output but also stderr="Error: An error occurred while checking for chart dependencies...
Seems odd to me

time="2023-08-08T09:08:32Z" level=info msg="finished streaming call with code OK" grpc.code=OK grpc.method=GetParametersAnnouncement grpc.service=plugin.ConfigManagementPluginService grpc.start_time="2023-08-08T09:08:32Z" grpc.time_ms=163.038 span.kind=server system=grpc
time="2023-08-08T09:08:32Z" level=info msg="sh -c \"helm template $ARGOCD_APP_NAME -n $ARGOCD_APP_NAMESPACE ${ARGOCD_ENV_HELM_ARGS} . |\\nargocd-vault-plugin generate -\\n\"" dir=/tmp/_cmp_server/327cadbc-98e7-448a-8f8e-38feb68d971a/new-config-argocd-vault-plugin/envs/argocd-devops-team/a01/solution/applications/cloud execID=7613e
time="2023-08-08T09:08:32Z" level=warning msg="Plugin command returned zero output" command="{[sh -c helm template $ARGOCD_APP_NAME -n $ARGOCD_APP_NAMESPACE ${ARGOCD_ENV_HELM_ARGS} . |\nargocd-vault-plugin generate -\n] []}" stderr="Error: An error occurred while checking for chart dependencies. You may need to run `helm dependency build` to fetch missing dependencies: found in Chart.yaml, but missing in charts/ directory: chart-1, chart-2\n"
time="2023-08-08T09:08:32Z" level=info msg="finished streaming call with code OK" grpc.code=OK grpc.method=GenerateManifest grpc.service=plugin.ConfigManagementPluginService grpc.start_time="2023-08-08T09:08:32Z" grpc.time_ms=251.512 span.kind=server system=grpc
time="2023-08-08T09:08:55Z" level=info msg="Alloc=16236 TotalAlloc=209695 Sys=45677 NumGC=35 Goroutines=7"
@headyj
Copy link

headyj commented Sep 13, 2023

Same here. This is quite annoying and dangerous as it can wipe all resources in the related argocd application as no error code is output. Any news or workaround to fix this issue?

@headyj
Copy link

headyj commented Sep 13, 2023

@ArtemShevelyukhin maybe I found a workaround for that problem, changing a bit my command from:

helm template $ARGOCD_APP_NAME -n $ARGOCD_APP_NAMESPACE ${ARGOCD_ENV_HELM_ARGS} . | argocd-vault-plugin generate -

to:

helm template $ARGOCD_APP_NAME -n $ARGOCD_APP_NAMESPACE ${ARGOCD_ENV_HELM_ARGS} . > result.yaml && argocd-vault-plugin generate result.yaml

which is correctly outputting the helm template error (if any, e.g. a syntax error on the chart)

@jacksgt
Copy link

jacksgt commented Jan 12, 2024

Hi guys,

if you are using a pipe in your command (|) it is critical that the pipefail option is used!
Otherwise the second command in the pipeline silently overwrites any errors from the first command.

So the config should look something like this:

        spec:
          generate:
            command:
              - "sh"
              - "-o"
              - "errexit" # exit on errors
              - "-o"
              - "pipefail" # set exit code to 1 when any command in a pipeline fails
              - "-c" # run the following command
              - "helm template ... | argocd-vault-plugin generate -"

This is also shown incorrectly in the docs, I'll send a PR.

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

3 participants