From fb433f7e34e30114dbdbbe044f37f51f30c6679d Mon Sep 17 00:00:00 2001
From: Florian Rhiem <f.rhiem@fz-juelich.de>
Date: Wed, 12 Jul 2017 09:14:15 +0200
Subject: [PATCH] Use ~/.ssh/jutil_key when installing JUtil during CI

---
 .gitlab-ci.yml | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ac4383f..820facd 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -6,17 +6,18 @@ before_script:
   # List installed stuff:
   - apt list --installed
   ####- pip install hyperspy tqdm cmocean nose
-  # Run ssh-agent, "-s" forces generation of Bourne shell (/bin/sh) commands on stdout:
-  - eval $(ssh-agent -s)
-  # Add SSH key for jutil to the agent store:
-  - echo "$SSH_KEY_JUTIL"
-  - ssh-add <(echo "$SSH_KEY_JUTIL")
+  # Create SSH configuration directory if necessary:
+  - mkdir -p --mode=700 ~/.ssh/
+  # Add SSH key for jutil:
+  - echo "$SSH_KEY_JUTIL" > ~/.ssh/jutil_key
+  - chmod 400 ~/.ssh/jutil_key
+  # Configure SSH to use ~/.ssh/jutil_key for iffgit.fz-juelich.de:
+  - echo -e "Host iffgit.fz-juelich.de\n\tIdentityFile ~/.ssh/jutil_key\n\n" > ~/.ssh/config
   # For Docker builds disable host key checking. Be aware that by adding that
   # you are suspectible to man-in-the-middle attacks.
   # WARNING: Use this only with the Docker executor, if you use it with shell
   # you will overwrite your user's SSH config.
-  - mkdir -p ~/.ssh
-  - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
+  - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" >> ~/.ssh/config'
   - pip install git+ssh://gitlab@iffgit.fz-juelich.de/unger/jutil.git
   - echo "Done"
 
-- 
GitLab