Make Actions deploy checkout fallback explicit
Homelab Main / deploy (push) Failing after 13s Details

This commit is contained in:
juvdiaz 2026-05-27 14:35:17 -06:00
parent f8d2286558
commit 11021138d7
2 changed files with 15 additions and 6 deletions

View File

@ -123,16 +123,24 @@ jobs:
run: | run: |
set -euo pipefail set -euo pipefail
deploy_dir="${HOMELAB_DEPLOY_DIR:-/home/jv/my-homelab-configs}"
test -d "${deploy_dir}/.git"
gitea_ssh_url="${GITEA_SSH_URL:-ssh://git@192.168.100.89:32222/jv/my-homelab-configs.git}" gitea_ssh_url="${GITEA_SSH_URL:-ssh://git@192.168.100.89:32222/jv/my-homelab-configs.git}"
gitea_ssh_command="${GITEA_SSH_COMMAND:-ssh -i /home/jv/.ssh/id_ed25519 -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new}" gitea_ssh_command="${GITEA_SSH_COMMAND:-ssh -i /home/jv/.ssh/id_ed25519 -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new}"
deploy_dir="${HOMELAB_DEPLOY_DIR:-/home/jv/my-homelab-configs}"
if [[ ! -d "${deploy_dir}/.git" ]]; then
echo "Persistent deploy checkout ${deploy_dir} was not found; using Actions workspace ${PWD}."
deploy_dir="${PWD}"
fi
if [[ ! -d "${deploy_dir}/.git" ]]; then
echo "Deploy checkout ${deploy_dir} is not a Git repository." >&2
exit 1
fi
echo "Deploy checkout: ${deploy_dir}"
git -C "${deploy_dir}" remote set-url gitea "${gitea_ssh_url}" || \ git -C "${deploy_dir}" remote set-url gitea "${gitea_ssh_url}" || \
git -C "${deploy_dir}" remote add gitea "${gitea_ssh_url}" git -C "${deploy_dir}" remote add gitea "${gitea_ssh_url}"
GIT_SSH_COMMAND="${gitea_ssh_command}" git -C "${deploy_dir}" fetch gitea main GIT_SSH_COMMAND="${gitea_ssh_command}" git -C "${deploy_dir}" fetch gitea main
git -C "${deploy_dir}" checkout main git -C "${deploy_dir}" checkout -B main "${{ gitea.sha }}"
git -C "${deploy_dir}" reset --hard "${{ gitea.sha }}"
git -C "${deploy_dir}" remote set-url local-bootstrap /home/jv/git-server/my-homelab-configs.git || \ git -C "${deploy_dir}" remote set-url local-bootstrap /home/jv/git-server/my-homelab-configs.git || \
git -C "${deploy_dir}" remote add local-bootstrap /home/jv/git-server/my-homelab-configs.git git -C "${deploy_dir}" remote add local-bootstrap /home/jv/git-server/my-homelab-configs.git
git -C "${deploy_dir}" push local-bootstrap HEAD:main git -C "${deploy_dir}" push local-bootstrap HEAD:main

View File

@ -432,7 +432,8 @@ to `ssh://git@192.168.100.89:32222/jv/my-homelab-configs.git`. The default key
is `/home/jv/.ssh/id_ed25519.pub`; set `LAB_GITEA_REPO_SSH_KEY_PATH` to use a is `/home/jv/.ssh/id_ed25519.pub`; set `LAB_GITEA_REPO_SSH_KEY_PATH` to use a
different Debian-host key, or `LAB_GITEA_REPO_SSH_BOOTSTRAP=false` to leave SSH different Debian-host key, or `LAB_GITEA_REPO_SSH_BOOTSTRAP=false` to leave SSH
access unchanged. The Actions deploy job fetches the persistent Debian checkout access unchanged. The Actions deploy job fetches the persistent Debian checkout
through that SSH endpoint. through that SSH endpoint when `HOMELAB_DEPLOY_DIR` exists, and otherwise falls
back to the checked-out Actions workspace.
Enable Actions for the repository in Gitea, then create a repository-level runner Enable Actions for the repository in Gitea, then create a repository-level runner
token from: token from: