Skip to content

Commit 12101a7

Browse files
chore(dev): use lazy variable for CONTAINER_TOOL detection (#25523)
* chore(dev): use lazy variable for CONTAINER_TOOL detection * Remove export from CONTAINER_TOOL
1 parent ddf5c74 commit 12101a7

1 file changed

Lines changed: 1 addition & 17 deletions

File tree

Makefile

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,7 @@ export AUTOINSTALL ?= false
4646
# Override to true for a bit more log output in your environment building (more coming!)
4747
export VERBOSE ?= false
4848
# Override the container tool. Tries docker first and then tries podman.
49-
export CONTAINER_TOOL ?= auto
50-
ifeq ($(CONTAINER_TOOL),auto)
51-
ifeq ($(shell docker version >/dev/null 2>&1 && echo docker), docker)
52-
override CONTAINER_TOOL = docker
53-
else ifeq ($(shell podman version >/dev/null 2>&1 && echo podman), podman)
54-
override CONTAINER_TOOL = podman
55-
else
56-
override CONTAINER_TOOL = unknown
57-
endif
58-
endif
49+
CONTAINER_TOOL ?= $(shell docker version >/dev/null 2>&1 && echo docker || (podman version >/dev/null 2>&1 && echo podman) || echo unknown)
5950
# If we're using podman create pods else if we're using docker create networks.
6051
export CURRENT_DIR = $(shell pwd)
6152

@@ -94,13 +85,6 @@ help:
9485
@printf -- "\n"
9586
@awk 'BEGIN {FS = ":.*##"; printf "Usage: make ${FORMATTING_BEGIN_BLUE}<target>${FORMATTING_END}\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " ${FORMATTING_BEGIN_BLUE}%-46s${FORMATTING_END} %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
9687

97-
##@ Environment
98-
99-
.PHONY: check-container-tool
100-
check-container-tool: ## Checks what container tool is installed
101-
@echo -n "Checking if $(CONTAINER_TOOL) is available..." && \
102-
$(CONTAINER_TOOL) version 1>/dev/null && echo "yes"
103-
10488
##@ Building
10589
.PHONY: build
10690
build: check-build-tools

0 commit comments

Comments
 (0)