1
0
mirror of git://f0xx.org/ac/ac-deploy synced 2026-07-29 05:38:25 +03:00
Files
ac-deploy/sim/cluster0/scripts/deploy-ac-workspace.sh
Anton Afanasyeu a44954e108 Ensure ac-ms-media-transcode is cloned on lab nodes during compose.
Fallback git clone when workspace submodule is missing; include repo in
deploy-ac-workspace compose submodule list.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-11 15:28:00 +02:00

47 lines
2.0 KiB
Bash
Executable File

#!/bin/sh
# Clone/update ac-workspace and core ac/* submodules (lab local disk).
set -eu
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
# shellcheck source=/dev/null
. "$ROOT/scripts/lib/common.sh"
load_cluster_env
AC_ROOT="${AC_WORKSPACE_ROOT:-/var/www/ac/workspace}"
ORIGIN="${AC_WORKSPACE_ORIGIN:-git://f0xx.org/ac/ac-workspace}"
BRANCH="${AC_GIT_BRANCH:-next}"
SUBS_CORE="${AC_SUBMODULES_CORE:-ac-platform-db ac-platform-php ac-platform-web ac-platform-edge ac-deploy ac-docs ac-scripts ac-ms-url-shortener ac-be-hub ac-ms-identity}"
SUBS_COMPOSE="${AC_SUBMODULES_COMPOSE:-ac-platform-php ac-platform-web ac-ms-identity ac-ms-rbac ac-ms-devices ac-ms-issues ac-ms-tickets ac-ms-graphs ac-ms-remote-access ac-ms-media-transcode ac-be-auth ac-be-issues ac-be-tickets ac-be-graphs ac-be-remote-access ac-be-access ac-be-builder ac-ms-build}"
mkdir -p "$(dirname "$AC_ROOT")"
git config --global --add safe.directory "$AC_ROOT" 2>/dev/null || true
git config --global --add safe.directory '*' 2>/dev/null || true
if [ -d "${AC_ROOT}/.git" ]; then
log "ac-workspace pull ${BRANCH} in ${AC_ROOT}"
git -C "$AC_ROOT" fetch origin
git -C "$AC_ROOT" checkout "$BRANCH"
git -C "$AC_ROOT" pull --ff-only origin "$BRANCH" || git -C "$AC_ROOT" reset --hard "origin/${BRANCH}"
else
log "ac-workspace clone ${ORIGIN}${AC_ROOT}"
rm -rf "$AC_ROOT"
git clone --branch "$BRANCH" "$ORIGIN" "$AC_ROOT"
fi
cd "$AC_ROOT"
log "submodule sync + init core: ${SUBS_CORE}"
git submodule sync --recursive 2>/dev/null || true
for _sub in $SUBS_CORE; do
if [ -d "${AC_ROOT}/${_sub}" ]; then
git -C "${AC_ROOT}/${_sub}" checkout -f HEAD 2>/dev/null || true
git -C "${AC_ROOT}/${_sub}" clean -fd 2>/dev/null || true
fi
done
# shellcheck disable=SC2086
git submodule update --init --depth 1 $SUBS_CORE
log "submodule init compose: ${SUBS_COMPOSE}"
# shellcheck disable=SC2086
git submodule update --init --depth 1 $SUBS_COMPOSE
chown -R nginx:nginx "$(dirname "$AC_ROOT")" 2>/dev/null || true
log "deploy-ac-workspace_ok $(host_short) $(git -C "$AC_ROOT" rev-parse --short HEAD)"