Answer the question
In order to leave comments, you need to log in
.gitlab-ci.yml and trouble with it .?
Hello.
I got tired of trying to adequately configure .gitlab-ci.yml (I googled everything I could)
I configured SSH keys, I did everything, I configured everything and it remains to configure this file.
You need to delete all files from /home/webserver and upload new ones there during the deployment process ( CI / CD)
How many tried to configure - fails
Answer the question
In order to leave comments, you need to log in
Let's say your runner is set to default. In this case, building in docker containers is used. About other executors here: https://docs.gitlab.com/runner/#selecting-the-executor
stages:
- deploy
deploy_master:
image: alpine
stage: deploy
script:
- apk update && apk upgrade
- apk add openssh bash rsync
- echo "====== Deploy to production server ======"
- echo "====== Add target servers secret key ======"
- mkdir ~/.ssh
- echo $TARGET_SERVER_SECRET_KEY > ~/.ssh/id_rsa
- chmod 700 ~/.ssh && chmod 600 ~/.ssh/*
- echo "====== Test ssh connection ======"
- ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -T "[email protected]_server"
- echo "====== Sync local and remote directory ======"
- rsync -av -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --delete ./ "[email protected]_server:/home/webserver/"
only:
- master
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question