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

implement the exitcode when start a container with attach #7182

Conversation

zhangguanzhang
Copy link
Collaborator

@zhangguanzhang zhangguanzhang commented Aug 1, 2020

Signed-off-by: zhangguanzhang [email protected]
Fixes: #7150
will be ok if use the docker

[root@centos7 ~]# docker create --name test --entrypoint=sh alpine:3.12 -c 'exit 1'
4dbc2dc4355a754a62a16910a3037578b1efa83d07d63889c1fd773b3c974d8a
[root@centos7 ~]# docker start -a test
[root@centos7 ~]# echo $?
1
[root@centos7 ~]# 

before and after fix

[root@sz-test podman]# podman create --name test --entrypoint=sh docker.io/library/alpine:3.12 -c 'exit 1'
59694fc44140e81ddc9c2beaaec9613a689a6ccebf29a09c2e3f749a389f5088
[root@sz-test podman]# podman start -a test
[root@sz-test podman]# echo $?
0
[root@sz-test podman]# ./bin/podman start -a test
[root@sz-test podman]# echo $?
1

@zhangguanzhang zhangguanzhang force-pushed the fix-exitCode-for-start branch 3 times, most recently from bf100c9 to ee36434 Compare August 1, 2020 15:52
@rhatdan
Copy link
Member

rhatdan commented Aug 2, 2020

Could you add a test for this?

@zhangguanzhang zhangguanzhang force-pushed the fix-exitCode-for-start branch 4 times, most recently from 119e65e to fa0db2d Compare August 2, 2020 15:29
@mheon
Copy link
Member

mheon commented Aug 2, 2020

LGTM

@mheon
Copy link
Member

mheon commented Aug 2, 2020

/approve

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mheon, zhangguanzhang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 2, 2020
@rhatdan
Copy link
Member

rhatdan commented Aug 2, 2020

e2e or both.

session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
cid := session.OutputToString()
session = podmanTest.Podman([]string{"start", "-a", cid})
Copy link
Member

Choose a reason for hiding this comment

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

nit/personal bias: I know it's not followed stringently, but I prefer that the full option to be spelled out in the test so there's no doubt what's being run.

Suggested change
session = podmanTest.Podman([]string{"start", "-a", cid})
session = podmanTest.Podman([]string{"start", "--attach", cid})

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will change it

@zhangguanzhang zhangguanzhang force-pushed the fix-exitCode-for-start branch from fa0db2d to a5a0ba9 Compare August 3, 2020 13:40
@TomSweeneyRedHat
Copy link
Member

LGTM
Thanks @zhangguanzhang !

@rhatdan
Copy link
Member

rhatdan commented Aug 3, 2020

/lgtm
/hold
Great work @zhangguanzhang

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 3, 2020
@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 3, 2020
@rhatdan
Copy link
Member

rhatdan commented Aug 3, 2020

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 3, 2020
@openshift-merge-robot openshift-merge-robot merged commit 1709335 into containers:master Aug 3, 2020
@zhangguanzhang zhangguanzhang deleted the fix-exitCode-for-start branch August 8, 2020 10:40
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

podman doesn't return 1 as an exit code.
6 participants