From 19b7a3066822b8a68caa00f37eb584ec03ca3589 Mon Sep 17 00:00:00 2001 From: Nicolas signed-log FORMICHELLA Date: Sat, 27 Aug 2022 11:39:22 +0200 Subject: [PATCH 1/2] [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 --- Makefile | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index b8f5cca..f9deaa1 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ PYTESTS = $(wildcard test/test_*.py) -IMAGE = yadm/testbed:2022-01-07 +IMAGE = docker.io/yadm/testbed:2022-01-07 +OCI = docker .PHONY: all all: @@ -94,7 +95,7 @@ test: py.test -v $(testargs); \ else \ $(MAKE) -s require-docker && \ - docker run \ + $(OCI) run \ --rm -t$(shell test -t 0 && echo i) \ -v "$(CURDIR):/yadm:ro" \ $(IMAGE) \ @@ -117,7 +118,7 @@ test: .PHONY: testhost testhost: require-docker .testyadm @echo "Starting testhost" - @docker run \ + @$(OCI) run \ -w /root \ --hostname testhost \ --rm -it \ @@ -129,7 +130,7 @@ testhost: require-docker .testyadm scripthost: require-docker .testyadm @echo "Starting scripthost \(recording script\)" @printf '' > script.gz - @docker run \ + @$(OCI) run \ -w /root \ --hostname scripthost \ --rm -it \ @@ -159,7 +160,7 @@ testenv: .PHONY: image image: - @docker build -f test/Dockerfile . -t "$(IMAGE)" + @$(OCI) build -f test/Dockerfile . -t "$(IMAGE)" .PHONY: man @@ -204,11 +205,11 @@ install: .PHONY: sync-clock sync-clock: - docker run --rm --privileged alpine hwclock -s + $(OCI) run --rm --privileged alpine hwclock -s .PHONY: require-docker require-docker: - @if ! command -v "docker" > /dev/null 2>&1; then \ - echo "Sorry, this make target requires docker to be installed."; \ + @if ! command -v $(OCI) > /dev/null 2>&1; then \ + 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; \ fi From 075cd1b06b8ee5ff23479dbefa42f86b527b6806 Mon Sep 17 00:00:00 2001 From: Nicolas signed-log FORMICHELLA Date: Sat, 27 Aug 2022 11:54:24 +0200 Subject: [PATCH 2/2] [Documentation] Document OCI switch Document the OCI override switch Signed-off-by: Nicolas signed-log FORMICHELLA --- .github/CONTRIBUTING.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 392a24d..3afd731 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -212,6 +212,11 @@ these principles when making changes. ```text $ make test ``` + If you don't use `docker` but an OCI engine akin to `podman`, you can set it through the `OCI` switch for every target + + ```text + $ make test OCI=podman + ``` 5. Create a feature branch, based off the `develop` branch.