I am starting to get into GitLab CI for my company. We have a PrestaShop, and I want automatic deployment to the web server after a Git push.
Unit testing will come later. At the moment I just need it to deal with putting a copy of the "/app" folder in the web root of the web server.
So this is what I have got...
before_script:
- apt-get update -qq
- apt-get install -qq git
- 'which ssh-agent || ( apt-get install -qq openssh-client )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
deploy_test:
type: deploy
environment:
name: test
url: [test server domain]
script:
- ssh [user]@[server] -p [port] "cd [repo folder] && git checkout master && git pull origin master && exit"
- ssh [user]@[server] -p [port] "rsync -rzvh [repo /app folder] [web server root path]"
only:
- master
Recently, gitlab-runner has started failing with the error Error loading key "/dev/fd/63": invalid format
.
Can you help me to solve that error?
FYI, I have my personal private key set as $SSH_PRIVATE_KEY environment var in GitLab - the public on the web server of course. SSH is enabled on the web server which has WHM and cPanel. And I pre-checked out a copy of master via cPanel on the web server into the [repo folder].