-
Notifications
You must be signed in to change notification settings - Fork 950
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
bugfix: fix exec record user as container config user #1657
Conversation
daemon/mgr/container_exec.go
Outdated
@@ -61,29 +62,26 @@ func (mgr *ContainerManager) StartExec(ctx context.Context, execid string, confi | |||
return err | |||
} | |||
|
|||
c.Lock() | |||
uid, gid, err = user.Get(c.BaseFS, execConfig.User) |
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.
%s/=/:=
daemon/mgr/container_exec.go
Outdated
@@ -61,29 +62,26 @@ func (mgr *ContainerManager) StartExec(ctx context.Context, execid string, confi | |||
return err | |||
} | |||
|
|||
c.Lock() | |||
uid, gid, err := user.Get(c.BaseFS, execConfig.User) |
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.
@Ace-Tang can we add some test cases to lock this issue?
ci failed, @Ace-Tang PTAC
|
if execConfig.User == "" { | ||
execConfig.User = c.Config.User | ||
} | ||
|
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 should use container origin user if exec user is null
@YaoZengzeng and @starnop please help to check CI. Thanks |
LGTM |
1 similar comment
LGTM |
cri-tools validation fails, see https://travis-ci.org/alibaba/pouch/jobs/402115580 |
@allencloud , cri test has passed. |
Next step, I will combine |
Codecov Report
@@ Coverage Diff @@
## master #1657 +/- ##
===========================================
+ Coverage 17.86% 41.18% +23.31%
===========================================
Files 229 274 +45
Lines 15638 18091 +2453
===========================================
+ Hits 2794 7450 +4656
+ Misses 12650 9729 -2921
- Partials 194 912 +718
|
Since after the two LGTMs, the code has changed again. I would like to invite @fuweid to take another review. Thanks. |
test/cli_exec_test.go
Outdated
res = command.PouchRun("exec", name, "id", "-u") | ||
res.Assert(c, icmd.Success) | ||
if !strings.Contains(res.Stdout(), "1001") { | ||
c.Fatalf("failed to run a container with user: %s", |
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.
Please update the comment with expected user name. It can show right message if there is any error
1. pouch exec -u user $container will record user as container config, fix exec set user. 2. fix namespace hardcode in setBaseFS Signed-off-by: Ace-Tang <aceapril@126.com>
LGTM |
pouch exec -u user $container will record user as container
config, fix exec set user.
Signed-off-by: Ace-Tang aceapril@126.com
Ⅰ. Describe what this PR did
without this patch, will get error like:
Ⅱ. Does this pull request fix one issue?
Ⅲ. Describe how you did it
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews