Remove Actions deploy SSH fetch
Homelab Main / deploy (push) Failing after 20s
Details
Homelab Main / deploy (push) Failing after 20s
Details
This commit is contained in:
parent
11021138d7
commit
0a53f6bc20
|
|
@ -123,26 +123,36 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
gitea_ssh_url="${GITEA_SSH_URL:-ssh://git@192.168.100.89:32222/jv/my-homelab-configs.git}"
|
workspace_dir="${PWD}"
|
||||||
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:-}"
|
||||||
deploy_dir="${HOMELAB_DEPLOY_DIR:-/home/jv/my-homelab-configs}"
|
if [[ -z "${deploy_dir}" ]]; then
|
||||||
|
for candidate in /home/jv/my-homelab-configs /home/jv/repos/my-homelab-configs "${workspace_dir}"; do
|
||||||
if [[ ! -d "${deploy_dir}/.git" ]]; then
|
if [[ -d "${candidate}/.git" ]]; then
|
||||||
echo "Persistent deploy checkout ${deploy_dir} was not found; using Actions workspace ${PWD}."
|
deploy_dir="${candidate}"
|
||||||
deploy_dir="${PWD}"
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
if [[ ! -d "${deploy_dir}/.git" ]]; then
|
if [[ ! -d "${deploy_dir}/.git" ]]; then
|
||||||
echo "Deploy checkout ${deploy_dir} is not a Git repository." >&2
|
echo "Deploy checkout ${deploy_dir} is not a Git repository." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Deploy checkout: ${deploy_dir}"
|
if [[ "${deploy_dir}" != "${workspace_dir}" ]]; then
|
||||||
|
echo "Persistent deploy checkout: ${deploy_dir}"
|
||||||
|
git -C "${deploy_dir}" fetch "${workspace_dir}" HEAD
|
||||||
|
git -C "${deploy_dir}" checkout -B main FETCH_HEAD
|
||||||
|
git -C "${deploy_dir}" reset --hard FETCH_HEAD
|
||||||
|
else
|
||||||
|
echo "Deploy checkout: ${deploy_dir}"
|
||||||
|
git -C "${deploy_dir}" checkout -B main HEAD
|
||||||
|
git -C "${deploy_dir}" reset --hard HEAD
|
||||||
|
fi
|
||||||
|
|
||||||
git -C "${deploy_dir}" remote set-url gitea "${gitea_ssh_url}" || \
|
if git -C "${deploy_dir}" remote get-url local-bootstrap >/dev/null 2>&1; then
|
||||||
git -C "${deploy_dir}" remote add gitea "${gitea_ssh_url}"
|
git -C "${deploy_dir}" remote set-url local-bootstrap /home/jv/git-server/my-homelab-configs.git
|
||||||
GIT_SSH_COMMAND="${gitea_ssh_command}" git -C "${deploy_dir}" fetch gitea main
|
else
|
||||||
git -C "${deploy_dir}" checkout -B main "${{ gitea.sha }}"
|
|
||||||
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
|
||||||
|
fi
|
||||||
git -C "${deploy_dir}" push local-bootstrap HEAD:main
|
git -C "${deploy_dir}" push local-bootstrap HEAD:main
|
||||||
|
|
||||||
"${deploy_dir}/lab.sh" apps
|
"${deploy_dir}/lab.sh" apps
|
||||||
|
|
|
||||||
|
|
@ -431,9 +431,11 @@ with the Gitea repository and switches the Debian working copy's `gitea` remote
|
||||||
to `ssh://git@192.168.100.89:32222/jv/my-homelab-configs.git`. The default key
|
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 uses the checked-out Actions workspace
|
||||||
through that SSH endpoint when `HOMELAB_DEPLOY_DIR` exists, and otherwise falls
|
as the source commit, updates the first available persistent checkout from
|
||||||
back to the checked-out Actions workspace.
|
`HOMELAB_DEPLOY_DIR`, `/home/jv/my-homelab-configs`, or
|
||||||
|
`/home/jv/repos/my-homelab-configs`, and otherwise deploys directly from the
|
||||||
|
Actions workspace. It does not need SSH read access back to Gitea.
|
||||||
|
|
||||||
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:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue