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

Exit Code Propagation #1655

Merged
merged 5 commits into from
Jun 1, 2021
Merged

Exit Code Propagation #1655

merged 5 commits into from
Jun 1, 2021

Conversation

fridayy
Copy link
Contributor

@fridayy fridayy commented May 21, 2021

Description

This PR adds the "Exit Code Propagation" behavior as discussed here.

The exit/1 function now checks if the given error is an exec.ExitError. If so the exit code wrapped in the exec.ExitError is propagated back to the caller otherwise the catch all 1 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:

  • Includes unit tests
  • Adds integration tests if needed.

See the contribution guide for more details.

Reviewer Notes

  • The code flow looks good.
  • Unit tests and or integration tests added.

Release Notes

The kaniko executor now propagates exit codes of failing commands back to the caller instead of exiting with error code 1.

Dockerfile:

FROM python:3.7

RUN exit 123

CMD ["python", "--version"]

When trying to build the given Containerfile kaniko will exit with the exit code 123.

@google-cla google-cla bot added the cla: yes CLA signed by all commit authors label May 21, 2021
@fridayy fridayy marked this pull request as draft May 21, 2021 15:52
…ode propagation test files to 'testdata' to avoid interference with other integration tests
@fridayy fridayy marked this pull request as ready for review May 21, 2021 17:24
@tejal29 tejal29 merged commit 57ea150 into GoogleContainerTools:master Jun 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes CLA signed by all commit authors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants