-
Notifications
You must be signed in to change notification settings - Fork 111
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 error handling in package release cli #1553
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for the fix @goshkis!
Do you think you would be able to add a test for this?
err = o.releaseResources(appSpec, *pkgBuild, &pkgConfigs.Pkgs[0], &pkgConfigs.PkgMetadatas[0]) | ||
if err != nil { | ||
return nil | ||
return err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: We can just do a return directly
return o.releaseResources(appSpec, *pkgBuild, &pkgConfigs.Pkgs[0], &pkgConfigs.PkgMetadatas[0])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not the last call in the Run(), so proposed change will skip o.printNextSteps() below.
Signed-off-by: Egor Pak <[email protected]>
I looked at the tests in the repo, and think this will take some time for me to understand how to add the new test properly. |
We are ok with skipping the test for now |
What this PR does / why we need it:
kctrl package release ... --repo-output ...
command is silently ignoring errors from releaseResources function.Say, if incompatible ytt version is installed, this command will not yield any errors but no content will be written to the destination.
The bug seems to be in a simple mistake unconditionally returning nil in case of any errors
Which issue(s) this PR fixes:
Fixes #1552
Does this PR introduce a user-facing change?
Additional Notes for your reviewer:
Review Checklist:
a link to that PR
change
Additional documentation e.g., Proposal, usage docs, etc.: