Attempt to deploy site

@chris has setup a server[1] and added the public half of a key pair
generated using `ssh-keygen -o -t rsa -b 4096` as per the instructions
on docs.gitlab.com[2].

The `before_script` was taken from the same instructions. I set the
two variables SSH_PRIVATE_KEY and SSH_KNOWN_HOSTS in the CI/CD
settings[3].

To see if this works I'm calling `rsync` in the `script` section of
the deploy stage, using the dry-run option, `-n`.

[1] https://git.coop/cotech/website/issues/4#note_9890
[2] https://docs.gitlab.com/ee/ci/ssh_keys/#ssh-keys-when-using-the-docker-executor
[3] https://git.coop/cotech/website/settings/ci_cd
This commit is contained in:
Chris Lowis 2018-11-13 20:19:19 +00:00
parent b8625a7e66
commit 97667077e1
1 changed files with 8 additions and 0 deletions

View File

@ -5,6 +5,13 @@ variables:
LC_ALL: C.UTF-8
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- bundle install
test:
@ -21,6 +28,7 @@ pages:
stage: deploy
script:
- bundle exec jekyll build -d public
- rsync -anv public/ cotech@webarch2.co.uk:~/sites/default/
artifacts:
paths:
- public