Fix server deploy: rsync submodules, local chatbotApp build, deploy flow.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+16
-5
@@ -13,6 +13,9 @@
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# bare repo 배포 시 상위에서 GIT_DIR 이 export 되면 submodule git 이 깨짐
|
||||
MONOREPO_GIT_DIR="${MONOREPO_GIT_DIR:-${GIT_DIR:-}}"
|
||||
unset GIT_DIR GIT_WORK_TREE
|
||||
INIT=false
|
||||
DRY_RUN=false
|
||||
|
||||
@@ -56,8 +59,8 @@ if $INIT && ! $DRY_RUN; then
|
||||
fi
|
||||
|
||||
resolve_monorepo_git_dir() {
|
||||
if [[ -n "${GIT_DIR:-}" && -d "${GIT_DIR}" ]]; then
|
||||
echo "${GIT_DIR}"
|
||||
if [[ -n "${MONOREPO_GIT_DIR}" && -d "${MONOREPO_GIT_DIR}" ]]; then
|
||||
echo "${MONOREPO_GIT_DIR}"
|
||||
elif git -C "${ROOT_DIR}" rev-parse --git-dir >/dev/null 2>&1; then
|
||||
git -C "${ROOT_DIR}" rev-parse --git-dir
|
||||
fi
|
||||
@@ -79,7 +82,10 @@ clone_submodule_repo() {
|
||||
sha="$(submodule_pinned_sha "${path}" || true)"
|
||||
log " clone ${url} → ${path} (branch=${branch})"
|
||||
rm -rf "${target}"
|
||||
git clone --branch "${branch}" --single-branch "${url}" "${target}"
|
||||
if ! git clone --branch "${branch}" --single-branch "${url}" "${target}"; then
|
||||
warn "${path} — clone 실패 (서버 GitHub 미접속 시 sync-submodules-rsync.sh 사용)"
|
||||
return 1
|
||||
fi
|
||||
if [[ -n "${sha}" ]]; then
|
||||
git -C "${target}" checkout "${sha}" 2>/dev/null || true
|
||||
fi
|
||||
@@ -98,6 +104,11 @@ restore_monorepo_overlays() {
|
||||
fi
|
||||
}
|
||||
|
||||
submodule_is_cloned() {
|
||||
local path="$1"
|
||||
[[ -e "${ROOT_DIR}/${path}/.git" ]]
|
||||
}
|
||||
|
||||
fetch_one() {
|
||||
local path="$1"
|
||||
local url branch old new dirty
|
||||
@@ -109,13 +120,13 @@ fetch_one() {
|
||||
log ">>> ${path}"
|
||||
log " url=${url} branch=${branch}"
|
||||
|
||||
if ! git -C "${ROOT_DIR}/${path}" rev-parse --git-dir >/dev/null 2>&1; then
|
||||
if ! submodule_is_cloned "${path}"; then
|
||||
if $DRY_RUN; then
|
||||
log " [dry-run] submodule clone 필요 — ./git_fetch_all.sh --init"
|
||||
return 0
|
||||
fi
|
||||
if $INIT; then
|
||||
clone_submodule_repo "${path}" "${url}" "${branch}"
|
||||
clone_submodule_repo "${path}" "${url}" "${branch}" || return 1
|
||||
else
|
||||
warn "${path} — submodule 미초기화. --init 옵션 사용"
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user