From e2aa1dfae1646aeddd3359cd791c06181d378f13 Mon Sep 17 00:00:00 2001 From: Albert Esteve Date: Tue, 21 Feb 2023 10:44:08 +0100 Subject: [PATCH] ci/*.sh: add workaround for git dubious ownership Lint and test jobs are failing with git config --global --add safe.directory /__w/vdsm/vdsm fatal: detected dubious ownership in repository at '/__w/vdsm/vdsm' To add an exception for this directory, call: As suggested in [1], add current directory to the git safe list to avoid the issue. [1] https://github.com/actions/runner-images/issues/6775 Signed-off-by: Albert Esteve --- ci/lint.sh | 11 +++++++++-- ci/tests-storage.sh | 11 +++++++++-- ci/tests.sh | 11 +++++++++-- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/ci/lint.sh b/ci/lint.sh index 47ca089949..a18987a405 100755 --- a/ci/lint.sh +++ b/ci/lint.sh @@ -3,8 +3,15 @@ # SPDX-FileCopyrightText: Red Hat, Inc. # SPDX-License-Identifier: GPL-2.0-or-later -# Activate the tests venv (for containers only) -[ -d /venv ] && source /venv/bin/activate +# Only when running in a container +[ -d /venv ] && { + # Workaround to avoid this warning: + # fatal: detected dubious ownership in repository at '/dir' + git config --global --add safe.directory "$(pwd)" + + # Activate the tests venv (for containers only) + source /venv/bin/activate +} ./autogen.sh --system make diff --git a/ci/tests-storage.sh b/ci/tests-storage.sh index 694bc0ab83..c1e5e9195b 100755 --- a/ci/tests-storage.sh +++ b/ci/tests-storage.sh @@ -56,8 +56,15 @@ if [ -z "$user" ]; then exit 1 fi -# Activate the tests venv (for containers only) -[ -d /venv ] && source /venv/bin/activate +# Only when running in a container +[ -d /venv ] && { + # Workaround to avoid this warning: + # fatal: detected dubious ownership in repository at '/dir' + git config --global --add safe.directory "$(pwd)" + + # Activate the tests venv (for containers only) + source /venv/bin/activate +} echo "Running tests as user $user" diff --git a/ci/tests.sh b/ci/tests.sh index fcaccce837..ed449dc743 100755 --- a/ci/tests.sh +++ b/ci/tests.sh @@ -9,8 +9,15 @@ echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6 SUFFIX=$RANDOM ip link add mod_bond$SUFFIX type bond && ip link del mod_bond$SUFFIX -# Activate the tests venv (for containers only) -[ -d /venv ] && source /venv/bin/activate +# Only when running in a container +[ -d /venv ] && { + # Workaround to avoid this warning: + # fatal: detected dubious ownership in repository at '/dir' + git config --global --add safe.directory "$(pwd)" + + # Activate the tests venv (for containers only) + source /venv/bin/activate +} ./autogen.sh --system make