Skip to content

Commit 92b33ea

Browse files
Hongbin Luhongbin
authored andcommitted
Merge branch 'master' into connect-with-mac
Signed-off-by: Hongbin Lu <[email protected]>
2 parents 7e20a90 + 28c9100 commit 92b33ea

File tree

116 files changed

+9137
-3962
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+9137
-3962
lines changed

.travis.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
sudo: false
22
language: python
3-
python:
4-
- "3.5"
5-
env:
6-
- TOX_ENV=py27
7-
# FIXME: default travis worker does not carry py33 anymore. Can this be configured?
8-
# - TOX_ENV=py33
9-
- TOX_ENV=py34
10-
- TOX_ENV=py35
11-
- TOX_ENV=flake8
3+
matrix:
4+
include:
5+
- python: 2.7
6+
env: TOXENV=py27
7+
- python: 3.4
8+
env: TOXENV=py34
9+
- python: 3.5
10+
env: TOXENV=py35
11+
- python: 3.6
12+
env: TOXENV=py36
13+
- python: 3.7
14+
env: TOXENV=py37
15+
dist: xenial
16+
sudo: true
17+
- env: TOXENV=flake8
18+
1219
install:
1320
- pip install tox
1421
script:
15-
- tox -e $TOX_ENV
22+
- tox

Dockerfile-py3

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.5
1+
FROM python:3.6
22

33
RUN mkdir /src
44
WORKDIR /src

Jenkinsfile

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ def imageNamePy2
55
def imageNamePy3
66
def images = [:]
77

8-
9-
def dockerVersions = ["1.13.1", "17.04.0-ce", "17.05.0-ce", "17.06.0-ce", "17.07.0-ce-rc3"]
10-
118
def buildImage = { name, buildargs, pyTag ->
129
img = docker.image(name)
1310
try {
@@ -28,14 +25,35 @@ def buildImages = { ->
2825
imageNamePy3 = "${imageNameBase}:py3-${gitCommit()}"
2926

3027
buildImage(imageNamePy2, ".", "py2.7")
31-
buildImage(imageNamePy3, "-f Dockerfile-py3 .", "py3.5")
28+
buildImage(imageNamePy3, "-f Dockerfile-py3 .", "py3.6")
3229
}
3330
}
3431
}
3532

33+
def getDockerVersions = { ->
34+
def dockerVersions = ["17.06.2-ce"]
35+
wrappedNode(label: "ubuntu && !zfs") {
36+
def result = sh(script: """docker run --rm \\
37+
--entrypoint=python \\
38+
${imageNamePy3} \\
39+
/src/scripts/versions.py
40+
""", returnStdout: true
41+
)
42+
dockerVersions = dockerVersions + result.trim().tokenize(' ')
43+
}
44+
return dockerVersions
45+
}
46+
3647
def getAPIVersion = { engineVersion ->
37-
def versionMap = ['1.13.': '1.26', '17.04': '1.27', '17.05': '1.29', '17.06': '1.30', '17.07': '1.31']
38-
return versionMap[engineVersion.substring(0, 5)]
48+
def versionMap = [
49+
'17.06': '1.30', '17.12': '1.35', '18.02': '1.36', '18.03': '1.37',
50+
'18.06': '1.38', '18.09': '1.39'
51+
]
52+
def result = versionMap[engineVersion.substring(0, 5)]
53+
if (!result) {
54+
return '1.39'
55+
}
56+
return result
3957
}
4058

4159
def runTests = { Map settings ->
@@ -60,22 +78,26 @@ def runTests = { Map settings ->
6078
checkout(scm)
6179
def dindContainerName = "dpy-dind-\$BUILD_NUMBER-\$EXECUTOR_NUMBER-${pythonVersion}-${dockerVersion}"
6280
def testContainerName = "dpy-tests-\$BUILD_NUMBER-\$EXECUTOR_NUMBER-${pythonVersion}-${dockerVersion}"
81+
def testNetwork = "dpy-testnet-\$BUILD_NUMBER-\$EXECUTOR_NUMBER-${pythonVersion}-${dockerVersion}"
6382
try {
64-
sh """docker run -d --name ${dindContainerName} -v /tmp --privileged \\
83+
sh """docker network create ${testNetwork}"""
84+
sh """docker run -d --name ${dindContainerName} -v /tmp --privileged --network ${testNetwork} \\
6585
dockerswarm/dind:${dockerVersion} dockerd -H tcp://0.0.0.0:2375
6686
"""
6787
sh """docker run \\
68-
--name ${testContainerName} --volumes-from ${dindContainerName} \\
69-
-e 'DOCKER_HOST=tcp://docker:2375' \\
88+
--name ${testContainerName} \\
89+
-e "DOCKER_HOST=tcp://${dindContainerName}:2375" \\
7090
-e 'DOCKER_TEST_API_VERSION=${apiVersion}' \\
71-
--link=${dindContainerName}:docker \\
91+
--network ${testNetwork} \\
92+
--volumes-from ${dindContainerName} \\
7293
${testImage} \\
73-
py.test -v -rxs tests/integration
94+
py.test -v -rxs --cov=docker tests/
7495
"""
7596
} finally {
7697
sh """
7798
docker stop ${dindContainerName} ${testContainerName}
7899
docker rm -vf ${dindContainerName} ${testContainerName}
100+
docker network rm ${testNetwork}
79101
"""
80102
}
81103
}
@@ -86,6 +108,8 @@ def runTests = { Map settings ->
86108

87109
buildImages()
88110

111+
def dockerVersions = getDockerVersions()
112+
89113
def testMatrix = [failFast: false]
90114

91115
for (imgKey in new ArrayList(images.keySet())) {

MAINTAINERS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,16 @@
1010
#
1111
[Org]
1212
[Org."Core maintainers"]
13+
people = [
14+
"shin-",
15+
]
16+
[Org.Alumni]
1317
people = [
1418
"aanand",
1519
"bfirsh",
1620
"dnephin",
1721
"mnowster",
1822
"mpetazzoni",
19-
"shin-",
2023
]
2124

2225
[people]

Makefile

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ all: test
33

44
.PHONY: clean
55
clean:
6-
-docker rm -vf dpy-dind
6+
-docker rm -f dpy-dind-py2 dpy-dind-py3 dpy-dind-certs dpy-dind-ssl
77
find -name "__pycache__" | xargs rm -rf
88

99
.PHONY: build
@@ -27,57 +27,73 @@ test: flake8 unit-test unit-test-py3 integration-dind integration-dind-ssl
2727

2828
.PHONY: unit-test
2929
unit-test: build
30-
docker run --rm docker-sdk-python py.test tests/unit
30+
docker run -t --rm docker-sdk-python py.test tests/unit
3131

3232
.PHONY: unit-test-py3
3333
unit-test-py3: build-py3
34-
docker run --rm docker-sdk-python3 py.test tests/unit
34+
docker run -t --rm docker-sdk-python3 py.test tests/unit
3535

3636
.PHONY: integration-test
3737
integration-test: build
38-
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock docker-sdk-python py.test tests/integration/${file}
38+
docker run -t --rm -v /var/run/docker.sock:/var/run/docker.sock docker-sdk-python py.test -v tests/integration/${file}
3939

4040
.PHONY: integration-test-py3
4141
integration-test-py3: build-py3
42-
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock docker-sdk-python3 py.test tests/integration/${file}
42+
docker run -t --rm -v /var/run/docker.sock:/var/run/docker.sock docker-sdk-python3 py.test tests/integration/${file}
4343

44-
TEST_API_VERSION ?= 1.30
45-
TEST_ENGINE_VERSION ?= 17.06.0-ce
44+
TEST_API_VERSION ?= 1.35
45+
TEST_ENGINE_VERSION ?= 17.12.0-ce
46+
47+
.PHONY: setup-network
48+
setup-network:
49+
docker network inspect dpy-tests || docker network create dpy-tests
4650

4751
.PHONY: integration-dind
48-
integration-dind: build build-py3
49-
docker rm -vf dpy-dind || :
50-
docker run -d --name dpy-dind --privileged dockerswarm/dind:${TEST_ENGINE_VERSION} dockerd\
51-
-H tcp://0.0.0.0:2375 --experimental
52-
docker run --rm --env="DOCKER_HOST=tcp://docker:2375" --env="DOCKER_TEST_API_VERSION=${TEST_API_VERSION}"\
53-
--link=dpy-dind:docker docker-sdk-python py.test tests/integration
54-
docker run --rm --env="DOCKER_HOST=tcp://docker:2375" --env="DOCKER_TEST_API_VERSION=${TEST_API_VERSION}"\
55-
--link=dpy-dind:docker docker-sdk-python3 py.test tests/integration
56-
docker rm -vf dpy-dind
52+
integration-dind: integration-dind-py2 integration-dind-py3
53+
54+
.PHONY: integration-dind-py2
55+
integration-dind-py2: build setup-network
56+
docker rm -vf dpy-dind-py2 || :
57+
docker run -d --network dpy-tests --name dpy-dind-py2 --privileged\
58+
dockerswarm/dind:${TEST_ENGINE_VERSION} dockerd -H tcp://0.0.0.0:2375 --experimental
59+
docker run -t --rm --env="DOCKER_HOST=tcp://dpy-dind-py2:2375" --env="DOCKER_TEST_API_VERSION=${TEST_API_VERSION}"\
60+
--network dpy-tests docker-sdk-python py.test tests/integration
61+
docker rm -vf dpy-dind-py2
62+
63+
.PHONY: integration-dind-py3
64+
integration-dind-py3: build-py3 setup-network
65+
docker rm -vf dpy-dind-py3 || :
66+
docker run -d --network dpy-tests --name dpy-dind-py3 --privileged\
67+
dockerswarm/dind:${TEST_ENGINE_VERSION} dockerd -H tcp://0.0.0.0:2375 --experimental
68+
docker run -t --rm --env="DOCKER_HOST=tcp://dpy-dind-py3:2375" --env="DOCKER_TEST_API_VERSION=${TEST_API_VERSION}"\
69+
--network dpy-tests docker-sdk-python3 py.test tests/integration
70+
docker rm -vf dpy-dind-py3
5771

5872
.PHONY: integration-dind-ssl
5973
integration-dind-ssl: build-dind-certs build build-py3
74+
docker rm -vf dpy-dind-certs dpy-dind-ssl || :
6075
docker run -d --name dpy-dind-certs dpy-dind-certs
6176
docker run -d --env="DOCKER_HOST=tcp://localhost:2375" --env="DOCKER_TLS_VERIFY=1"\
6277
--env="DOCKER_CERT_PATH=/certs" --volumes-from dpy-dind-certs --name dpy-dind-ssl\
63-
-v /tmp --privileged dockerswarm/dind:${TEST_ENGINE_VERSION} dockerd --tlsverify\
64-
--tlscacert=/certs/ca.pem --tlscert=/certs/server-cert.pem\
78+
--network dpy-tests --network-alias docker -v /tmp --privileged\
79+
dockerswarm/dind:${TEST_ENGINE_VERSION}\
80+
dockerd --tlsverify --tlscacert=/certs/ca.pem --tlscert=/certs/server-cert.pem\
6581
--tlskey=/certs/server-key.pem -H tcp://0.0.0.0:2375 --experimental
66-
docker run --rm --volumes-from dpy-dind-ssl --env="DOCKER_HOST=tcp://docker:2375"\
82+
docker run -t --rm --volumes-from dpy-dind-ssl --env="DOCKER_HOST=tcp://docker:2375"\
6783
--env="DOCKER_TLS_VERIFY=1" --env="DOCKER_CERT_PATH=/certs" --env="DOCKER_TEST_API_VERSION=${TEST_API_VERSION}"\
68-
--link=dpy-dind-ssl:docker docker-sdk-python py.test tests/integration
69-
docker run --rm --volumes-from dpy-dind-ssl --env="DOCKER_HOST=tcp://docker:2375"\
84+
--network dpy-tests docker-sdk-python py.test tests/integration
85+
docker run -t --rm --volumes-from dpy-dind-ssl --env="DOCKER_HOST=tcp://docker:2375"\
7086
--env="DOCKER_TLS_VERIFY=1" --env="DOCKER_CERT_PATH=/certs" --env="DOCKER_TEST_API_VERSION=${TEST_API_VERSION}"\
71-
--link=dpy-dind-ssl:docker docker-sdk-python3 py.test tests/integration
87+
--network dpy-tests docker-sdk-python3 py.test tests/integration
7288
docker rm -vf dpy-dind-ssl dpy-dind-certs
7389

7490
.PHONY: flake8
7591
flake8: build
76-
docker run --rm docker-sdk-python flake8 docker tests
92+
docker run -t --rm docker-sdk-python flake8 docker tests
7793

7894
.PHONY: docs
7995
docs: build-docs
80-
docker run --rm -it -v `pwd`:/src docker-sdk-python-docs sphinx-build docs docs/_build
96+
docker run --rm -t -v `pwd`:/src docker-sdk-python-docs sphinx-build docs docs/_build
8197

8298
.PHONY: shell
8399
shell: build

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: '{branch}-{build}'
33
install:
44
- "SET PATH=C:\\Python27-x64;C:\\Python27-x64\\Scripts;%PATH%"
55
- "python --version"
6-
- "pip install tox==2.7.0 virtualenv==15.1.0"
6+
- "pip install tox==2.9.1"
77

88
# Build the binary after tests
99
build: false

0 commit comments

Comments
 (0)