Skip to content

Commit c6c2bbd

Browse files
committed
Merge remote-tracking branch 'upstream/main' into HEAD
2 parents bf1a351 + 7342102 commit c6c2bbd

File tree

135 files changed

+3303
-1418
lines changed

Some content is hidden

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

135 files changed

+3303
-1418
lines changed

.github/CODEOWNERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# GitHub code owners
2+
# See https://help.github.com/articles/about-codeowners/
3+
#
4+
# KEEP THIS FILE SORTED. Order is important. Last match takes precedence.
5+
6+
* @aiordache @ulyssessouza

.github/workflows/ci.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Python package
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
flake8:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
- uses: actions/setup-python@v4
11+
with:
12+
python-version: '3.x'
13+
- run: pip install -U flake8
14+
- name: Run flake8
15+
run: flake8 docker/ tests/
16+
17+
unit-tests:
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11.0-alpha - 3.11.0"]
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v4
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
- name: Install dependencies
30+
run: |
31+
python3 -m pip install --upgrade pip
32+
pip3 install -r test-requirements.txt -r requirements.txt
33+
- name: Run unit tests
34+
run: |
35+
docker logout
36+
rm -rf ~/.docker
37+
py.test -v --cov=docker tests/unit
38+
39+
integration-tests:
40+
runs-on: ubuntu-latest
41+
strategy:
42+
matrix:
43+
variant: [ "integration-dind", "integration-dind-ssl", "integration-dind-ssh" ]
44+
45+
steps:
46+
- uses: actions/checkout@v3
47+
- name: make ${{ matrix.variant }}
48+
run: |
49+
docker logout
50+
rm -rf ~/.docker
51+
make ${{ matrix.variant }}

.readthedocs.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ version: 2
33
sphinx:
44
configuration: docs/conf.py
55

6+
build:
7+
os: ubuntu-20.04
8+
tools:
9+
python: '3.10'
10+
611
python:
7-
version: 3.5
812
install:
913
- requirements: docs-requirements.txt
1014
- requirements: requirements.txt

.travis.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
ARG PYTHON_VERSION=2.7
1+
ARG PYTHON_VERSION=3.10
22

33
FROM python:${PYTHON_VERSION}
44

55
RUN mkdir /src
66
WORKDIR /src
77

88
COPY requirements.txt /src/requirements.txt
9-
RUN pip install -r requirements.txt
9+
RUN pip install --no-cache-dir -r requirements.txt
1010

1111
COPY test-requirements.txt /src/test-requirements.txt
12-
RUN pip install -r test-requirements.txt
12+
RUN pip install --no-cache-dir -r test-requirements.txt
1313

1414
COPY . /src
15-
RUN pip install .
15+
RUN pip install --no-cache-dir .

Dockerfile-docs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG PYTHON_VERSION=3.7
1+
ARG PYTHON_VERSION=3.10
22

33
FROM python:${PYTHON_VERSION}
44

@@ -10,6 +10,6 @@ RUN addgroup --gid $gid sphinx \
1010

1111
WORKDIR /src
1212
COPY requirements.txt docs-requirements.txt ./
13-
RUN pip install -r requirements.txt -r docs-requirements.txt
13+
RUN pip install --no-cache-dir -r requirements.txt -r docs-requirements.txt
1414

1515
USER sphinx

Dockerfile-py3

Lines changed: 0 additions & 15 deletions
This file was deleted.

Jenkinsfile

Lines changed: 59 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!groovy
22

3-
def imageNameBase = "dockerbuildbot/docker-py"
4-
def imageNamePy2
3+
def imageNameBase = "dockerpinata/docker-py"
54
def imageNamePy3
5+
def imageDindSSH
66
def images = [:]
77

88
def buildImage = { name, buildargs, pyTag ->
@@ -13,26 +13,27 @@ def buildImage = { name, buildargs, pyTag ->
1313
img = docker.build(name, buildargs)
1414
img.push()
1515
}
16-
images[pyTag] = img.id
16+
if (pyTag?.trim()) images[pyTag] = img.id
1717
}
1818

1919
def buildImages = { ->
20-
wrappedNode(label: "amd64 && ubuntu-1804 && overlay2", cleanWorkspace: true) {
20+
wrappedNode(label: "amd64 && ubuntu-2004 && overlay2", cleanWorkspace: true) {
2121
stage("build image") {
2222
checkout(scm)
2323

24-
imageNamePy2 = "${imageNameBase}:py2-${gitCommit()}"
2524
imageNamePy3 = "${imageNameBase}:py3-${gitCommit()}"
26-
27-
buildImage(imageNamePy2, "-f tests/Dockerfile --build-arg PYTHON_VERSION=2.7 .", "py2.7")
28-
buildImage(imageNamePy3, "-f tests/Dockerfile --build-arg PYTHON_VERSION=3.7 .", "py3.7")
25+
imageDindSSH = "${imageNameBase}:sshdind-${gitCommit()}"
26+
withDockerRegistry(credentialsId:'dockerbuildbot-index.docker.io') {
27+
buildImage(imageDindSSH, "-f tests/Dockerfile-ssh-dind .", "")
28+
buildImage(imageNamePy3, "-f tests/Dockerfile --build-arg PYTHON_VERSION=3.10 .", "py3.10")
29+
}
2930
}
3031
}
3132
}
3233

3334
def getDockerVersions = { ->
34-
def dockerVersions = ["19.03.5"]
35-
wrappedNode(label: "amd64 && ubuntu-1804 && overlay2") {
35+
def dockerVersions = ["19.03.12"]
36+
wrappedNode(label: "amd64 && ubuntu-2004 && overlay2") {
3637
def result = sh(script: """docker run --rm \\
3738
--entrypoint=python \\
3839
${imageNamePy3} \\
@@ -66,39 +67,64 @@ def runTests = { Map settings ->
6667
throw new Exception("Need test image object, e.g.: `runTests(testImage: img)`")
6768
}
6869
if (!dockerVersion) {
69-
throw new Exception("Need Docker version to test, e.g.: `runTests(dockerVersion: '1.12.3')`")
70+
throw new Exception("Need Docker version to test, e.g.: `runTests(dockerVersion: '19.03.12')`")
7071
}
7172
if (!pythonVersion) {
72-
throw new Exception("Need Python version being tested, e.g.: `runTests(pythonVersion: 'py2.7')`")
73+
throw new Exception("Need Python version being tested, e.g.: `runTests(pythonVersion: 'py3.x')`")
7374
}
7475

7576
{ ->
76-
wrappedNode(label: "amd64 && ubuntu-1804 && overlay2", cleanWorkspace: true) {
77+
wrappedNode(label: "amd64 && ubuntu-2004 && overlay2", cleanWorkspace: true) {
7778
stage("test python=${pythonVersion} / docker=${dockerVersion}") {
7879
checkout(scm)
7980
def dindContainerName = "dpy-dind-\$BUILD_NUMBER-\$EXECUTOR_NUMBER-${pythonVersion}-${dockerVersion}"
8081
def testContainerName = "dpy-tests-\$BUILD_NUMBER-\$EXECUTOR_NUMBER-${pythonVersion}-${dockerVersion}"
8182
def testNetwork = "dpy-testnet-\$BUILD_NUMBER-\$EXECUTOR_NUMBER-${pythonVersion}-${dockerVersion}"
82-
try {
83-
sh """docker network create ${testNetwork}"""
84-
sh """docker run -d --name ${dindContainerName} -v /tmp --privileged --network ${testNetwork} \\
85-
docker:${dockerVersion}-dind dockerd -H tcp://0.0.0.0:2375
86-
"""
87-
sh """docker run \\
88-
--name ${testContainerName} \\
89-
-e "DOCKER_HOST=tcp://${dindContainerName}:2375" \\
90-
-e 'DOCKER_TEST_API_VERSION=${apiVersion}' \\
91-
--network ${testNetwork} \\
92-
--volumes-from ${dindContainerName} \\
93-
${testImage} \\
94-
py.test -v -rxs --cov=docker tests/
95-
"""
96-
} finally {
97-
sh """
98-
docker stop ${dindContainerName} ${testContainerName}
99-
docker rm -vf ${dindContainerName} ${testContainerName}
100-
docker network rm ${testNetwork}
101-
"""
83+
withDockerRegistry(credentialsId:'dockerbuildbot-index.docker.io') {
84+
try {
85+
// unit tests
86+
sh """docker run --rm \\
87+
-e 'DOCKER_TEST_API_VERSION=${apiVersion}' \\
88+
${testImage} \\
89+
py.test -v -rxs --cov=docker tests/unit
90+
"""
91+
// integration tests
92+
sh """docker network create ${testNetwork}"""
93+
sh """docker run --rm -d --name ${dindContainerName} -v /tmp --privileged --network ${testNetwork} \\
94+
${imageDindSSH} dockerd -H tcp://0.0.0.0:2375
95+
"""
96+
sh """docker run --rm \\
97+
--name ${testContainerName} \\
98+
-e "DOCKER_HOST=tcp://${dindContainerName}:2375" \\
99+
-e 'DOCKER_TEST_API_VERSION=${apiVersion}' \\
100+
--network ${testNetwork} \\
101+
--volumes-from ${dindContainerName} \\
102+
-v $DOCKER_CONFIG/config.json:/root/.docker/config.json \\
103+
${testImage} \\
104+
py.test -v -rxs --cov=docker tests/integration
105+
"""
106+
sh """docker stop ${dindContainerName}"""
107+
// start DIND container with SSH
108+
sh """docker run --rm -d --name ${dindContainerName} -v /tmp --privileged --network ${testNetwork} \\
109+
${imageDindSSH} dockerd --experimental"""
110+
sh """docker exec ${dindContainerName} sh -c /usr/sbin/sshd """
111+
// run SSH tests only
112+
sh """docker run --rm \\
113+
--name ${testContainerName} \\
114+
-e "DOCKER_HOST=ssh://${dindContainerName}:22" \\
115+
-e 'DOCKER_TEST_API_VERSION=${apiVersion}' \\
116+
--network ${testNetwork} \\
117+
--volumes-from ${dindContainerName} \\
118+
-v $DOCKER_CONFIG/config.json:/root/.docker/config.json \\
119+
${testImage} \\
120+
py.test -v -rxs --cov=docker tests/ssh
121+
"""
122+
} finally {
123+
sh """
124+
docker stop ${dindContainerName}
125+
docker network rm ${testNetwork}
126+
"""
127+
}
102128
}
103129
}
104130
}

MAINTAINERS

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
[Org]
1212
[Org."Core maintainers"]
1313
people = [
14-
"shin-",
14+
"aiordache",
15+
"ulyssessouza",
1516
]
1617
[Org.Alumni]
1718
people = [
@@ -20,6 +21,7 @@
2021
"dnephin",
2122
"mnowster",
2223
"mpetazzoni",
24+
"shin-",
2325
]
2426

2527
[people]
@@ -35,6 +37,11 @@
3537
3638
GitHub = "aanand"
3739

40+
[people.aiordache]
41+
Name = "Anca Iordache"
42+
43+
GitHub = "aiordache"
44+
3845
[people.bfirsh]
3946
Name = "Ben Firshman"
4047
@@ -59,3 +66,8 @@
5966
Name = "Joffrey F"
6067
6168
GitHub = "shin-"
69+
70+
[people.ulyssessouza]
71+
Name = "Ulysses Domiciano Souza"
72+
73+
GitHub = "ulyssessouza"

0 commit comments

Comments
 (0)