Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds the "Exit Code Propagation" behavior as discussed here.
The
exit/1
function now checks if the given error is anexec.ExitError
. If so the exit code wrapped in theexec.ExitError
is propagated back to the caller otherwise the catch all1
exit code is used.Implementing this in
exit/1
means that this change is applied in a broader context and not only for "RUN" commands as described in the issue. I thought that might be more consistent and I hope you do share my opinion.I added a quick integration test case to verify the wanted behavior. As I am fairly inexperienced with go (and its error handling semantics) I am happy to hear your feedback. :)
Have a nice day!
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide for more details.
Reviewer Notes
Release Notes
The kaniko executor now propagates exit codes of failing commands back to the caller instead of exiting with error code 1.
Dockerfile:
When trying to build the given Containerfile kaniko will exit with the exit code
123
.