From d40ce541af6d751c7591cdd4ed3ae659240ef6e4 Mon Sep 17 00:00:00 2001 From: Mark Mandel Date: Fri, 9 Feb 2024 08:53:08 +0000 Subject: [PATCH] Linting: need `git ... --add safe.directory` Ran into the ol' "error obtaining VCS status: exit status 128" issue, but this time with `make lint`. Figured I'd move the command into a variable, so it can be reused across the Makefile. --- build/Makefile | 5 ++++- build/includes/website.mk | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/build/Makefile b/build/Makefile index d6b61b93b6..17ec8f98b3 100644 --- a/build/Makefile +++ b/build/Makefile @@ -135,6 +135,8 @@ ifdef DOCKER_RUN ensure-build-image += ensure-build-image endif +git_safe = git config --global --add safe.directory $(mount_path) + # When performing full build, always rebuild go packages and compress more ifdef FULL_BUILD go_rebuild_flags = -a @@ -489,7 +491,8 @@ build-extensions-binary-linux-arm64: $(ensure-build-image) lint: LINT_TIMEOUT ?= 15m lint: $(ensure-build-image) docker run -t -e "TERM=xterm-256color" -e "$(gomod_on)" --rm $(common_mounts) -w $(workdir_path) $(DOCKER_RUN_ARGS) $(build_tag) bash -c \ - "golangci-lint run ./examples/... && \ + "$(git_safe) && \ + golangci-lint run ./examples/... && \ golangci-lint run --timeout $(LINT_TIMEOUT) ./... && \ yamllint ." diff --git a/build/includes/website.mk b/build/includes/website.mk index 3993128fa5..3bb6af4858 100644 --- a/build/includes/website.mk +++ b/build/includes/website.mk @@ -44,7 +44,7 @@ site-static: ensure-build-image docker run --rm $(common_mounts) --workdir=$(mount_path)/site $(DOCKER_RUN_ARGS) $(build_tag) \ bash -c "npm list autoprefixer || npm install autoprefixer@9.8.6" docker run --rm $(common_mounts) --workdir=$(mount_path)/site $(DOCKER_RUN_ARGS) $(build_tag) bash -c \ - "git config --global --add safe.directory /go/src/agones.dev/agones && $(ENV) hugo --config=config.toml $(ARGS)" + "$(git_safe) && $(ENV) hugo --config=config.toml $(ARGS)" site-gen-app-yaml: SERVICE ?= default site-gen-app-yaml: