Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.70 KB | None | 0 0
  1. stages:
  2.  - deploy
  3.  
  4. deploy_staging:
  5.   stage: deploy
  6.   before_script:
  7.    - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
  8.     - eval $(ssh-agent -s)
  9.     - mkdir -p ~/.ssh
  10.     - chmod 700 ~/.ssh
  11.     - echo "$SSH_PRIVATE_KEY" | ssh-add - > ~/.ssh/id_rsa
  12.     - chmod 400 ~/.ssh/id_rsa
  13.     - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
  14.   script:
  15.   - ssh -p22 xxx@xxxx "chmod 400 ~/.ssh/id_rsa && cd xxxxxx && git pull develop"
  16.   environment:
  17.     name: staging
  18.  
  19. deploy_prod:
  20.   stage: deploy
  21.   script:
  22.    - echo "Deploy to production server"
  23.   environment:
  24.     name: production
  25.   when: manual
  26.   only:
  27.    - master
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement