From 6f4fd30e7cf877c1cb907fe7b32a1a9f52f3bc63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20H=2E=20Fjeld?= Date: Wed, 4 Feb 2026 22:58:03 +0100 Subject: [PATCH 1/2] Fix Docker build failing on fresh clone Remove explicit COPY of git-version.h which doesn't exist in a fresh git clone. The file is generated by the Makefile when running make, so the explicit COPY was redundant and caused the build to fail. Fixes: https://github.com/hapostgres/pg_auto_failover/issues/1109 Co-Authored-By: Claude Opus 4.5 --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1df68994d..558c14365 100644 --- a/Dockerfile +++ b/Dockerfile @@ -111,7 +111,6 @@ COPY Makefile ./ COPY Makefile.azure ./ COPY Makefile.citus ./ COPY ./src/ ./src -COPY ./src/bin/pg_autoctl/git-version.h ./src/bin/pg_autoctl/git-version.h RUN make -s clean && make -s install -j8 From ba8203fe7d1b899534eec175b74d1be64501fd2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20H=2E=20Fjeld?= Date: Wed, 4 Feb 2026 23:11:38 +0100 Subject: [PATCH 2/2] Fix git warnings when building without .git directory Only run git commands to determine version when .git directory exists. When building in Docker or from a tarball without .git, the version is set to "unknown" instead of printing error messages. Co-Authored-By: Claude Opus 4.5 --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 711a5ca54..dbd8764bf 100644 --- a/Makefile +++ b/Makefile @@ -24,12 +24,16 @@ TOP := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) # Get pg_auto_failover version from header file VERSION_FILE = src/bin/pg_autoctl/git-version.h ifeq ("$(wildcard $(VERSION_FILE))","") +ifneq ("$(wildcard .git)","") DUMMY := $(shell git update-index -q --refresh) GIT_DIRTY := $(shell test -z "`git diff-index --name-only HEAD --`" || echo "-dirty") GIT_VVERSION := $(shell git describe --match "v[0-9]*" HEAD 2>/dev/null) GIT_DVERSION := $(shell echo $(GIT_VVERSION) | awk -Fv '{print $$2"$(GIT_DIRTY)"}') GIT_VERSION := $(shell echo $(GIT_DVERSION) | sed -e 's/-/./g') else +GIT_VERSION := unknown +endif +else GIT_VERSION := $(shell awk -F '[ "]' '{print $$4}' $(VERSION_FILE)) endif