From 4d7950b5149ecac350b8b46b7b367dcb3758843f Mon Sep 17 00:00:00 2001
From: Guillaume Pasero <guillaume.pasero@c-s.fr>
Date: Thu, 2 May 2019 17:42:30 +0200
Subject: [PATCH] CI: change git and ssh setup

---
 .gitlab-ci.yml              | 14 +++-------
 CI/prepare_superbuild.cmake | 52 -------------------------------------
 2 files changed, 3 insertions(+), 63 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f0de6bfcd8..1d7c0296a9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -19,8 +19,6 @@ variables:
   GIT_STRATEGY: "clone"
 
 before_script:
-  # make sure LFS hooks are installed
-  - git lfs install
   # Provision efficiently the local LFS cache before checkout
   - git lfs fetch origin $CI_COMMIT_SHA
   # Checkout the expected branch
@@ -83,17 +81,11 @@ ubuntu-llvm:
   stage: prepare
   before_script:
 # This override the previous before_script
+    - export GIT_LFS_SKIP_SMUDGE=1
     - git checkout $CI_COMMIT_REF_NAME
-# We are now doing the git-lfs install
-# This is done after the checkout so we avoid downloading Data
-# But we need it to upload the archive
-    - git-lfs install
-    - git config --global user.email "otbbot@orfeo-toolbox.org"
-    - git config --global user.name "otbbot"
-    - eval $(ssh-agent -s)
-    - ssh-add <(echo "$K8S_SECRET_SSH")
+    - export GIT_LFS_SKIP_SMUDGE=0
 # This is for debug, we are checking the owner of the ssh key
-    - ssh -o StrictHostKeyChecking=no -T git@gitlab.orfeo-toolbox.org
+    - ssh -T git@gitlab.orfeo-toolbox.org
   after_script:
     - echo "Nothing to do for after_script"
   artifacts:
diff --git a/CI/prepare_superbuild.cmake b/CI/prepare_superbuild.cmake
index 47eec850c1..793f58ee11 100644
--- a/CI/prepare_superbuild.cmake
+++ b/CI/prepare_superbuild.cmake
@@ -185,55 +185,6 @@ execute_process(
   )
 set ( SB_ARTIFACT_GIT "${OTB_SOURCE_DIR}/superbuild-artifact" )
 
-# setting up the repo
-# StrictHostKeyChecking so we don't have to add the host as a known key
-# -F /dev/null so the agent is not taking a default file ~/.ssh/..
-execute_process(
-  COMMAND ${GIT} "config" "core.sshCommand"
-  "ssh -o StrictHostKeyChecking=no"
-  WORKING_DIRECTORY ${SB_ARTIFACT_GIT}
-  RESULT_VARIABLE ssh_res
-  OUTPUT_VARIABLE ssh_out
-  ERROR_VARIABLE ssh_err
-  )
-
-if ( DEBUG )
-  message( "Step 1: ssh")
-  message( "ssh_res = ${ssh_res}" )
-  message( "ssh_out = ${ssh_out}" )
-  message( "ssh_err = ${ssh_err}" )
-endif()
-
-execute_process(
-  COMMAND ${GIT} "config" "user.mail" "otbbot@orfeo-toolbox.org"
-  WORKING_DIRECTORY ${SB_ARTIFACT_GIT}
-  RESULT_VARIABLE mail_res
-  OUTPUT_VARIABLE mail_out
-  ERROR_VARIABLE mail_err
-  )
-
-if ( DEBUG )
-  message( "Step 2: mail")
-  message( "mail_res = ${mail_res}" )
-  message( "mail_out = ${mail_out}" )
-  message( "mail_err = ${mail_err}" )
-endif()
-
-execute_process(
-  COMMAND ${GIT} "config" "user.name" "otbbot"
-  WORKING_DIRECTORY ${SB_ARTIFACT_GIT}
-  RESULT_VARIABLE name_res
-  OUTPUT_VARIABLE name_out
-  ERROR_VARIABLE name_err
-  )
-
-if ( DEBUG )
-  message( "Step 3: name")
-  message( "name_res = ${name_res}" )
-  message( "name_out = ${name_out}" )
-  message( "name_err = ${name_err}" )
-endif()
-
 # create a branche
 execute_process(
   COMMAND ${GIT} "checkout" "-b" "${BRANCH_NAME}"
@@ -261,9 +212,6 @@ execute_process(
   WORKING_DIRECTORY ${OTB_SOURCE_DIR}
   )
 
-
-# In a near futur it might be nice to clean up the mess we made...
-
 if ( DEBUG )
   if (EXISTS "${SB_ARTIFACT_GIT}/${SB_TAR_NAME}")
     message("Tar file exists in superbuild_artefact at: ${SB_ARTIFACT_GIT}/${SB_TAR_NAME}")
-- 
GitLab