diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d04c5d5387f0fa928ed1e1c7cadefb1200fdc039..3fd0f9768f5b73802ab22f0fe1def5dd93a38c4e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,17 +28,14 @@ flow: deploy: stage: deploy script: - - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' - mkdir ~/.ssh - - chmod 700 ~/.ssh - - touch ~/.ssh/known_hosts - - chmod 644 ~/.ssh/known_hosts - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts - - cat ~/.ssh/known_hosts - - ssh-add <(echo "$SSH_PRIVATE_KEY") + - touch ~/.ssh/id_rsa + - chmod 600 ~/.ssh/id_rsa # Required permission by ssh + - echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa - apt-get update - apt-get install --assume-yes rsync - - rsync -e "ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa" --archive --delete --exclude='.git' --exclude='node_modules' . app@129.241.96.153:app + - rsync --archive --delete --exclude='.git' --exclude='node_modules' . app@129.241.96.153:app - ssh app@129.241.96.153 systemctl --user restart app only: - master \ No newline at end of file