Skip to content

Commit 19b7a30

Browse files
committed
[Makefile] Support docker-like OCI engines
Support setting a different OCI engine than docker - Create OCI variable to override the docker engine - Refactor the test-docker error message to expose this possibility Signed-off-by: Nicolas signed-log FORMICHELLA <[email protected]>
1 parent 6304553 commit 19b7a30

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Makefile

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
PYTESTS = $(wildcard test/test_*.py)
2-
IMAGE = yadm/testbed:2022-01-07
2+
IMAGE = docker.io/yadm/testbed:2022-01-07
3+
OCI = docker
34

45
.PHONY: all
56
all:
@@ -94,7 +95,7 @@ test:
9495
py.test -v $(testargs); \
9596
else \
9697
$(MAKE) -s require-docker && \
97-
docker run \
98+
$(OCI) run \
9899
--rm -t$(shell test -t 0 && echo i) \
99100
-v "$(CURDIR):/yadm:ro" \
100101
$(IMAGE) \
@@ -117,7 +118,7 @@ test:
117118
.PHONY: testhost
118119
testhost: require-docker .testyadm
119120
@echo "Starting testhost"
120-
@docker run \
121+
@$(OCI) run \
121122
-w /root \
122123
--hostname testhost \
123124
--rm -it \
@@ -129,7 +130,7 @@ testhost: require-docker .testyadm
129130
scripthost: require-docker .testyadm
130131
@echo "Starting scripthost \(recording script\)"
131132
@printf '' > script.gz
132-
@docker run \
133+
@$(OCI) run \
133134
-w /root \
134135
--hostname scripthost \
135136
--rm -it \
@@ -159,7 +160,7 @@ testenv:
159160

160161
.PHONY: image
161162
image:
162-
@docker build -f test/Dockerfile . -t "$(IMAGE)"
163+
@$(OCI) build -f test/Dockerfile . -t "$(IMAGE)"
163164

164165

165166
.PHONY: man
@@ -204,11 +205,11 @@ install:
204205

205206
.PHONY: sync-clock
206207
sync-clock:
207-
docker run --rm --privileged alpine hwclock -s
208+
$(OCI) run --rm --privileged alpine hwclock -s
208209

209210
.PHONY: require-docker
210211
require-docker:
211-
@if ! command -v "docker" > /dev/null 2>&1; then \
212-
echo "Sorry, this make target requires docker to be installed."; \
212+
@if ! command -v $(OCI) > /dev/null 2>&1; then \
213+
echo "Sorry, this make target requires docker to be installed, to use another docker-compatible engine, like podman, re-run the make command adding OCI=podman"; \
213214
false; \
214215
fi

0 commit comments

Comments
 (0)