From 796735bd71f91345936b5db735ed7a7f06b05d71 Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Thu, 7 Sep 2023 14:49:16 +0200 Subject: [PATCH] checkout dir might exist but not be a git repo --- containers/buildkite-linux/entrypoint.sh | 2 +- containers/buildkite-linux/pre-checkout | 2 +- containers/buildkite-windows/pre-checkout.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/containers/buildkite-linux/entrypoint.sh b/containers/buildkite-linux/entrypoint.sh index a0a3b6a..e2d58d5 100755 --- a/containers/buildkite-linux/entrypoint.sh +++ b/containers/buildkite-linux/entrypoint.sh @@ -32,7 +32,7 @@ rm -rf "$SCCACHE_DIR" mkdir -p "${SCCACHE_DIR}" chown -R ${USER}:${USER} "${SCCACHE_DIR}" chmod oug+rw "${SCCACHE_DIR}" -gosu "$USER" bash -c 'env; whoami; SCCACHE_DIR="${SCCACHE_DIR}" SCCACHE_IDLE_TIMEOUT=0 SCCACHE_CACHE_SIZE=20G sccache --start-server' +gosu "$USER" bash -c 'SCCACHE_DIR="${SCCACHE_DIR}" SCCACHE_IDLE_TIMEOUT=0 SCCACHE_CACHE_SIZE=20G sccache --start-server' # /mnt/ssh should contain known_hosts, id_rsa and id_rsa.pub . mkdir -p /var/lib/buildkite-agent/.ssh diff --git a/containers/buildkite-linux/pre-checkout b/containers/buildkite-linux/pre-checkout index b25b751..307ff75 100755 --- a/containers/buildkite-linux/pre-checkout +++ b/containers/buildkite-linux/pre-checkout @@ -26,7 +26,7 @@ gc_counter="$BUILDKITE_BUILD_PATH/git_gc_counter" echo "BUILDKITE_REPO: $BUILDKITE_REPO" if [ -d "$BUILDKITE_BUILD_CHECKOUT_PATH" ]; then cd "$BUILDKITE_BUILD_CHECKOUT_PATH" || exit - remoteUrl=$(git remote get-url origin) + remoteUrl=$(git remote get-url origin || echo "not a git repo") echo "current remote URL: $remoteUrl" if [ "$remoteUrl" != "$BUILDKITE_REPO" ]; then echo "Remote URL does not match. Deleting and recreating the directory." diff --git a/containers/buildkite-windows/pre-checkout.sh b/containers/buildkite-windows/pre-checkout.sh index 5318cc3..867eeaf 100644 --- a/containers/buildkite-windows/pre-checkout.sh +++ b/containers/buildkite-windows/pre-checkout.sh @@ -16,7 +16,7 @@ ps aux | grep "$BUILDKITE_BUILD_CHECKOUT_PATH" echo "BUILDKITE_REPO: $BUILDKITE_REPO" if [ -d "$BUILDKITE_BUILD_CHECKOUT_PATH" ]; then cd "$BUILDKITE_BUILD_CHECKOUT_PATH" || exit - remoteUrl=$(git remote get-url origin) + remoteUrl=$(git remote get-url origin || echo "not a git repo") echo "current remote URL: $remoteUrl" if [ "$remoteUrl" != "$BUILDKITE_REPO" ]; then echo "Remote URL does not match. Deleting and recreating the directory."