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>
This commit is contained in:
parent
18fd3a2315
commit
f1ee2f7dc3
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue