mumoshu / terraform-provider-helmfile

Deploy Helmfile releases from Terraform
125 stars 20 forks source link

Error code when kubectl is not found #2

Open andrewnazarov opened 4 years ago

andrewnazarov commented 4 years ago

We run terraform from CI/CD pipeline. Trying this provider I forgot to install kubectl to the image containing terraform and stuff. So the following error occured:

panic: unexpected error: exec: "kubectl": executable file not found in $PATH

goroutine 425 [running]:
github.com/roboll/helmfile/pkg/helmexec.combinedOutput(0xc000311ce0, 0x0, 0x91, 0xc00034df80, 0xc000486000, 0x91, 0x100)
    /home/circleci/workspace/helmfile/pkg/helmexec/runner.go:69 +0x45d
github.com/roboll/helmfile/pkg/helmexec.ShellRunner.Execute(0x1340b14, 0x1, 0x0, 0xc000450060, 0x7, 0xc00034c660, 0x3, 0x3, 0xc00034df80, 0xc00034df80, ...)
    /home/circleci/workspace/helmfile/pkg/helmexec/runner.go:36 +0xd9
github.com/roboll/helmfile/pkg/event.(*Bus).Trigger(0xc00084f480, 0x1345816, 0x7, 0x0, 0x0, 0xc00084f450, 0x10e35c0, 0xc00084f498, 0x519c97)
    /home/circleci/workspace/helmfile/pkg/event/bus.go:96 +0x906
github.com/roboll/helmfile/pkg/state.(*HelmState).triggerReleaseEvent(0xc00024dc00, 0x1345816, 0x7, 0x0, 0x0, 0xc0006ca4d0, 0x1341d68, 0x4, 0x0, 0x0, ...)
    /home/circleci/workspace/helmfile/pkg/state/state.go:1364 +0x2d0
github.com/roboll/helmfile/pkg/state.(*HelmState).triggerPresyncEvent(...)
    /home/circleci/workspace/helmfile/pkg/state/state.go:1343
github.com/roboll/helmfile/pkg/state.(*HelmState).SyncReleases.func2(0x12)
    /home/circleci/workspace/helmfile/pkg/state/state.go:572 +0x1e7
github.com/roboll/helmfile/pkg/state.(*HelmState).scatterGather.func1(0xc00024dc00, 0xc00022c040, 0xc00004c0c0, 0xc00022c050, 0x12)
    /home/circleci/workspace/helmfile/pkg/state/state_run.go:42 +0x124
created by github.com/roboll/helmfile/pkg/state.(*HelmState).scatterGather
    /home/circleci/workspace/helmfile/pkg/state/state_run.go:40 +0x1bc

And the processing was stopped. But the return code was like everything went well. The pipeline is green.

andrewnazarov commented 4 years ago

More on that. The subsequent run was very strange regarding of terraform plan stage. It showed some diff in diff_output = <<~EOT, but then a lot of errors appeared for every release we have in helmfile.yaml. The errors were as simple as the following:

err 23: failed processing release prom: helm exited with status 2:
              Error: identified at least one change, exiting with non-zero exit code (detailed-exitcode parameter enabled)
              Error: plugin "diff" exited with error

I don't know if it's related to the first error with kubectl or not. And this pipeline was green as well.

andrewnazarov commented 4 years ago

It seems that Error: plugin "diff" exited with error is normal behaviour.

Then, the only problem here is mentioned in the initial message. So, it doesn't find the tool that is used in hooks and produces the error, but the error code says that everything is fine to the CI tool.

mumoshu commented 4 years ago

@andrewnazarov I think this is not reproducible now. Would you mind confirming?

andrewnazarov commented 4 years ago

I'll try to check this out soon.