Archived
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DASH15okNvWeY1rVJmyJoJ
This commit is contained in:
@@ -305,17 +305,27 @@ if ! $SKIP_CREATE_VMS && ! $DRY_RUN; then
|
|||||||
fi
|
fi
|
||||||
unset -f local_ssh
|
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/<user>/nixos (the standalone nixos repo clone on pve1), but can be
|
||||||
|
# overridden to e.g. /home/<user>/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
|
if pve_check "test -d ${REMOTE_REPO}/.git" &>/dev/null; then
|
||||||
REMOTE_BRANCH=$(ssh -i ~/.ssh/id_ed25519 "${SSH_USER}@${NODE}" \
|
REMOTE_BRANCH=$(ssh -i ~/.ssh/id_ed25519 "${SSH_USER}@${NODE}" \
|
||||||
"cd ${REMOTE_REPO} && git rev-parse --abbrev-ref HEAD 2>/dev/null")
|
"cd ${REMOTE_REPO} && git rev-parse --abbrev-ref HEAD 2>/dev/null")
|
||||||
if [[ "$REMOTE_BRANCH" != "$CURRENT_BRANCH" ]]; then
|
if [[ "$REMOTE_BRANCH" != "$CURRENT_BRANCH" ]]; then
|
||||||
logn "Remote clone is on '${REMOTE_BRANCH}', switching to '${CURRENT_BRANCH}'..."
|
logn "Remote repo (${REMOTE_REPO}) is on '${REMOTE_BRANCH}', switching to '${CURRENT_BRANCH}'..."
|
||||||
ssh -i ~/.ssh/id_ed25519 "${SSH_USER}@${NODE}" \
|
if ssh -i ~/.ssh/id_ed25519 "${SSH_USER}@${NODE}" \
|
||||||
"cd ${REMOTE_REPO} && git fetch origin && git checkout '${CURRENT_BRANCH}' && git pull --ff-only"
|
"cd ${REMOTE_REPO} && git fetch origin && git checkout '${CURRENT_BRANCH}' && git pull --ff-only" 2>&1; then
|
||||||
logn "Done."
|
logn "Done."
|
||||||
|
else
|
||||||
|
logn "WARNING: branch switch failed — proceeding anyway (create-proxmox-resource.sh will retry)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
logn "Remote repo ${REMOTE_REPO} not found on ${NODE} — create-proxmox-resource.sh will clone it."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ── Phase 4: Create VMs ───────────────────────────────────────────────────────
|
# ── Phase 4: Create VMs ───────────────────────────────────────────────────────
|
||||||
|
|||||||
Reference in New Issue
Block a user