dataloft_test/.gitlab-ci.yml
2026-04-05 18:17:09 +07:00

27 lines
830 B
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

stages:
- deploy
# Деплой на self-hosted runner с тегом docker (см. Ansible: gitlab-runner).
deploy_production:
stage: deploy
image: alpine:3.19
tags:
- docker
variables:
GIT_STRATEGY: none
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
before_script:
- apk add --no-cache openssh-client bash
- eval $(ssh-agent -s)
- echo "$CI_DEPLOY_SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
- ssh-keyscan -H "$DEPLOY_HOST" >> ~/.ssh/known_hosts 2>/dev/null || true
script:
- |
ssh "${DEPLOY_USER}@${DEPLOY_HOST}" "set -e
cd '${DEPLOY_PATH}'
git fetch origin
git reset --hard 'origin/${CI_DEFAULT_BRANCH}'
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d --build --remove-orphans"