From 87e13eb3debc9421ba42f7007227243b3b466b5e Mon Sep 17 00:00:00 2001 From: Kai Lueke Date: Tue, 14 Feb 2023 11:31:21 +0900 Subject: [PATCH] ci-automation: Allow git to work on directory owned by other user The get_git_channel function failed to work which resulted in the Alpha release job skipping the AWS publishing for the Alpha channel because it defaulted to the developer channel as fallback when git rejected to work on the directory owned by the build user while running as root user. A new version of git caused this behavior change and also prints an error message that explains to have to set safe.directory. Set the git config entry safe.directory for the /work path when entering the mantle container where git runs as root while working on the directory owned by the build user. --- ci-automation/release.sh | 2 +- ci-automation/test.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ci-automation/release.sh b/ci-automation/release.sh index 1433b05853..f0e8efc27b 100644 --- a/ci-automation/release.sh +++ b/ci-automation/release.sh @@ -208,7 +208,7 @@ function _release_build_impl() { touch sdk_container/.env # This file should already contain the required credentials as env vars docker run --pull always --rm --name="${container_name}" --net host \ - -w /work -v "$PWD":/work "${mantle_ref}" bash -c "source ci-automation/release.sh; _inside_mantle" + -w /work -v "$PWD":/work "${mantle_ref}" bash -c "git config --global --add safe.directory /work && source ci-automation/release.sh && _inside_mantle" # Push flatcar_production_ami_*txt and flatcar_production_ami_*json to the right bincache folder for arch in amd64 arm64; do sudo chown -R "$USER:$USER" "aws-${arch}" diff --git a/ci-automation/test.sh b/ci-automation/test.sh index 6be101ee16..c9ec153a3d 100644 --- a/ci-automation/test.sh +++ b/ci-automation/test.sh @@ -186,7 +186,7 @@ function _test_run_impl() { touch sdk_container/.env docker run --pull always --rm --name="${container_name}" --privileged --net host -v /dev:/dev \ -w /work -v "$PWD":/work "${mantle_ref}" \ - bash -c "set -o noglob && source sdk_container/.env && ci-automation/vendor-testing/${image}.sh \ + bash -c "set -o noglob && git config --global --add safe.directory /work && source sdk_container/.env && ci-automation/vendor-testing/${image}.sh \ \"${work_dir}\" \ \"${tests_dir}\" \ \"${arch}\" \ @@ -196,6 +196,7 @@ function _test_run_impl() { set -e rm -f "${work_dir}/first_run" + # Note: git safe.directory is not set in this run as it does not use git docker run --pull always --rm --name="${container_name}" --privileged --net host -v /dev:/dev \ -w /work -v "$PWD":/work "${mantle_ref}" \ ci-automation/test_update_reruns.sh \