From 07e408408077f7fa0f63ac7f4125919715eca9c1 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Fri, 4 Feb 2022 08:40:43 +0100 Subject: [PATCH] build: remove container-id file before building In case building a new container-image fails, the old image has already been removed by the same make target. The container-id file that is used to prevent unneeded rebuilds, causes build problems in case the container-image in the container-id file does not exist (anymore). By removing the container-id file before rebuilding the image, there should not be any issues on subsequent (attempted fixed) builds of the container-images. Signed-off-by: Niels de Vos --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 9c457942a..b0c1c8023 100644 --- a/Makefile +++ b/Makefile @@ -203,6 +203,7 @@ ifeq ($(USE_PULLED_IMAGE),no) .devel-container-id: GOARCH ?= $(shell go env GOARCH 2>/dev/null) .devel-container-id: .container-cmd scripts/Dockerfile.devel [ ! -f .devel-container-id ] || $(CONTAINER_CMD) rmi $(CSI_IMAGE_NAME):devel + $(RM) .devel-container-id $(CONTAINER_CMD) build $(CPUSET) --build-arg BASE_IMAGE=$(BASE_IMAGE) --build-arg GOARCH=$(GOARCH) -t $(CSI_IMAGE_NAME):devel -f ./scripts/Dockerfile.devel . $(CONTAINER_CMD) inspect -f '{{.Id}}' $(CSI_IMAGE_NAME):devel > .devel-container-id else @@ -216,6 +217,7 @@ ifeq ($(USE_PULLED_IMAGE),no) # create a (cached) container image with dependencies for testing cephcsi .test-container-id: .container-cmd build.env scripts/Dockerfile.test [ ! -f .test-container-id ] || $(CONTAINER_CMD) rmi $(CSI_IMAGE_NAME):test + $(RM) .test-container-id $(CONTAINER_CMD) build $(CPUSET) --build-arg GOARCH=$(GOARCH) -t $(CSI_IMAGE_NAME):test -f ./scripts/Dockerfile.test . $(CONTAINER_CMD) inspect -f '{{.Id}}' $(CSI_IMAGE_NAME):test > .test-container-id else