helmfile/helmfile

Can't run helmfile apply if bash -e is set due to helm-diff --detailed-statuscode

ejrinkus opened this issue · 1 comments

Operating system

Ubuntu 22.04

Helmfile Version

v0.148.1

Helm Version

v.3.7.2

Bug description

We use Github Actions for our CI, and generally run our kube/helm/helmfile commands in shell steps. GH Actions also sets -e by default, so if anything returns an exitcode it'll automatically fail that step on the spot.

This became a problem when calling helmfile apply because it calls helm diff under the hood with the --detailed-exitcode flag enabled. The only workaround I was able to get working was to do helmfile apply || true to suppress the exitcode. However, this means that any exitcode, even real errors, get suppressed, which I really want to avoid.

I took a peek at the source code, and AFAIK even the latest version of helmfile doesn't provide a way to disable this flag to helm diff. Would it be possible to get an option to disable this flag? Or is there another way that people work around this issue that I'm missing? I'm pretty new to k8s/helm/helmfile, but I wasn't able to find any issues on here or anything else in Google that indicated a better solution. We can't use sync either, because that times out (I actually switched to apply specifically because sync was timing out, and that's when I hit this issue).

Example helmfile.yaml

Create a bash script that sets -e, and then run a helmfile apply on any helmfile that has a diff against whatever is deployed. This should replicate the issue. Alternatively, run the helmfile apply from a github shell action.

Error message you've seen (if any)

Error: identified at least one change, exiting with non-zero exit code (detailed-exitcode parameter enabled)
Error: plugin "diff" exited with error

Steps to reproduce

See the text in the example helmfile above, I don't have a repo that I'm able to share

Working Helmfile Version

N/A (we used to use 0.145.0, I upgraded to 0.148.1 so that init was an available command, but I believe both versions are affected)

Relevant discussion

No response

helmfile diff && helmfile sync