Use sudo fallback for local source deploy

This commit is contained in:
Yera All
2026-04-04 03:07:03 +05:00
parent 271c3f1f7d
commit dcddd12c56
+12 -5
View File
@@ -224,12 +224,19 @@ deploy-production-source:
docker compose -f docker-compose.server.yml up -d --build && \
docker compose -f docker-compose.asterisk.server.yml up -d --build"
else
mkdir -p "$DEPLOY_TARGET_PATH"
rsync -av --exclude '.git/' --exclude '.tmp/' --exclude '.codex_tmp/' --exclude '.local_stack/' --exclude '.data_pg/' ./ "$DEPLOY_TARGET_PATH/"
mkdir -p "$DEPLOY_TARGET_PATH/.data_local/generated_ivr_yandex/ivr" "$DEPLOY_TARGET_PATH/.data_local/recordings" "$DEPLOY_TARGET_PATH/.asterisk_assets"
run_local() {
if command -v sudo >/dev/null 2>&1 && sudo -n true >/dev/null 2>&1; then
sudo -n "$@"
else
"$@"
fi
}
run_local mkdir -p "$DEPLOY_TARGET_PATH"
run_local rsync -av --exclude '.git/' --exclude '.tmp/' --exclude '.codex_tmp/' --exclude '.local_stack/' --exclude '.data_pg/' ./ "$DEPLOY_TARGET_PATH/"
run_local mkdir -p "$DEPLOY_TARGET_PATH/.data_local/generated_ivr_yandex/ivr" "$DEPLOY_TARGET_PATH/.data_local/recordings" "$DEPLOY_TARGET_PATH/.asterisk_assets"
cd "$DEPLOY_TARGET_PATH/deployment"
docker compose -f docker-compose.server.yml up -d --build
docker compose -f docker-compose.asterisk.server.yml up -d --build
run_local docker compose -f docker-compose.server.yml up -d --build
run_local docker compose -f docker-compose.asterisk.server.yml up -d --build
fi
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'