fix: replace bash-isms with sh-compatible syntax and add local-bootstrap existence check
Homelab Main / validate (push) Successful in 20s Details
Homelab Main / deploy (push) Failing after 22s Details

This commit is contained in:
jv 2026-09-18 14:41:47 -05:00
parent 8bbaa456d3
commit e0a23e1597
1 changed files with 16 additions and 13 deletions

View File

@ -149,19 +149,19 @@ jobs:
workspace_dir="${PWD}"
deploy_dir="${HOMELAB_DEPLOY_DIR:-}"
if [[ -z "${deploy_dir}" ]]; then
if [ -z "${deploy_dir}" ]; then
for candidate in /home/jv/my-homelab-configs /home/jv/repos/my-homelab-configs "${workspace_dir}"; do
if [[ -d "${candidate}/.git" ]]; then
if [ -d "${candidate}/.git" ]; then
deploy_dir="${candidate}"
break
fi
done
fi
if [[ ! -d "${deploy_dir}/.git" ]]; then
if [ ! -d "${deploy_dir}/.git" ]; then
echo "Deploy checkout ${deploy_dir} is not a Git repository." >&2
exit 1
fi
if [[ "${deploy_dir}" != "${workspace_dir}" ]]; then
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
@ -172,24 +172,27 @@ jobs:
git -C "${deploy_dir}" reset --hard HEAD
fi
if git -C "${deploy_dir}" remote get-url local-bootstrap >/dev/null 2>&1; then
git -C "${deploy_dir}" remote set-url local-bootstrap /home/jv/git-server/my-homelab-configs.git
else
git -C "${deploy_dir}" remote add local-bootstrap /home/jv/git-server/my-homelab-configs.git
# Set up local-bootstrap remote if the directory exists
if [ -d "/home/jv/git-server/my-homelab-configs.git" ]; then
if git -C "${deploy_dir}" remote get-url local-bootstrap >/dev/null 2>&1; then
git -C "${deploy_dir}" remote set-url local-bootstrap /home/jv/git-server/my-homelab-configs.git
else
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
fi
git -C "${deploy_dir}" push local-bootstrap HEAD:main
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
if [ "${action_command}" = "auto" ]; then
if [ -s "${kubeconfig_probe}" ]; then
set +e
version_report="$("${deploy_dir}/jeannie" doctor-versions 2>&1)"
version_status=$?
set -e
printf '%s\n' "${version_report}"
if ((version_status == 0)); then
if [ "${version_status}" -eq 0 ]; then
action_command="apps"
elif printf '%s\n' "${version_report}" | grep -Eq 'Kubernetes kubelet minors are mixed|At least one kubelet does not match'; then
echo "Kubernetes node version drift detected; switching automatic deploy to rebuild-cluster."
@ -209,7 +212,7 @@ jobs:
"${deploy_dir}/jeannie" "${action_command}"
;;
*)
echo "Unsupported HOMELAB_ACTION_COMMAND: ${action_command}"
echo "Unsupported HOMELAB_ACTION_COMMAND: ${action_command}" >&2
exit 1
;;
esac