SBird1337 6 years ago
parent
commit
2e69f8783c
1 changed files with 20 additions and 0 deletions
  1. 20
    0
      .gitlab-ci.yml

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

@@ -7,6 +7,26 @@ before_script:
7 7
   ##
8 8
   - eval $(ssh-agent -s)
9 9
 
10
+  ##
11
+  ## Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
12
+  ## We're using tr to fix line endings which makes ed25519 keys work
13
+  ## without extra base64 encoding.
14
+  ## https://gitlab.com/gitlab-examples/ssh-private-key/issues/1#note_48526556
15
+  ##
16
+  - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
17
+
18
+  ##
19
+  ## Create the SSH directory and give it the right permissions
20
+  ##
21
+  - mkdir -p ~/.ssh
22
+  - chmod 700 ~/.ssh
23
+
24
+  - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
25
+  - chmod 644 ~/.ssh/known_hosts
26
+
27
+  - echo "$SSH_HOST2 > ~/.ssh/config
28
+  - chmod 644 ~/.ssh/config
29
+
10 30
 variables:
11 31
   GIT_SUBMODULE_STRATEGY: recursive
12 32