From cb75d4428bb1529c6399b547cfd9f830d231c9b9 Mon Sep 17 00:00:00 2001
From: bclayton-usgs <bclayton@usgs.gov>
Date: Tue, 19 May 2020 12:29:44 -0600
Subject: [PATCH] add ssh key

---
 .gitlab-ci.yml | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index aa0cf1bd..bfbd8bb6 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,8 +3,6 @@
 ####
 
 variables:
-  FAULT_SECTIONS: nshm-fault-sections
-  FAULT_SECTIONS_GIT: https://gitlab-ci-token:${CI_JOB_TOKEN}@code.usgs.gov/ghsc/nshmp/${FAULT_SECTIONS}.git
   JACOCO_HTML_DIR: ${REPORTS_DIR}/jacoco/test/html
   JUNIT_FILES: build/test-results/test/TEST-*.xml
   REPORTS_DIR: build/reports
@@ -20,12 +18,14 @@ stages:
 ####
 # Git clone nshm-fault-sections
 ####
-.fault-sections:
+.ssh-key:
   before_script:
-    - cd ..
-    - rm -rf ${FAULT_SECTIONS}
-    - git clone ${FAULT_SECTIONS_GIT}
-    - cd ${CI_PROJECT_NAME}
+    - eval $(ssh-agent -s)
+    - mkdir -p ~/.ssh
+    - chmod 700 ~/.ssh
+    - echo "${SSH_PRIVATE_KEY}" >> ~/.ssh/id_rsa
+    - chmod 0600 ~/.ssh/id_rsa
+    - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
 
 ####
 # GitLab runner tags
@@ -47,7 +47,7 @@ stages:
 ####
 Build Project:
   extends:
-    - .fault-sections
+    - .ssh-key
     - .gradle
     - .tags
   stage: test
@@ -115,7 +115,7 @@ Spotbugs Test:
 ####
 Unit Tests:
   extends:
-    - .fault-sections
+    - .ssh-key
     - .gradle
     - .tags
   stage: test
-- 
GitLab