Browse Source

Ensure we read the private key from secret vars to ssh into production

tags/0.3.3^2
Bèr Kessels 3 years ago
parent
commit
0ed1136767
1 changed files with 28 additions and 0 deletions
  1. 28
    0
      .gitlab-ci.yml

+ 28
- 0
.gitlab-ci.yml View File

@@ -1,6 +1,34 @@
image: ruby:2.4

before_script:
##
## Install ssh-agent if not already installed, it is required by Docker.
## (change apt-get to yum if you use an RPM-based image)
##
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'

##
## Run ssh-agent (inside the build environment)
##
- eval $(ssh-agent -s)

##
## Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
## We're using tr to fix line endings which makes ed25519 keys work
## without extra base64 encoding.
## https://gitlab.com/gitlab-examples/ssh-private-key/issues/1#note_48526556
##
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null

##
## Create the SSH directory and give it the right permissions
##
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh

##
## Build the gems
## TODO: build only deployment gems
- bundle install

deploy:

Loading…
Cancel
Save