Deploy: GitHub submodule sync 2026-07-27 21:23:55

This commit is contained in:
Macbook
2026-07-27 21:23:55 +09:00
parent b461949266
commit 264954cc32
6 changed files with 77 additions and 5 deletions
+45 -1
View File
@@ -7,6 +7,9 @@
# ./git_fetch_all.sh --no-push # commit까지, push 생략
# ./git_fetch_all.sh --no-commit # fetch/merge만 (commit·push 생략)
#
# commit 시 운영 WAS/RAG 기본 주소(172.16.180.130)를 복원합니다.
# exdev 로컬 주소(127.0.0.1 / host.docker.internal)는 .env·start 스크립트로만 사용합니다.
#
# 대상 (.gitmodules) — 모두 branch=chatbot2.0-agent (main 사용 안 함):
# chatbotApi-chatbot2.0-agent
# chatbotApp-chatbot2.0-agent
@@ -40,7 +43,7 @@ for arg in "$@"; do
--no-commit) DO_COMMIT=false; DO_PUSH=false ;;
--no-push) DO_PUSH=false ;;
-h|--help)
sed -n '2,18p' "$0"
sed -n '2,22p' "$0"
exit 0
;;
*)
@@ -107,6 +110,44 @@ restore_monorepo_overlays() {
fi
}
# GitHub push 전: 로컬(exdev) WAS 주소를 커밋하지 않고 운영 기본값(172.16.180.130) 유지
PROD_WAS_API="http://172.16.180.130:8086/api"
PROD_RAG_CHAT="http://172.16.180.130:28012/agent/chat"
restore_production_endpoints_before_commit() {
local path="$1"
local dir="${ROOT_DIR}/${path}"
case "${path}" in
kakaoChatbotSkill-chatbot2.0-agent)
local yml="${dir}/src/main/resources/application.yml"
if [[ -f "${yml}" ]]; then
# ${ENV:default} 형태의 default 만 운영 IP로 고정 (실행 시 ENV 로컬 오버라이드는 유지)
perl -i -pe "s|CHATBOT_API_BASE_URL:[^}]+}|CHATBOT_API_BASE_URL:${PROD_WAS_API}/}|g" "${yml}"
perl -i -pe "s|RAG_AGENT_CHAT_URL:[^}]+}|RAG_AGENT_CHAT_URL:${PROD_RAG_CHAT}}|g" "${yml}"
# trailing slash normalize for api default
perl -i -pe "s|CHATBOT_API_BASE_URL:http://172\.16\.180\.130:8086/api/\}|CHATBOT_API_BASE_URL:http://172.16.180.130:8086/api/}|g" "${yml}"
fi
;;
exAiChatBot-chatbot2.0-agent)
if [[ -f "${dir}/env.template" ]]; then
perl -i -pe "s|^CHATBOT_API_BASE_URL=.*|CHATBOT_API_BASE_URL=${PROD_WAS_API}|" "${dir}/env.template"
fi
if [[ -f "${dir}/env.example" ]]; then
perl -i -pe "s|^CHATBOT_API_BASE_URL=.*|CHATBOT_API_BASE_URL=${PROD_WAS_API}|" "${dir}/env.example" 2>/dev/null || true
fi
if [[ -f "${dir}/scripts/agent/chatbot_tool_client.py" ]]; then
perl -i -pe 's|"http://127\.0\.0\.1:8086/api"|"http://172.16.180.130:8086/api"|g' \
"${dir}/scripts/agent/chatbot_tool_client.py"
perl -i -pe 's|"http://host\.docker\.internal:8086/api"|"http://172.16.180.130:8086/api"|g' \
"${dir}/scripts/agent/chatbot_tool_client.py"
fi
# monorepo overlay compose 는 push 대상에서 제외 (로컬 exdev 전용)
git -C "${dir}" checkout HEAD -- docker-compose.server.yml docker-compose.local.yml 2>/dev/null || true
;;
esac
}
submodule_is_cloned() {
local path="$1"
[[ -e "${ROOT_DIR}/${path}/.git" ]]
@@ -253,6 +294,9 @@ sync_one() {
# 5) 로컬 수정사항 commit
if $DO_COMMIT && repo_is_dirty; then
log " 로컬 변경 commit..."
# push 전에 운영 WAS/RAG 기본 주소 복원 (exdev 로컬 주소는 .env / start 스크립트로만 사용)
restore_production_endpoints_before_commit "${path}"
log " 운영 엔드포인트 기본값 유지: ${PROD_WAS_API}"
git add -A
if git diff --cached --quiet; then
log " staged 변경 없음 (ignore 된 파일만 있을 수 있음)"