Comments (13)
Yes! Thanks for pointing this out and great find! I'll get it cleaned up with something more appropriate.
from argo-cd-helmfile.
Welcome! argocd plugins execute in 2 phases, an init
phase and a generate
phase. The repo side of it should be dealt with here: https://github.com/travisghansen/argo-cd-helmfile/blob/master/src/argo-cd-helmfile.sh#L353
from argo-cd-helmfile.
Thanks for the quick response.
Ah ok, so that clarifies where the repositories are supposed to be added. I'm only getting an error related to the generate command. ArgoCD doesn't seem to run the init command. I've on purpose modified my helmfile.yaml to produce an error when being processed by helmfile. I would expect ArgoCD to throw me an error that the init command failed because helmfile can't parse the helmfile.yaml file. Instead, I only again see the generate command.
Do you have any ideas why the init command might not be called or how to go about debugging?
from argo-cd-helmfile.
I've added a custom (non-existent) init script via the environment variable. It does fail with a message telling me that the script does not exist, so that leads me to conclude that init is being called. But why the helmfile repos
command is not executed is still unclear to me.
from argo-cd-helmfile.
If any command in the plugin fails the script will exit. So the behavior actually makes sense because the custom init script is executed just before the helmfile repos command.
from argo-cd-helmfile.
Can you send over the application yaml and the version of the plugin currently in use? The only thing I can think of at the moment is there some logic error with the caching logic.
from argo-cd-helmfile.
Yeah I was also zooming in on the caching logic but couldn't find a good way to debug.
This is the application YAML (redacted):
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: abc
spec:
destination:
namespace: ns
server: https://kubernetes.default.svc
project: default
source:
path: apps/abc
plugin:
env:
- name: HELMFILE_TEMPLATE_OPTIONS
value: --environment env-abc --include-crds
repoURL: https://gitlab/aaa/bbb.git
targetRevision: main
syncPolicy:
automated: {}
syncOptions:
- CreateNamespace=true
- ServerSideApply=false
and the helmfile:
bases:
- ../../../../env-dev.yaml
- ../../../../env.yaml
---
repositories:
- name: repo-abc
url: https://aaa.bbb.ccc
releases:
- name: dex
namespace: dex
chart: repo-abc/dex
version: 0.14.1
missingFileHandler: Warn
values:
- ./values.yaml
{{- if .Values.dev }}
- ./overrides/dev/values.yaml
- ./overrides/dev/{{ .Environment.Name }}/values.yaml
{{- else }}
- ./overrides/{{ .Environment.Name }}/values.yaml.gotmpl
{{- end }}
- name: manifests
namespace: dex
chart: ./manifests
Plugin version: travisghansen/argo-cd-helmfile:latest (unfortunately not pinned to a specific version). Is there any way to get more debug logging? To double check that the helmfile repos
command is actually executed.
from argo-cd-helmfile.
Set DEBUG=1
env var for the sidecar or in the app and it will spew a bunch out but it can be hard to find.
from argo-cd-helmfile.
As an intermediate finding I wanted to mention that creating a custom init script that calls the helmfile repos command actually solves the issue. This leads me to conclude that the helmfile repos command is not executed under normal circumstances. Just to validate: do you define repositories in the helmfile and do they work for you? This seems like the most basic of features so I would be surprised if it didn't work at all. I'll continue the investigation.
from argo-cd-helmfile.
I do define the repos in my set of helmfiles. Something is clearly strange in your scenario. Maybe you can exec into the plugin container and try to execute the command directly and debug that way?
from argo-cd-helmfile.
Ok, I figured out why it was failing. My helmfile commands require an environment to be passed as argument otherwise it will fail. I added the HELMFILE_TEMPLATE_OPTIONS environment variable with the required environment setting. I didn't realise until now that I needed to set the HELMFILE_GLOBAL_OPTIONS environment variable so that the helmfile repos
command also uses this argument. I never needed it before because the Helm charts were local to the repo.
I think what happens is, that the helmfile repos
command silently fails without causing the script to error. Without an error you don't see any output and Argo CD will happily proceed to the generate stage. This construction might be a little bit too clever: https://github.com/travisghansen/argo-cd-helmfile/blob/master/src/argo-cd-helmfile.sh#L351
Shellcheck gives some information that might be useful: https://www.shellcheck.net/wiki/SC2015
Bash....so many subtle ways it might fail :-)
I'll leave it to you if you want me to close this issue or that you want to try out my theory regarding the silent failure and potentially fix it with a straight-up if-then-else construct.
from argo-cd-helmfile.
This little snippet clarifies things:
#!/bin/bash
set -e
true && {
helmfile repos --tst
} || {
echo "yo"
}
It will both produce an error because the --tst argument is not recognized and echo "yo". It will then exit with a zero exit code, indicating all went well which is obviously not what you want.
from argo-cd-helmfile.
Fix here: 6299491
Wait for v0.3.6
to build and then give it a try and let me know if it's fixed.
from argo-cd-helmfile.
Related Issues (20)
- Helmfile is moved HOT 2
- Error: unknown flag: --skip-crds HOT 10
- Passing args to helm HOT 11
- Issues related to sidecar CMP mode HOT 13
- Autodiscover with apps in app HOT 10
- adding kustomize transformers: causes breakage HOT 3
- helmfile/vals integration HOT 7
- Namespaces not taken into account HOT 11
- Not allow helm valuesFiles path or Values file as block file with plugin helmfile
- Create Application per Helmfile Release HOT 1
- argo-cd-helmfile.sh discover` failed exit status 1 HOT 1
- Fail to fetch OCI private Helm registry HOT 1
- Integrated ArgoCD plugin parameters support ? HOT 3
- Setting --skip-deps as optional HOT 2
- Not installing crds in folder of helm chart HOT 2
- What about ExternalSecrets instead of sops? HOT 1
- Not able to use secretref+k8s to fetch secrets from Kubernetes Secret object HOT 2
- kubectl context support HOT 3
- Pass helm values from separate repo HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from argo-cd-helmfile.