1
0
Fork 0

checkout dir might exist but not be a git repo

This commit is contained in:
Mikhail Goncharov 2023-09-07 14:49:16 +02:00
parent c6d092ec94
commit 796735bd71
3 changed files with 3 additions and 3 deletions

View file

@ -32,7 +32,7 @@ rm -rf "$SCCACHE_DIR"
mkdir -p "${SCCACHE_DIR}" mkdir -p "${SCCACHE_DIR}"
chown -R ${USER}:${USER} "${SCCACHE_DIR}" chown -R ${USER}:${USER} "${SCCACHE_DIR}"
chmod oug+rw "${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 . # /mnt/ssh should contain known_hosts, id_rsa and id_rsa.pub .
mkdir -p /var/lib/buildkite-agent/.ssh mkdir -p /var/lib/buildkite-agent/.ssh

View file

@ -26,7 +26,7 @@ gc_counter="$BUILDKITE_BUILD_PATH/git_gc_counter"
echo "BUILDKITE_REPO: $BUILDKITE_REPO" echo "BUILDKITE_REPO: $BUILDKITE_REPO"
if [ -d "$BUILDKITE_BUILD_CHECKOUT_PATH" ]; then if [ -d "$BUILDKITE_BUILD_CHECKOUT_PATH" ]; then
cd "$BUILDKITE_BUILD_CHECKOUT_PATH" || exit 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" echo "current remote URL: $remoteUrl"
if [ "$remoteUrl" != "$BUILDKITE_REPO" ]; then if [ "$remoteUrl" != "$BUILDKITE_REPO" ]; then
echo "Remote URL does not match. Deleting and recreating the directory." echo "Remote URL does not match. Deleting and recreating the directory."

View file

@ -16,7 +16,7 @@ ps aux | grep "$BUILDKITE_BUILD_CHECKOUT_PATH"
echo "BUILDKITE_REPO: $BUILDKITE_REPO" echo "BUILDKITE_REPO: $BUILDKITE_REPO"
if [ -d "$BUILDKITE_BUILD_CHECKOUT_PATH" ]; then if [ -d "$BUILDKITE_BUILD_CHECKOUT_PATH" ]; then
cd "$BUILDKITE_BUILD_CHECKOUT_PATH" || exit 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" echo "current remote URL: $remoteUrl"
if [ "$remoteUrl" != "$BUILDKITE_REPO" ]; then if [ "$remoteUrl" != "$BUILDKITE_REPO" ]; then
echo "Remote URL does not match. Deleting and recreating the directory." echo "Remote URL does not match. Deleting and recreating the directory."