From dcddd12c564fd615655b59be9a210e6b8274a005 Mon Sep 17 00:00:00 2001 From: Yera All Date: Sat, 4 Apr 2026 03:07:03 +0500 Subject: [PATCH] Use sudo fallback for local source deploy --- .gitlab-ci.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 486e617..7d33726 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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'