summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Roth <gaumless@gmail.com>2023-07-22 12:59:28 -0600
committerMartin L Roth <gaumless@gmail.com>2023-08-04 20:54:22 +0000
commitf1ee2f7dc3823e3d447b8523a1dedf4fbe3fb76b (patch)
tree656158aecde0bc4823035d444fe3f21d910506a2
parent18fd3a23151deeb10cfbb93118b395795165ee20 (diff)
util/docker: refactor out and fix docker cache dir test
The test for the docker cache directory was used by two different targets, so turn it into its own target. Add missing $ for whoami commands. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: Ic5e1d28110097eb502959e81bafe77faa0fc7fae Reviewed-on: https://review.coreboot.org/c/coreboot/+/76707 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
-rw-r--r--util/docker/Makefile15
1 files changed, 9 insertions, 6 deletions
diff --git a/util/docker/Makefile b/util/docker/Makefile
index c4713dd15c..4386ebe6b9 100644
--- a/util/docker/Makefile
+++ b/util/docker/Makefile
@@ -126,26 +126,29 @@ docker-what-jenkins-does: docker-run-local
docker-what-jenkins-does: override DOCKER_RUN_LOCAL := \
make clean && make what-jenkins-does CPUS=$(CPUS)
-docker-jenkins-server: test-docker
+test-docker-cache-dir:
@if [ ! -d "$(COREBOOT_JENKINS_CACHE_DIR)" ]; then \
printf "\nError: %s does not exist.\n" "$(COREBOOT_JENKINS_CACHE_DIR)"; \
printf "Please run:\nsudo mkdir -p %s\n\n" "$(COREBOOT_JENKINS_CACHE_DIR)"; \
+ printf "sudo chown -R $$(whoami):$$(whoami) %s\n\n" "$(COREBOOT_JENKINS_CACHE_DIR)"; \
false; \
fi
@if ! touch "$(COREBOOT_JENKINS_CACHE_DIR)/testfile" 2>/dev/null; then \
printf "\nError: Cannot create file in %s." "$(COREBOOT_JENKINS_CACHE_DIR)"; \
- printf "Please run:\nsudo chown -R $(whoami):$(whoami) %s\n\n" "$(COREBOOT_JENKINS_CACHE_DIR)"; \
+ printf "Please run:\nsudo chown -R $$(whoami):$$(whoami) %s\n\n" "$(COREBOOT_JENKINS_CACHE_DIR)"; \
+ false; \
else \
rm -f "$(COREBOOT_JENKINS_CACHE_DIR)/testfile"; \
fi
+
+docker-jenkins-server: test-docker-cache-dir test-docker
$(DOCKER) run -d --privileged --restart=always \
-p $(COREBOOT_JENKINS_PORT):49151 \
-v $(COREBOOT_JENKINS_CACHE_DIR):/data/cache \
--name=$(COREBOOT_JENKINS_CONTAINER) \
coreboot/coreboot-jenkins-node:$(COREBOOT_IMAGE_TAG)
-docker-jenkins-shell: test-docker
- @if [ ! -d $(COREBOOT_JENKINS_CACHE_DIR) ]; then printf "\nError: %s does not exist.\nPlease run:\nsudo mkdir -p %s\n\n" "$(COREBOOT_JENKINS_CACHE_DIR)" "$(COREBOOT_JENKINS_CACHE_DIR)"; false; fi
+docker-jenkins-shell: test-docker-cache-dir test-docker
$(DOCKER) run -u root -it --privileged \
--entrypoint="/bin/bash" \
-p $(COREBOOT_JENKINS_PORT):49151 \
@@ -216,11 +219,11 @@ help:
@echo " COREBOOT_IMAGE_TAG=$(COREBOOT_IMAGE_TAG)"
@echo " DOCKER_COMMIT=$(DOCKER_COMMIT)"
-.PHONY: test-docker test-docker-login
+.PHONY: test-docker test-docker-login test-docker-cache-dir
.PHONY: coreboot-jenkins-node upload-coreboot-jenkins-node coreboot-jenkins-test
.PHONY: coreboot-sdk upload-coreboot-sdk
.PHONY: doc.coreboot.org
-.PHONY: clean-coreboot-containers clean-coreboot-images
+.PHONY: clean-coreboot-containers clean-coreboot-images docker-cleanall
.PHONY: docker-abuild
.PHONY: docker-what-jenkins-does docker-shell docker-jenkins-server docker-jenkins-attach
.PHONY: docker-build-docs docker-livehtml-docs