While bumping docker-registry.wikimedia.org/golang1.18 from 1.18-1-20230129 to 1.18-1-20230226 for a Wikimedia CLI I ran into an issue with my CI
https://gitlab.wikimedia.org/repos/releng/cli/-/jobs/72219
go: downloading github.com/subosito/gotenv v1.2.0
go: downloading github.com/pelletier/go-toml v1.9.4
failed to collect values: failed to get commit: git: error="exit status 128" stderr=fatal: detected dubious ownership in repository at '/builds/repos/releng/cli'
To add an exception for this directory, call:
git config --global --add safe.directory /builds/repos/releng/cli
/go/bin/gox-v1.0.1 -output="./_release/latest/mw_latest_{{.OS}}_{{.Arch}}" -osarch='darwin/amd64 darwin/arm64 linux/amd64 linux/386 linux/arm linux/arm64 linux/ppc64le windows/amd64' -ldflags '' gitlab.wikimedia.org/repos/releng/cli
Error reading packages: exit status 1
Stderr: error obtaining VCS status: exit status 128
Use -buildvcs=false to disable VCS stamping.
make: *** [Makefile:23: release] Error 1
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1As a result, I want to run git config --global --add safe.directory /builds/repos/releng/cli in my gitlab job.
However, I run into an issue as the nobody user can not create the nonexistent directory needed
nobody@b2cf1f51ff32:/go$ git config --global --add safe.directory /builds/repos/releng/cli error: could not lock config file /nonexistent/.gitconfig: No such file or directory nobody@b2cf1f51ff32:/home$ mkdir $HOME mkdir: cannot create directory ‘/nonexistent’: Permission denied
It would be great if images that use a user such as nobody out of the box all have home directories that actually exist so tooling such as git works