summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVarac <varac@leap.se>2018-01-16 20:41:44 +0100
committerVarac <varac@leap.se>2018-01-16 20:46:13 +0100
commit9081524ce0744d4a5b2b0faa7de8f8e25068242c (patch)
tree02ef8fbd815587f170c6bbafd575db05128b9b77
parent01a398fd1d7cb753c4e4abdd48d23f4f75486780 (diff)
Use ssh-add to circumvent broken line endings
-rwxr-xr-xtests/platform-ci/ci-build.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/platform-ci/ci-build.sh b/tests/platform-ci/ci-build.sh
index 9bdf75fb..571ef53c 100755
--- a/tests/platform-ci/ci-build.sh
+++ b/tests/platform-ci/ci-build.sh
@@ -84,11 +84,14 @@ ssh_setup() {
SSH_PRIVATE_KEY=${!CI_SSH_SECRET_PRIVATE_KEY}
echo "Working with provider: $provider_name"
[ -z "$SSH_PRIVATE_KEY" ] && fail "${provider_name}_PROVIDER_SSH_PRIVATE_KEY is not set - please provide it as env variable."
- # Configure ssh keypair
- [ -d ~/.ssh ] || /bin/mkdir ~/.ssh
- /bin/echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
- /bin/chmod 600 ~/.ssh/id_rsa
- /bin/cp "${ROOTDIR}/provider/users/gitlab-runner-${provider_name}/gitlab-runner-${provider_name}_ssh.pub" ~/.ssh/id_rsa.pub
+ # install ssh-agent
+ which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )
+ # run ssh-agent
+ eval $(ssh-agent -s)
+ # add ssh key stored in SSH_PRIVATE_KEY variable to the agent store
+ # see https://gitlab.com/gitlab-org/gitlab-ee/issues/2940 for fixing
+ # broken line endings
+ ssh-add <(echo "$SSH_PRIVATE_KEY" | sed 's/\r$//')
}
build_from_scratch() {