From 30673d504551c3bd145790457b0acab5f69a6f1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrb=C3=A1=C4=8D?= <david@hrbac.cz> Date: Wed, 2 Nov 2016 10:05:49 +0100 Subject: [PATCH] new pipeline --- .gitlab-ci.yml | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6923c8163..99501e98c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -46,19 +46,32 @@ deploy to stage: - mkdir -p ~/.ssh - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config script: - - ls site/ - - echo $CI_BUILD_REF_NAME - - ssh root@"$SSH_HOST_STAGE" uptime - - rsync -av --delete site/ root@"$SSH_HOST_STAGE":/tmp/docs/$CI_BUILD_REF_NAME/ - #- dpl --provider=s3 --bucket=$S3_BUCKET_NAME + #- ls site/ + #- echo $CI_BUILD_REF_NAME + #- ssh root@"$SSH_HOST_STAGE" uptime + - rsync -av --delete site/ root@"$SSH_HOST_STAGE":/srv/docs.it4i.cz/devel/$CI_BUILD_REF_NAME/ deploy to production: environment: production stage: deploy image: ruby:latest + before_script: + # install ssh-agent + - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' + - 'which rsync || ( apt-get update -y && apt-get install rsync -y )' + # run ssh-agent + - eval $(ssh-agent -s) + # add ssh key stored in SSH_PRIVATE_KEY variable to the agent store + - ssh-add <(echo "$SSH_PRIVATE_KEY") + # disable host key checking (NOTE: makes you susceptible to man-in-the-middle attacks) + # WARNING: use only in docker container, if you use it with shell you will overwrite your user's ssh config + - mkdir -p ~/.ssh + - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config script: - - gem install dpl - #- dpl --provider=s3 --bucket=$S3_BUCKET_NAME + #- ls site/ + #- echo $CI_BUILD_REF_NAME + #- ssh root@"$SSH_HOST_STAGE" uptime + - rsync -av --delete site/ root@"$SSH_HOST_STAGE":/srv/docs.it4i.cz/site/ only: - master when: manual -- GitLab