From 063db516f28aabedc17a3b205ce8665f720d9473 Mon Sep 17 00:00:00 2001 From: Zvonko Kaiser Date: Thu, 30 May 2024 15:12:28 +0000 Subject: [PATCH] ci: Remove all git config safe.directory Now with the sudo less build we should be good to remove those hacks. Signed-off-by: Zvonko Kaiser --- ci/lib.sh | 8 +------- .../kata-deploy/local-build/kata-deploy-binaries.sh | 2 -- tools/packaging/scripts/lib.sh | 2 -- .../static-build/cloud-hypervisor/build-static-clh.sh | 1 - 4 files changed, 1 insertion(+), 12 deletions(-) diff --git a/ci/lib.sh b/ci/lib.sh index 28add11b10..f5526bd1af 100644 --- a/ci/lib.sh +++ b/ci/lib.sh @@ -21,13 +21,7 @@ clone_tests_repo() { if [ -d "$tests_repo_dir" ]; then [ -n "${CI:-}" ] && return - # git config --global --add safe.directory will always append - # the target to .gitconfig without checking the existence of - # the target, so it's better to check it before adding the target repo. - local sd="$(git config --global --get safe.directory ${tests_repo_dir} || true)" - if [ -z "${sd}" ]; then - git config --global --add safe.directory ${tests_repo_dir} - fi + pushd "${tests_repo_dir}" git checkout "${branch}" git pull diff --git a/tools/packaging/kata-deploy/local-build/kata-deploy-binaries.sh b/tools/packaging/kata-deploy/local-build/kata-deploy-binaries.sh index bb121542a2..545c272db4 100755 --- a/tools/packaging/kata-deploy/local-build/kata-deploy-binaries.sh +++ b/tools/packaging/kata-deploy/local-build/kata-deploy-binaries.sh @@ -1211,8 +1211,6 @@ silent_mode_error_trap() { } main() { - git config --global --add safe.directory ${repo_root_dir} - local build_targets local silent build_targets=( diff --git a/tools/packaging/scripts/lib.sh b/tools/packaging/scripts/lib.sh index af1b1cd040..453dc907a9 100644 --- a/tools/packaging/scripts/lib.sh +++ b/tools/packaging/scripts/lib.sh @@ -107,8 +107,6 @@ get_last_modification() { local file="${1}" pushd ${repo_root_dir} &> /dev/null - # This is a workaround needed for when running this code on Jenkins - git config --global --add safe.directory ${repo_root_dir} &> /dev/null dirty="" [ $(git status --porcelain | grep "${file#${repo_root_dir}/}" | wc -l) -gt 0 ] && dirty="-dirty" diff --git a/tools/packaging/static-build/cloud-hypervisor/build-static-clh.sh b/tools/packaging/static-build/cloud-hypervisor/build-static-clh.sh index f381897bcd..1ce0b67a16 100755 --- a/tools/packaging/static-build/cloud-hypervisor/build-static-clh.sh +++ b/tools/packaging/static-build/cloud-hypervisor/build-static-clh.sh @@ -59,7 +59,6 @@ build_clh_from_source() { repo_dir="${repo_dir//.git}" rm -rf "${repo_dir}" git clone "${cloud_hypervisor_repo}" - git config --global --add safe.directory "$PWD/repo_dir" pushd "${repo_dir}" if [ -n "${cloud_hypervisor_pr}" ]; then