Skip to content

Commit 57e39cd

Browse files
committed
Fix VCS stamping error in containerized builds with Podman
This commit addresses issue #9004 by adding git safe.directory configuration to fix 'dubious ownership' errors that occur when using Podman as the container runtime for builds. The issue was caused by a directory ownership mismatch where the mounted repository directory (/github.com/vmware-tanzu/velero) is owned by root:root but the files inside are owned by the mapped user. This triggers Git's security feature and causes VCS stamping to fail with exit code 128. Changes: - Add .gitconfig file with safe.directory configuration for the mounted path - Mount .gitconfig as read-only volume in the shell target - This allows Git operations to work properly inside the container The fix is minimal, targeted, and maintains VCS stamping functionality while being compatible with both Docker and Podman container runtimes. Fixes #9004
1 parent 9a95743 commit 57e39cd

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

.gitconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[safe]
2+
directory = /github.com/vmware-tanzu/velero

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ shell: build-dirs build-env
213213
-v "$$(pwd)/.go/std/$(GOOS)/$(GOARCH):/usr/local/go/pkg/$(GOOS)_$(GOARCH)_static:delegated" \
214214
-v "$$(pwd)/.go/go-build:/.cache/go-build:delegated" \
215215
-v "$$(pwd)/.go/golangci-lint:/.cache/golangci-lint:delegated" \
216+
-v "$$(pwd)/.gitconfig:/root/.gitconfig:ro" \
216217
-w /github.com/vmware-tanzu/velero \
217218
$(BUILDER_IMAGE) \
218219
/bin/sh $(CMD)

0 commit comments

Comments
 (0)