-
Notifications
You must be signed in to change notification settings - Fork 618
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
Do not print an error message on non-0 exec exit code #3462
base: main
Are you sure you want to change the base?
Conversation
This was added with an earlier exec, and it is very confusing. the error had nothing to do with Containerd; it was the executable we ran inside the container that errored, and per task run convention we should set the Containerd exit code to the process's exit code and print no error. Signed-off-by: Zou Nengren <[email protected]>
Signed-off-by: Zou Nengren <[email protected]>
I believe this was purposely printed for consistency with Docker, but can't verify it on phone |
FWIW:
It looks like this may have been introduced in: Not clear what was the reason, as this is part of a refactor. |
if err != nil { | ||
return err | ||
} | ||
if code != 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.
@zouyee not displaying the message is one thing, but clearly we still need to error out.
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.
The executable we ran inside the container that errored, we need to print error ?
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.
We need to return an error from this method, otherwise nerdctl will exit 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.
Why does exec function care about the results of execution inside the container?
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 should be just same as Docker
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.
nerdctl exec
nerdctl -n k8s.io exec xxx bash -c 'bash ./faketime.sh xxx';echo $?
tomcat: stopped
tomcat: started
FATA[0005] exec failed with exit code 1
1
docker exec
docker exec xxx bash -c 'bash ./faketime.sh xxx';echo $?
tomcat: stopped
tomcat: started
1
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.
Yes, we should do the same thing as docker.
With your patch right now, we no longer return exit 1 because you do not return a go error.
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.
@zouyee you may write stderr to /dev/null
as workaround
This was added with an earlier exec, and it is very confusing. the error had nothing to do with Containerd; it was the executable we ran inside the container that errored, and per task run convention we should set the Containerd exit code to the process's exit code and print no error.
ctr exec
nerdctl exec
docker exec