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

fix(kubernetes): handle kubectl-diff exit 1 #213

Merged
merged 1 commit into from
Feb 13, 2020
Merged

Conversation

sh0rez
Copy link
Member

@sh0rez sh0rez commented Feb 13, 2020

Properly handles exit status 1 as a result from kubectl diff,
being aware of differences between kubectl versions:

Fixes #204
Fixes #205

@sh0rez sh0rez added kind/bug Something isn't working component/kubernetes Working with Kubernetes clusters labels Feb 13, 2020
@sh0rez sh0rez self-assigned this Feb 13, 2020
Properly handles `exit status 1` as a result from `kubectl diff`,
being aware of differences between `kubectl` versions:

* Before 1.18:
  * 0: no error, no diff
  * 1: error or diff
* After 1.18 (kubernetes/kubernetes#87437):
  * 0: no error, no diff
  * 1: diff
  * >1: error
}

// before 1.18 "exit status 1" meant error as well ... so we need to check stderr
if version.LessThan(semver.MustParse("1.18.0")) && stderr != "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice trick! :)

Copy link
Contributor

@mplzik mplzik left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@rfratto rfratto left a comment

Choose a reason for hiding this comment

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

LGTM!

@sh0rez sh0rez merged commit 972037d into master Feb 13, 2020
@sh0rez sh0rez deleted the diff-exit-status branch February 13, 2020 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/kubernetes Working with Kubernetes clusters kind/bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

server err: cannot convert int64 to string tk diff fails with wrong exit status
3 participants