Skip to content

feat(helm): Detailed exit code for helm plugins - #4367

Merged
technosophos merged 1 commit into
helm:masterfrom
mumoshu:detailed-plugin-exit-code
Jul 23, 2018
Merged

technosophos merged 1 commit into
helm:masterfrom
mumoshu:detailed-plugin-exit-code

Conversation

@mumoshu

@mumoshu mumoshu commented Jul 20, 2018

Copy link
Copy Markdown
Contributor

Resolves #4170

Comment thread cmd/helm/helm.go
cmd := newRootCmd(os.Args[1:])
if err := cmd.Execute(); err != nil {
os.Exit(1)
switch e := err.(type) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be an idiomatic way for this kind of switch as explained in pkg/errors#73 (comment)

Comment thread cmd/helm/load_plugins.go
if eerr, ok := err.(*exec.ExitError); ok {
os.Stderr.Write(eerr.Stderr)
return fmt.Errorf("plugin %q exited with error", md.Name)
status := eerr.Sys().(syscall.WaitStatus)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though this sounds like *unix, it works on windows too.

@technosophos technosophos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@technosophos

Copy link
Copy Markdown
Member

Trying to trick the CLA bot into re-running the check by adding the string "I signed it" into the comment body.

@technosophos technosophos added this to the 2.11.0 - Features milestone Jul 23, 2018
@technosophos
technosophos merged commit 3e5b406 into helm:master Jul 23, 2018
mumoshu added a commit to mumoshu/helm-diff that referenced this pull request Jul 25, 2018
This feature is enabled only when the `--detailed-exitcode` flag (databus23#65) is provided.
Supports `upgrade`, `revision` and `rollback` sub-commands.

Resolves databus23#54, but only after helm/helm#4367 as released with helm v2.11.0, probably.
mumoshu added a commit to mumoshu/helm-diff that referenced this pull request Jul 25, 2018
This feature is enabled only when the `--detailed-exitcode` flag (databus23#65) is provided.
Supports `upgrade`, `revision` and `rollback` sub-commands.

Resolves databus23#54, but only after helm/helm#4367 is released with helm v2.11.0, probably.
mumoshu added a commit to mumoshu/helm-diff that referenced this pull request Jul 25, 2018
This feature is enabled only when the `--detailed-exitcode` flag (databus23#65) is provided.
Supports `upgrade`, `revision` and `rollback` sub-commands.

Resolves databus23#54, but only after helm/helm#4367 is released with helm v2.11.0, probably.
mumoshu added a commit to databus23/helm-diff that referenced this pull request Jul 25, 2018
This feature is enabled only when the `--detailed-exitcode` flag (#65) is provided.
Supports `upgrade`, `revision` and `rollback` sub-commands.

Resolves #54, but only after helm/helm#4367 is released with helm v2.11.0, probably.
mumoshu added a commit to mumoshu/helmfile that referenced this pull request Jul 25, 2018
Adds the `--detailed-exitcode` to the `helmfile diff` command to return `1` on failure, and `2` when no error but diff is seen.

This feature requires the latest `helm-diff` containing databus23/helm-diff#78, and `helm` containing helm/helm#4367.

This is verified to work by manually running commands like the followings:

```bash
./helmfile --helm-binary helm211dev -f ./examples/helmfile.d diff --detailed-exitcode; echo $?
./helmfile --helm-binary helm211dev -f ./examples/helmfile.d diff; echo $?
```

Note that, in above example commands, `helm211dev` is a custom `helm` binary that is built from helm's master branch containing [the necessary enhancement to allow propagate non-zero plugin exit code](helm/helm#4367).
splisson pushed a commit to splisson/helm that referenced this pull request Dec 6, 2018
splisson pushed a commit to splisson/helm that referenced this pull request Dec 6, 2018
splisson pushed a commit to splisson/helm that referenced this pull request Dec 6, 2018
splisson pushed a commit to splisson/helm that referenced this pull request Dec 6, 2018
jianghang8421 pushed a commit to jianghang8421/helm that referenced this pull request Feb 17, 2019
@mumoshu
mumoshu deleted the detailed-plugin-exit-code branch August 25, 2020 23:53
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

Successfully merging this pull request may close these issues.

2 participants