From 61e8ba6f44d207ba3500fb5d1f322daf31eadc73 Mon Sep 17 00:00:00 2001 From: Florian Warzecha Date: Tue, 5 Jul 2022 21:20:26 +0200 Subject: [PATCH] tooling(delete-rem-tags): pass git commit info Passes git author information via environment variables into the docker container, in order to ensure commits done by the script have correct author information. --- Makefile | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index c03bfaf5c..5fbc6a354 100644 --- a/Makefile +++ b/Makefile @@ -30,9 +30,9 @@ ## set to the folder of the current .tex file. When called directly, we ## need to first change-dir to this folder. ifneq ($(DOCKER), false) -DOCKER_IMAGE = alpine-pandoc-hugo -DOCKER_COMMAND = docker run --rm -i -DOCKER_USER = -u "$(shell id -u):$(shell id -g)" +DOCKER_IMAGE = alpine-pandoc-hugo +DOCKER_COMMAND = docker run --rm -i +DOCKER_USER = -u "$(shell id -u):$(shell id -g)" # GIT_DIR ensures that git works with the repository # no matter the owning user of the directory. # see https://github.com/Compilerbau/CB-Lecture-Bachelor/pull/16 for the discussion @@ -42,14 +42,15 @@ DOCKER_USER = -u "$(shell id -u):$(shell id -g)" # for a general overview of the issue. # # ***Important***: keep the location of GIT_DIR in sync with the mountpoint of the repository inside the container. -DOCKER_VOLUME = -v "$(shell pwd):/data" -w "/data" --env GIT_DIR=/data/.git -DOCKER_TEX_VOLUME = -v "$(dir $(realpath $<)):/data" -w "/data" --env GIT_DIR=/data/.git - -PANDOC = $(DOCKER_COMMAND) $(DOCKER_VOLUME) $(DOCKER_USER) --entrypoint="pandoc" $(DOCKER_IMAGE) -HUGO = $(DOCKER_COMMAND) $(DOCKER_VOLUME) $(DOCKER_USER) --entrypoint="hugo" $(DOCKER_IMAGE) -DOT = $(DOCKER_COMMAND) $(DOCKER_VOLUME) $(DOCKER_USER) --entrypoint="dot" $(DOCKER_IMAGE) -LATEX = $(DOCKER_COMMAND) $(DOCKER_TEX_VOLUME) $(DOCKER_USER) --entrypoint="latex" $(DOCKER_IMAGE) -DELETE_SCRIPT = $(DOCKER_COMMAND) $(DOCKER_VOLUME) $(DOCKER_USER) --entrypoint="/opt/delete-script.rb" $(DOCKER_IMAGE) +DOCKER_VOLUME = -v "$(shell pwd):/data" -w "/data" --env GIT_DIR=/data/.git +DOCKER_TEX_VOLUME = -v "$(dir $(realpath $<)):/data" -w "/data" --env GIT_DIR=/data/.git +DOCKER_GIT_COMMIT_INFO = --env GIT_AUTHOR_NAME="$(shell git config user.name)" --env GIT_AUTHOR_EMAIL="$(shell git config user.email)" + +PANDOC = $(DOCKER_COMMAND) $(DOCKER_VOLUME) $(DOCKER_USER) --entrypoint="pandoc" $(DOCKER_IMAGE) +HUGO = $(DOCKER_COMMAND) $(DOCKER_VOLUME) $(DOCKER_USER) --entrypoint="hugo" $(DOCKER_IMAGE) +DOT = $(DOCKER_COMMAND) $(DOCKER_VOLUME) $(DOCKER_USER) --entrypoint="dot" $(DOCKER_IMAGE) +LATEX = $(DOCKER_COMMAND) $(DOCKER_TEX_VOLUME) $(DOCKER_USER) --entrypoint="latex" $(DOCKER_IMAGE) +DELETE_SCRIPT = $(DOCKER_COMMAND) $(DOCKER_VOLUME) $(DOCKER_USER) --entrypoint="/opt/delete-script.rb" $(DOCKER_GIT_COMMIT_INFO) $(DOCKER_IMAGE) else PANDOC = pandoc HUGO = hugo