Advertisement
kastielspb

.gitlab-ci.yaml

Apr 6th, 2020
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.01 KB | None | 0 0
  1. image: python:3.7
  2.  
  3. stages:
  4.  - deploy
  5.  
  6. # Needs to set vars:
  7. # - DEPLOY_PROJECT_ALIAS
  8.  
  9. # - DEV_IP
  10. # - DEV_SSH_KEY
  11. #    OR
  12. # - PROD_IP
  13. # - PROD_SSH_KEY
  14.  
  15. variables:
  16.   SSH_PATH: /builds/${CI_PROJECT_PATH}/.ssh/
  17.   DEPLOY_KEY: ${SSH_PATH%/}/ssh_rsa
  18.  
  19. before_script:
  20.  - mkdir -p "${SSH_PATH}"
  21.   - chmod 700 "${SSH_PATH}"
  22.  
  23.   - apt-get update
  24.   - apt-get install -y python-pip git
  25.   - pip install --upgrade pip
  26.   - pip install -U fabric3 jinja2
  27.  
  28.   - touch server/.env
  29.   - echo 'from .default import *' > server/app/settings/local.py
  30.  
  31. update_test:
  32.   stage: deploy
  33.   script:
  34.    - echo -e "$DEV_SSH_KEY" > "${DEPLOY_KEY}"
  35.     - chmod 600 "${DEPLOY_KEY}"
  36.  
  37.     - export DEPLOY_IP="${DEV_IP}"
  38.     - cd server/app/deploy && fab update_project
  39.   only:
  40.    - test_vps
  41.  
  42. update_prod:
  43.   stage: deploy
  44.   script:
  45.    - echo -e "$PROD_SSH_KEY" > "${DEPLOY_KEY}"
  46.     - chmod 600 "${DEPLOY_KEY}"
  47.  
  48.     - export DEPLOY_IP="${PROD_IP}"
  49.     - cd server/app/deploy && fab update_project
  50.   only:
  51.    - master
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement