From d57bbdb5cd24966a4a6f01dbdea6b17a6ef2965b Mon Sep 17 00:00:00 2001 From: Chris Evich Date: Tue, 26 Apr 2022 14:38:43 -0400 Subject: Cirrus: Fix ownership of repos. to keep git happy Newer versions of git are much more pedantic about who owns the repository files. When setting up to run rootless, prior to this commit, the repo. ownership was changed from root. This causes all subsequent git-operations as root to fail: ``` fatal: unsafe repository ('<$GOSRC>' is owned by someone else) ``` Fix this by re-ordering operations, such that the change in ownership is done immediately before executing as a user. Also disable the git-ownership check on the source repository assuming the CI environment is disposable. Signed-off-by: Chris Evich --- contrib/cirrus/runner.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'contrib/cirrus/runner.sh') diff --git a/contrib/cirrus/runner.sh b/contrib/cirrus/runner.sh index 832339d07..101270703 100755 --- a/contrib/cirrus/runner.sh +++ b/contrib/cirrus/runner.sh @@ -449,6 +449,13 @@ if [[ "$PRIV_NAME" == "rootless" ]] && [[ "$UID" -eq 0 ]]; then # https://github.com/containers/podman/issues/10857 rm -rf /var/lib/cni + # This must be done at the last second, otherwise `make` calls + # in setup_environment (as root) will balk about ownership. + msg "Recursively chowning \$GOPATH and \$GOSRC to $ROOTLESS_USER" + if [[ $PRIV_NAME = "rootless" ]]; then + chown -R $ROOTLESS_USER:$ROOTLESS_USER "$GOPATH" "$GOSRC" + fi + req_env_vars ROOTLESS_USER msg "Re-executing runner through ssh as user '$ROOTLESS_USER'" msg "************************************************************" -- cgit v1.2.3-54-g00ecf