@@ -11,12 +11,17 @@ ifeq ($(PLATFORM),Linux)
11
11
uid_args := "--build-arg uid=$(shell id -u) --build-arg gid=$(shell id -g)"
12
12
endif
13
13
14
+ SETUPTOOLS_SCM_PRETEND_VERSION_DOCKER ?= $(shell git describe --match '[0-9]* ' --dirty='.m' --always --tags 2>/dev/null | sed -r 's/-([0-9]+) /.dev\1/' | sed 's/-/+/')
15
+ ifeq ($(SETUPTOOLS_SCM_PRETEND_VERSION_DOCKER ) ,)
16
+ SETUPTOOLS_SCM_PRETEND_VERSION_DOCKER = "dev"
17
+ endif
18
+
14
19
.PHONY : all
15
20
all : test
16
21
17
22
.PHONY : clean
18
23
clean :
19
- -docker rm -f dpy-dind-py3 dpy-dind-certs dpy-dind-ssl
24
+ -docker rm -f dpy-dind dpy-dind-certs dpy-dind-ssl
20
25
find -name " __pycache__" | xargs rm -rf
21
26
22
27
.PHONY : build-dind-ssh
@@ -25,51 +30,62 @@ build-dind-ssh:
25
30
--pull \
26
31
-t docker-dind-ssh \
27
32
-f tests/Dockerfile-ssh-dind \
33
+ --build-arg VERSION=${SETUPTOOLS_SCM_PRETEND_VERSION_DOCKER} \
28
34
--build-arg ENGINE_VERSION=${TEST_ENGINE_VERSION} \
29
35
--build-arg API_VERSION=${TEST_API_VERSION} \
30
36
--build-arg APT_MIRROR .
31
37
32
- .PHONY : build-py3
33
- build-py3 :
38
+ .PHONY : build
39
+ build :
34
40
docker build \
35
41
--pull \
36
42
-t docker-sdk-python3 \
37
43
-f tests/Dockerfile \
44
+ --build-arg VERSION=${SETUPTOOLS_SCM_PRETEND_VERSION_DOCKER} \
38
45
--build-arg APT_MIRROR .
39
46
40
47
.PHONY : build-docs
41
48
build-docs :
42
- docker build -t docker-sdk-python-docs -f Dockerfile-docs $(uid_args ) .
49
+ docker build \
50
+ -t docker-sdk-python-docs \
51
+ -f Dockerfile-docs \
52
+ --build-arg VERSION=${SETUPTOOLS_SCM_PRETEND_VERSION_DOCKER} \
53
+ $(uid_args ) \
54
+ .
43
55
44
56
.PHONY : build-dind-certs
45
57
build-dind-certs :
46
- docker build -t dpy-dind-certs -f tests/Dockerfile-dind-certs .
58
+ docker build \
59
+ -t dpy-dind-certs \
60
+ -f tests/Dockerfile-dind-certs \
61
+ --build-arg VERSION=${SETUPTOOLS_SCM_PRETEND_VERSION_DOCKER} \
62
+ .
47
63
48
64
.PHONY : test
49
- test : ruff unit-test-py3 integration-dind integration-dind-ssl
65
+ test : ruff unit-test integration-dind integration-dind-ssl
50
66
51
- .PHONY : unit-test-py3
52
- unit-test-py3 : build-py3
67
+ .PHONY : unit-test
68
+ unit-test : build
53
69
docker run -t --rm docker-sdk-python3 py.test tests/unit
54
70
55
- .PHONY : integration-test-py3
56
- integration-test-py3 : build-py3
71
+ .PHONY : integration-test
72
+ integration-test : build
57
73
docker run -t --rm -v /var/run/docker.sock:/var/run/docker.sock docker-sdk-python3 py.test -v tests/integration/${file}
58
74
59
75
.PHONY : setup-network
60
76
setup-network :
61
77
docker network inspect dpy-tests || docker network create dpy-tests
62
78
63
79
.PHONY : integration-dind
64
- integration-dind : integration-dind-py3
80
+ integration-dind : integration-dind
65
81
66
- .PHONY : integration-dind-py3
67
- integration-dind-py3 : build-py3 setup-network
68
- docker rm -vf dpy-dind-py3 || :
82
+ .PHONY : integration-dind
83
+ integration-dind : build setup-network
84
+ docker rm -vf dpy-dind || :
69
85
70
86
docker run \
71
87
--detach \
72
- --name dpy-dind-py3 \
88
+ --name dpy-dind \
73
89
--network dpy-tests \
74
90
--pull=always \
75
91
--privileged \
@@ -82,22 +98,22 @@ integration-dind-py3: build-py3 setup-network
82
98
--rm \
83
99
--tty \
84
100
busybox \
85
- sh -c 'while ! nc -z dpy-dind-py3 2375; do sleep 1; done'
101
+ sh -c 'while ! nc -z dpy-dind 2375; do sleep 1; done'
86
102
87
103
docker run \
88
- --env="DOCKER_HOST=tcp://dpy-dind-py3 :2375" \
104
+ --env="DOCKER_HOST=tcp://dpy-dind:2375" \
89
105
--env="DOCKER_TEST_API_VERSION=${TEST_API_VERSION}" \
90
106
--network dpy-tests \
91
107
--rm \
92
108
--tty \
93
109
docker-sdk-python3 \
94
110
py.test tests/integration/${file}
95
111
96
- docker rm -vf dpy-dind-py3
112
+ docker rm -vf dpy-dind
97
113
98
114
99
115
.PHONY : integration-dind-ssh
100
- integration-dind-ssh : build-dind-ssh build-py3 setup-network
116
+ integration-dind-ssh : build-dind-ssh build setup-network
101
117
docker rm -vf dpy-dind-ssh || :
102
118
docker run -d --network dpy-tests --name dpy-dind-ssh --privileged \
103
119
docker-dind-ssh dockerd --experimental
@@ -116,7 +132,7 @@ integration-dind-ssh: build-dind-ssh build-py3 setup-network
116
132
117
133
118
134
.PHONY : integration-dind-ssl
119
- integration-dind-ssl : build-dind-certs build-py3 setup-network
135
+ integration-dind-ssl : build-dind-certs build setup-network
120
136
docker rm -vf dpy-dind-certs dpy-dind-ssl || :
121
137
docker run -d --name dpy-dind-certs dpy-dind-certs
122
138
@@ -164,13 +180,13 @@ integration-dind-ssl: build-dind-certs build-py3 setup-network
164
180
docker rm -vf dpy-dind-ssl dpy-dind-certs
165
181
166
182
.PHONY : ruff
167
- ruff : build-py3
183
+ ruff : build
168
184
docker run -t --rm docker-sdk-python3 ruff docker tests
169
185
170
186
.PHONY : docs
171
187
docs : build-docs
172
188
docker run --rm -t -v ` pwd` :/src docker-sdk-python-docs sphinx-build docs docs/_build
173
189
174
190
.PHONY : shell
175
- shell : build-py3
191
+ shell : build
176
192
docker run -it -v /var/run/docker.sock:/var/run/docker.sock docker-sdk-python3 python
0 commit comments