Refactor sync-vps-repos.sh and run-vps-data-production.sh to use native git -c core.sshCommand="..." for infallible deploy key authentication
This commit is contained in:
1 parent
2242cf4ecb
commit
fff43cca6d
3 files changed
+24
-21
No files matched your search
@@ -129,25 +129,27 @@ fi
|
||||
if [[ "${DO_PUSH}" -eq 1 ]] && [[ -f "/etc/hyperstitionstud.io/id_ed25519_git_libre_audio" ]]; then
|
||||
echo "[4/5] Committing and pushing automated VPS telemetry updates to git.libre.audio..."
|
||||
run_checked "hs-readme-sync --all" "${PYTHON_BIN}" -m hyperstitionstud_io.publishing.readme_sync --all
|
||||
export GIT_SSH_COMMAND="ssh -i /etc/hyperstitionstud.io/id_ed25519_git_libre_audio -p 2222 -o StrictHostKeyChecking=accept-new"
|
||||
DEPLOY_KEY="/etc/hyperstitionstud.io/id_ed25519_git_libre_audio"
|
||||
GIT_SSH_CMD="ssh -i ${DEPLOY_KEY} -p 2222 -o IdentitiesOnly=yes -o IdentityAgent=none -o BatchMode=yes -o StrictHostKeyChecking=accept-new"
|
||||
GIT_SSH_FLAGS=(-c "core.sshCommand=${GIT_SSH_CMD}")
|
||||
STAMP_UTC="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||
for r in hyperstitionstudio-core ingglish-hyperdope-gematria encyclopedia-knowledge-graph; do
|
||||
if [[ -d "${REPOS_ROOT}/${r}/.git" ]]; then
|
||||
if [[ "${PUSH_ONLY}" -eq 1 ]]; then
|
||||
echo " -> Inspecting ${r} for telemetry updates..."
|
||||
fi
|
||||
if ! git -C "${REPOS_ROOT}/${r}" config user.name 2>&1; then
|
||||
git -C "${REPOS_ROOT}/${r}" config user.name "Hyperstition VPS Bot"
|
||||
git -C "${REPOS_ROOT}/${r}" config user.email "vps-bot@hyperstitionstud.io"
|
||||
if ! git "${GIT_SSH_FLAGS[@]}" -C "${REPOS_ROOT}/${r}" config user.name 2>&1; then
|
||||
git "${GIT_SSH_FLAGS[@]}" -C "${REPOS_ROOT}/${r}" config user.name "Hyperstition VPS Bot"
|
||||
git "${GIT_SSH_FLAGS[@]}" -C "${REPOS_ROOT}/${r}" config user.email "vps-bot@hyperstitionstud.io"
|
||||
fi
|
||||
forge_ssh="ssh://git@git.libre.audio:2222/seasharp"
|
||||
git -C "${REPOS_ROOT}/${r}" remote set-url origin "${forge_ssh}/${r}.git" || true
|
||||
git -C "${REPOS_ROOT}/${r}" add -A
|
||||
if ! git -C "${REPOS_ROOT}/${r}" diff --cached --quiet; then
|
||||
git "${GIT_SSH_FLAGS[@]}" -C "${REPOS_ROOT}/${r}" remote set-url origin "${forge_ssh}/${r}.git" || true
|
||||
git "${GIT_SSH_FLAGS[@]}" -C "${REPOS_ROOT}/${r}" add -A
|
||||
if ! git "${GIT_SSH_FLAGS[@]}" -C "${REPOS_ROOT}/${r}" diff --cached --quiet; then
|
||||
if [[ "${PUSH_ONLY}" -eq 1 ]]; then
|
||||
echo " [commit] Committing new telemetry changes in ${r}..."
|
||||
fi
|
||||
run_checked "git commit (${r})" git -C "${REPOS_ROOT}/${r}" commit -m "chore(telemetry): automated VPS ${WINDOW_MODE} harvest (${STAMP_UTC})" || true
|
||||
run_checked "git commit (${r})" git "${GIT_SSH_FLAGS[@]}" -C "${REPOS_ROOT}/${r}" commit -m "chore(telemetry): automated VPS ${WINDOW_MODE} harvest (${STAMP_UTC})" || true
|
||||
else
|
||||
if [[ "${PUSH_ONLY}" -eq 1 ]]; then
|
||||
echo " [clean] Repository ${r} working tree is clean (no new local telemetry changes to commit)."
|
||||
@@ -156,11 +158,11 @@ if [[ "${DO_PUSH}" -eq 1 ]] && [[ -f "/etc/hyperstitionstud.io/id_ed25519_git_li
|
||||
if [[ "${PUSH_ONLY}" -eq 1 ]]; then
|
||||
echo " [sync] Pulling and rebasing origin/main for ${r}..."
|
||||
fi
|
||||
run_checked "git pull --rebase --autostash (${r})" git -C "${REPOS_ROOT}/${r}" pull --rebase --autostash origin main || true
|
||||
run_checked "git pull --rebase --autostash (${r})" git "${GIT_SSH_FLAGS[@]}" -C "${REPOS_ROOT}/${r}" pull --rebase --autostash origin main || true
|
||||
if [[ "${PUSH_ONLY}" -eq 1 ]]; then
|
||||
echo " [push] Pushing ${r} to git.libre.audio..."
|
||||
fi
|
||||
run_checked "git push (${r})" git -C "${REPOS_ROOT}/${r}" push origin main || true
|
||||
run_checked "git push (${r})" git "${GIT_SSH_FLAGS[@]}" -C "${REPOS_ROOT}/${r}" push origin main || true
|
||||
if [[ "${PUSH_ONLY}" -eq 1 ]]; then
|
||||
echo " [ok] Repository ${r} successfully pushed to git.libre.audio."
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user