From 3b6ac30946c3e5dcd6baba043d7767d45e7bb8f7 Mon Sep 17 00:00:00 2001 From: beatzaplenty Date: Thu, 30 Jul 2026 19:43:21 +1000 Subject: [PATCH] fix(deploy): use PROXMOX_REMOTE_REPO_DIR for remote repo path in phase 3.5 The phase 3.5 branch-switch step was hardcoded to /home/user/nixos, which assumes the standalone nixos Gitea repo is checked out there. When the infrastructure mono-repo is used instead, the path differs. Now reads PROXMOX_REMOTE_REPO_DIR (same variable create-proxmox-resource.sh uses) with graceful fallback if the branch switch fails. Co-Authored-By: Claude Sonnet 4.6 Claude-Session: https://claude.ai/code/session_01DASH15okNvWeY1rVJmyJoJ --- scripts/docker-swarm/deploy.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/scripts/docker-swarm/deploy.sh b/scripts/docker-swarm/deploy.sh index be2b434..9268dcf 100755 --- a/scripts/docker-swarm/deploy.sh +++ b/scripts/docker-swarm/deploy.sh @@ -305,16 +305,26 @@ if ! $SKIP_CREATE_VMS && ! $DRY_RUN; then fi unset -f local_ssh - REMOTE_REPO="/home/${SSH_USER}/nixos" + # Use PROXMOX_REMOTE_REPO_DIR (from env.sh) so the build path is consistent + # with what create-proxmox-resource.sh will use. The default is + # /home//nixos (the standalone nixos repo clone on pve1), but can be + # overridden to e.g. /home//infrastructure/nixos when the infrastructure + # mono-repo is checked out on pve1 instead. + REMOTE_REPO="${PROXMOX_REMOTE_REPO_DIR:-/home/${SSH_USER}/nixos}" if pve_check "test -d ${REMOTE_REPO}/.git" &>/dev/null; then REMOTE_BRANCH=$(ssh -i ~/.ssh/id_ed25519 "${SSH_USER}@${NODE}" \ "cd ${REMOTE_REPO} && git rev-parse --abbrev-ref HEAD 2>/dev/null") if [[ "$REMOTE_BRANCH" != "$CURRENT_BRANCH" ]]; then - logn "Remote clone is on '${REMOTE_BRANCH}', switching to '${CURRENT_BRANCH}'..." - ssh -i ~/.ssh/id_ed25519 "${SSH_USER}@${NODE}" \ - "cd ${REMOTE_REPO} && git fetch origin && git checkout '${CURRENT_BRANCH}' && git pull --ff-only" - logn "Done." + logn "Remote repo (${REMOTE_REPO}) is on '${REMOTE_BRANCH}', switching to '${CURRENT_BRANCH}'..." + if ssh -i ~/.ssh/id_ed25519 "${SSH_USER}@${NODE}" \ + "cd ${REMOTE_REPO} && git fetch origin && git checkout '${CURRENT_BRANCH}' && git pull --ff-only" 2>&1; then + logn "Done." + else + logn "WARNING: branch switch failed — proceeding anyway (create-proxmox-resource.sh will retry)" + fi fi + else + logn "Remote repo ${REMOTE_REPO} not found on ${NODE} — create-proxmox-resource.sh will clone it." fi fi