Skip to content

Commit 7f6e235

Browse files
SAAS-6392 Add USE_SSH env
1 parent fad1605 commit 7f6e235

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM alpine:3.10.3
22

3-
RUN apk add --no-cache git bash openssh
3+
RUN apk add --no-cache git~=2.22 bash openssh
44

55
# install git-lfs
66
RUN apk add --no-cache --virtual deps openssl && \

start.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,8 @@ set -e
4040

4141
[ -z "$REVISION" ] && (echo "missing REVISION var" | tee /dev/stderr) && exit 1
4242

43-
# Condition should be based on $REPO url format, not $PRIVATE_KEY. Need to fix regex.
44-
# SSH_CLONE=""
4543

46-
# echo "$REPO" | grep -Eq "^git.*?@.*?:(?:.*?\/)?.*?\/.*?\.git$" && SSH_CLONE=true
47-
# if [ -n $SSH_CLONE ]
48-
if [ -n "$PRIVATE_KEY" ]; then
44+
if [ "$USE_SSH" = "true" ]; then
4945
echo "Cloning using SSH: $REPO"
5046

5147
[ -z "$PRIVATE_KEY" ] && (echo "missing PRIVATE_KEY var" | tee /dev/stderr) && exit 1
@@ -54,8 +50,9 @@ if [ -n "$PRIVATE_KEY" ]; then
5450
chmod 700 ~/.ssh/
5551
chmod 600 ~/.ssh/*
5652

57-
# git@github.com:username/repo.git
53+
# ssh://git@github.com:username/repo.git
5854
# match "github.com" from ssh uri
55+
REPO=${REPO#"ssh://"}
5956
SSH_HOST=$(echo "$REPO" | cut -d ":" -f 1 | cut -d "@" -f 2)
6057

6158
echo "Adding "$SSH_HOST" to known_hosts"

0 commit comments

Comments
 (0)