1
0
mirror of git://f0xx.org/ac/ac-scripts synced 2026-07-29 03:57:56 +03:00

full_deployment: auto-bump ac-workspace submodule SHAs before phase_app

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Anton Afanasyeu
2026-07-04 11:31:34 +02:00
parent 80fe8744f2
commit f8fe979970

View File

@@ -105,9 +105,33 @@ phase_db() {
ok "$host: DB done"
}
phase_workspace_bump() {
# Bump ac-workspace submodule SHAs from the monorepo clone so the deployment
# workspace (/var/www/ac/workspace) gets the latest code on next pull.
local host="$1"
rsh "$host" "
WS=/var/www/ac/workspace
MONOREPO=/mnt/repos/ac
[ -d \"\$WS/.git\" ] || exit 0
changed=0
for sub in \$(sudo -u nginx git -C \"\$WS\" submodule status 2>/dev/null | awk '{print \$2}'); do
local_sha=\$(git -C \"\$MONOREPO/\$sub\" rev-parse HEAD 2>/dev/null) || continue
ws_sha=\$(sudo -u nginx git -C \"\$WS/\$sub\" rev-parse HEAD 2>/dev/null) || continue
[ \"\$local_sha\" = \"\$ws_sha\" ] && continue
sudo -u nginx git -C \"\$WS/\$sub\" fetch origin 2>/dev/null || true
sudo -u nginx git -C \"\$WS/\$sub\" checkout \"\$local_sha\" 2>/dev/null || true
sudo -u nginx git -C \"\$WS\" add \"\$sub\" 2>/dev/null || true
changed=1
done
[ \"\$changed\" = '1' ] && sudo -u nginx git -C \"\$WS\" commit -m 'auto-bump submodules from monorepo' 2>/dev/null || true
sudo -u nginx git -C \"\$WS\" push origin next 2>/dev/null || true
" 2>/dev/null || true
}
phase_app() {
local host="$1"
log "$host: running app deploy..."
phase_workspace_bump "$host"
rsh "$host" "cd /mnt/repos/ac/ac-deploy/sim/cluster0 && sudo sh populate_lab_setup.sh --phase app 2>&1 | tail -10"
ok "$host: app done"
}