mirror of
https://github.com/TheLocehiliosan/yadm
synced 2024-10-27 20:34:27 +00:00
[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 <stigpro@outlook.fr>
This commit is contained in:
parent
6304553ab3
commit
19b7a30668
17
Makefile
17
Makefile
@ -1,5 +1,6 @@
|
|||||||
PYTESTS = $(wildcard test/test_*.py)
|
PYTESTS = $(wildcard test/test_*.py)
|
||||||
IMAGE = yadm/testbed:2022-01-07
|
IMAGE = docker.io/yadm/testbed:2022-01-07
|
||||||
|
OCI = docker
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all:
|
all:
|
||||||
@ -94,7 +95,7 @@ test:
|
|||||||
py.test -v $(testargs); \
|
py.test -v $(testargs); \
|
||||||
else \
|
else \
|
||||||
$(MAKE) -s require-docker && \
|
$(MAKE) -s require-docker && \
|
||||||
docker run \
|
$(OCI) run \
|
||||||
--rm -t$(shell test -t 0 && echo i) \
|
--rm -t$(shell test -t 0 && echo i) \
|
||||||
-v "$(CURDIR):/yadm:ro" \
|
-v "$(CURDIR):/yadm:ro" \
|
||||||
$(IMAGE) \
|
$(IMAGE) \
|
||||||
@ -117,7 +118,7 @@ test:
|
|||||||
.PHONY: testhost
|
.PHONY: testhost
|
||||||
testhost: require-docker .testyadm
|
testhost: require-docker .testyadm
|
||||||
@echo "Starting testhost"
|
@echo "Starting testhost"
|
||||||
@docker run \
|
@$(OCI) run \
|
||||||
-w /root \
|
-w /root \
|
||||||
--hostname testhost \
|
--hostname testhost \
|
||||||
--rm -it \
|
--rm -it \
|
||||||
@ -129,7 +130,7 @@ testhost: require-docker .testyadm
|
|||||||
scripthost: require-docker .testyadm
|
scripthost: require-docker .testyadm
|
||||||
@echo "Starting scripthost \(recording script\)"
|
@echo "Starting scripthost \(recording script\)"
|
||||||
@printf '' > script.gz
|
@printf '' > script.gz
|
||||||
@docker run \
|
@$(OCI) run \
|
||||||
-w /root \
|
-w /root \
|
||||||
--hostname scripthost \
|
--hostname scripthost \
|
||||||
--rm -it \
|
--rm -it \
|
||||||
@ -159,7 +160,7 @@ testenv:
|
|||||||
|
|
||||||
.PHONY: image
|
.PHONY: image
|
||||||
image:
|
image:
|
||||||
@docker build -f test/Dockerfile . -t "$(IMAGE)"
|
@$(OCI) build -f test/Dockerfile . -t "$(IMAGE)"
|
||||||
|
|
||||||
|
|
||||||
.PHONY: man
|
.PHONY: man
|
||||||
@ -204,11 +205,11 @@ install:
|
|||||||
|
|
||||||
.PHONY: sync-clock
|
.PHONY: sync-clock
|
||||||
sync-clock:
|
sync-clock:
|
||||||
docker run --rm --privileged alpine hwclock -s
|
$(OCI) run --rm --privileged alpine hwclock -s
|
||||||
|
|
||||||
.PHONY: require-docker
|
.PHONY: require-docker
|
||||||
require-docker:
|
require-docker:
|
||||||
@if ! command -v "docker" > /dev/null 2>&1; then \
|
@if ! command -v $(OCI) > /dev/null 2>&1; then \
|
||||||
echo "Sorry, this make target requires docker to be installed."; \
|
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"; \
|
||||||
false; \
|
false; \
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user