diff --git a/.asterisk_assets/ivr/demo-language-kz.wav b/.asterisk_assets/ivr/demo-language-kz.wav new file mode 100644 index 0000000..3805e46 Binary files /dev/null and b/.asterisk_assets/ivr/demo-language-kz.wav differ diff --git a/.asterisk_assets/ivr/demo-language-ru.wav b/.asterisk_assets/ivr/demo-language-ru.wav new file mode 100644 index 0000000..b978be6 Binary files /dev/null and b/.asterisk_assets/ivr/demo-language-ru.wav differ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a601d2c..0edf0a1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -173,7 +173,15 @@ deploy-production: - rsync -av deployment/ "$DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/deployment/" - | ssh "$DEPLOY_USER@$DEPLOY_HOST" \ - "mkdir -p '$DEPLOY_PATH/.data_local/generated_ivr_yandex/ivr' '$DEPLOY_PATH/.data_local/recordings' '$DEPLOY_PATH/.asterisk_assets'" + "mkdir -p '$DEPLOY_PATH/.data_local/generated_ivr_yandex/ivr' '$DEPLOY_PATH/.data_local/recordings' '$DEPLOY_PATH/.asterisk_assets/ivr'" + - | + if [ -d .asterisk_assets/ ]; then + rsync -av .asterisk_assets/ "$DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/.asterisk_assets/" + fi + - | + if [ -d .asterisk_assets/ivr/ ]; then + rsync -av --delete .asterisk_assets/ivr/ "$DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/.data_local/generated_ivr_yandex/ivr/" + fi - | ssh "$DEPLOY_USER@$DEPLOY_HOST" \ "printf 'APP_IMAGE=%s\nASTERISK_IMAGE=%s\n' '$APP_IMAGE' '$ASTERISK_IMAGE' > '$DEPLOY_PATH/deployment/.env.images'" diff --git a/scripts/deploy_gitlab.sh b/scripts/deploy_gitlab.sh index ed1235c..47b6878 100755 --- a/scripts/deploy_gitlab.sh +++ b/scripts/deploy_gitlab.sh @@ -102,6 +102,13 @@ if [[ ! -f "$DEPLOY_DIR/.env.production" ]]; then fi install -d "$DEPLOY_DIR/.data_local" +install -d "$DEPLOY_DIR/.data_local/generated_ivr_yandex/ivr" + +if [[ -d "$DEPLOY_DIR/.asterisk_assets/ivr" ]]; then + rsync -a --delete \ + "$DEPLOY_DIR/.asterisk_assets/ivr/" \ + "$DEPLOY_DIR/.data_local/generated_ivr_yandex/ivr/" +fi export CALL_CENTER_IMAGE="${APP_IMAGE_NAME}:${APP_IMAGE_TAG}" export COMPOSE_PROJECT_NAME="${COMPOSE_PROJECT_NAME:-call-center}" diff --git a/tests/test_deploy_ivr_assets.py b/tests/test_deploy_ivr_assets.py new file mode 100644 index 0000000..fb64b10 --- /dev/null +++ b/tests/test_deploy_ivr_assets.py @@ -0,0 +1,19 @@ +from pathlib import Path + + +def test_source_deploy_syncs_versioned_ivr_assets_into_runtime_data_dir(): + root = Path(__file__).resolve().parents[1] + script = (root / "scripts" / "deploy_gitlab.sh").read_text(encoding="utf-8") + + assert '.data_local/generated_ivr_yandex/ivr' in script + assert '.asterisk_assets/ivr' in script + assert 'rsync -a --delete \\' in script + + +def test_registry_deploy_syncs_asterisk_assets_and_ivr_wavs(): + root = Path(__file__).resolve().parents[1] + ci = (root / ".gitlab-ci.yml").read_text(encoding="utf-8") + + assert "$DEPLOY_PATH/.asterisk_assets/ivr" in ci + assert ".asterisk_assets/ivr/" in ci + assert "$DEPLOY_PATH/.data_local/generated_ivr_yandex/ivr/" in ci