Run cluster rebuild when Actions has no kubeconfig
Homelab Main / deploy (push) Failing after 37s Details

This commit is contained in:
juvdiaz 2026-05-27 14:44:41 -06:00
parent 0a53f6bc20
commit 80648f8e7a
2 changed files with 28 additions and 4 deletions

View File

@ -155,4 +155,23 @@ jobs:
fi
git -C "${deploy_dir}" push local-bootstrap HEAD:main
"${deploy_dir}/lab.sh" apps
kubeconfig_probe="${KUBECONFIG_PATH:-${TF_VAR_kubeconfig_path:-${HOME}/.kube/config}}"
action_command="${HOMELAB_ACTION_COMMAND:-auto}"
if [[ "${action_command}" == "auto" ]]; then
if [[ -s "${kubeconfig_probe}" ]]; then
action_command="apps"
else
action_command="rebuild-cluster"
fi
fi
case "${action_command}" in
apps | rebuild-cluster)
echo "Running lab.sh ${action_command}"
"${deploy_dir}/lab.sh" "${action_command}"
;;
*)
echo "Unsupported HOMELAB_ACTION_COMMAND: ${action_command}" >&2
exit 1
;;
esac

View File

@ -370,8 +370,8 @@ The Debian bare repo remains the GitOps mirror:
```
Argo CD consumes that Debian mirror through the default `gitops_repo_url`.
Gitea Actions pushes the `main` commit into the mirror before running
`./lab.sh apps`.
Gitea Actions pushes the `main` commit into the mirror before running the
selected deploy command.
Deploy or refresh the external Gitea container from the Debian host with:
@ -424,7 +424,12 @@ a repository-scoped Debian host runner with the label `homelab-debian`.
The workflow only blocks automatic deploy for Raspberry Pi Gitea service
changes: files under `infra/gitea/`, or edits inside the `deploy_gitea`,
`install_gitea_backup_timer`, `backup_gitea`, or `drill_gitea_restore`
functions in `lab.sh`. Other changes proceed directly to `./lab.sh apps`.
functions in `lab.sh`. Other changes use `HOMELAB_ACTION_COMMAND=auto` by
default: Actions runs `./lab.sh apps` when the Debian runner already has a
cluster kubeconfig, or `./lab.sh rebuild-cluster` when it does not.
Set `HOMELAB_ACTION_COMMAND=apps` or `HOMELAB_ACTION_COMMAND=rebuild-cluster`
on the runner to force one path.
`./lab.sh bootstrap-gitea-repo` also registers the Debian host SSH public key
with the Gitea repository and switches the Debian working copy's `gitea` remote