deploy: add --direct SSH push mode (gitea push pending credentials)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
a148b4a543
commit
65dc0061b5
@ -1,7 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Push current main to Gitea, then pull + smoke-test on the studio Macs.
|
# Push current main to Gitea, then pull + smoke-test on the studio Macs.
|
||||||
# ./scripts/deploy.sh # push + pull + remote smoke on all hosts
|
# ./scripts/deploy.sh # push to gitea + pull + remote smoke
|
||||||
|
# ./scripts/deploy.sh --direct # no gitea: push straight to hosts over SSH
|
||||||
# ./scripts/deploy.sh --no-smoke # skip the remote smoke tests
|
# ./scripts/deploy.sh --no-smoke # skip the remote smoke tests
|
||||||
|
#
|
||||||
|
# --direct needs the host repos to exist with
|
||||||
|
# git config receive.denyCurrentBranch updateInstead
|
||||||
|
# (already set up on m3ultra and m1ultra).
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
REPO_URL="https://gitea.partly.party/monster/MIRPAMO.git"
|
REPO_URL="https://gitea.partly.party/monster/MIRPAMO.git"
|
||||||
@ -15,20 +20,31 @@ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|||||||
cd "$ROOT"
|
cd "$ROOT"
|
||||||
|
|
||||||
RUN_SMOKE=1
|
RUN_SMOKE=1
|
||||||
[[ "${1:-}" == "--no-smoke" ]] && RUN_SMOKE=0
|
DIRECT=0
|
||||||
|
for arg in "$@"; do
|
||||||
|
[[ "$arg" == "--no-smoke" ]] && RUN_SMOKE=0
|
||||||
|
[[ "$arg" == "--direct" ]] && DIRECT=1
|
||||||
|
done
|
||||||
|
|
||||||
echo "== pushing to $REPO_URL"
|
if [[ $DIRECT == 0 ]]; then
|
||||||
git push origin main
|
echo "== pushing to $REPO_URL"
|
||||||
|
git push origin main
|
||||||
|
fi
|
||||||
|
|
||||||
for HOST in "${HOSTS[@]}"; do
|
for HOST in "${HOSTS[@]}"; do
|
||||||
echo
|
echo
|
||||||
echo "== $HOST: pull"
|
if [[ $DIRECT == 1 ]]; then
|
||||||
ssh -o ConnectTimeout=10 "$HOST" "
|
echo "== $HOST: direct push"
|
||||||
if [ -d $REMOTE_PATH/.git ]; then
|
git push "ssh://$HOST/Users/${HOST%%@*}/Documents/MIRPAMO" main
|
||||||
git -C $REMOTE_PATH pull --ff-only
|
else
|
||||||
else
|
echo "== $HOST: pull"
|
||||||
git clone $REPO_URL $REMOTE_PATH
|
ssh -o ConnectTimeout=10 "$HOST" "
|
||||||
fi"
|
if [ -d $REMOTE_PATH/.git ]; then
|
||||||
|
git -C $REMOTE_PATH pull --ff-only origin main
|
||||||
|
else
|
||||||
|
git clone $REPO_URL $REMOTE_PATH
|
||||||
|
fi"
|
||||||
|
fi
|
||||||
if [[ $RUN_SMOKE == 1 ]]; then
|
if [[ $RUN_SMOKE == 1 ]]; then
|
||||||
echo "== $HOST: smoke test"
|
echo "== $HOST: smoke test"
|
||||||
ssh "$HOST" "cd $REMOTE_PATH && ./bin/mirpamo smoke" \
|
ssh "$HOST" "cd $REMOTE_PATH && ./bin/mirpamo smoke" \
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user