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

[bugfix] we should parse env params when create container #2121

Merged
merged 1 commit into from
Aug 20, 2018

Conversation

HusterWan
Copy link
Contributor

Ⅰ. Describe what this PR did

We did not parse env params when create a container, just append image env to container env slice. So we will occur errors blow:

we use a test image: mysql:5.7, it has env like blow:

root@osboxes:pouch (master) -> pouch image inspect registry.hub.docker.com/library/mysql:5.7 | grep -A 6 -B 3 Env
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "GOSU_VERSION=1.7",
                "MYSQL_MAJOR=5.7",
                "MYSQL_VERSION=5.7.23-1debian9"
            ],

If we use this image to create a container, and specify an env like GOSU_VERSION=2.0, we will get a container like :

root@osboxes:pouch (master) -> pouch run -d -t --name=test -e "GOSU_VERSION=2.0" -e "test=foo" --net=bridge -v /data  registry.hub.docker.com/library/mysql:5.7 top
00b09689623709005d0910793663aabf454ac0c0fa4006a347545b8403fc6061
root@osboxes:pouch (master) -> pouch inspect test | grep -A 6 -B 3 Env
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "Env": [
                "GOSU_VERSION=2.0",
                "test=foo",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "GOSU_VERSION=1.7",
                "MYSQL_MAJOR=5.7",
                "MYSQL_VERSION=5.7.23-1debian9"

we have two env GOSU_VERSION, one is GOSU_VERSION=2.0, another is GOSU_VERSION=1.7

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

Added testcase

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@pouchrobot pouchrobot added kind/bug This is bug report for project size/XL labels Aug 20, 2018
Signed-off-by: Michael Wan <zirenwan@gmail.com>
@rudyfly
Copy link
Collaborator

rudyfly commented Aug 20, 2018

LGTM

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label Aug 20, 2018
@codecov-io
Copy link

codecov-io commented Aug 20, 2018

Codecov Report

Merging #2121 into master will increase coverage by 4.63%.
The diff coverage is 72.41%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2121      +/-   ##
=========================================
+ Coverage   60.47%   65.1%   +4.63%     
=========================================
  Files         208     208              
  Lines       16411   16417       +6     
=========================================
+ Hits         9925   10689     +764     
+ Misses       5296    4397     -899     
- Partials     1190    1331     +141
Flag Coverage Δ
#criv1alpha1test 33.31% <17.24%> (?)
#criv1alpha2test 33.82% <17.24%> (-0.07%) ⬇️
#integrationtest 39.82% <65.51%> (ø) ⬆️
#unittest 24% <58.62%> (+0.1%) ⬆️
Impacted Files Coverage Δ
daemon/mgr/container.go 55.84% <50%> (-0.27%) ⬇️
daemon/mgr/container_types.go 79.06% <50%> (-2.33%) ⬇️
daemon/mgr/container_utils.go 83.13% <80.95%> (-0.32%) ⬇️
ctrd/watch.go 75.75% <0%> (-4.55%) ⬇️
ctrd/image.go 75% <0%> (-2.2%) ⬇️
daemon/logger/jsonfile/utils.go 71.54% <0%> (-1.63%) ⬇️
cri/v1alpha1/cri_utils.go 83.64% <0%> (+23.06%) ⬆️
cri/criservice.go 64.7% <0%> (+24.99%) ⬆️
cri/v1alpha1/cri_wrapper.go 55.8% <0%> (+55.8%) ⬆️
... and 5 more

@HusterWan HusterWan merged commit 94baba4 into AliyunContainerService:master Aug 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug This is bug report for project LGTM one maintainer or community participant agrees to merge the pull reuqest. size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants