File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -31,24 +31,36 @@ git_retry () {
31
31
)
32
32
}
33
33
34
+ suppress_stderr () {
35
+ $@ 2> /dev/null
36
+ }
37
+
34
38
trap exit_trap EXIT
35
39
set -e
36
40
37
41
[ -z " $REVISION " ] && (echo " missing REVISION var" | tee /dev/stderr) && exit 1
38
42
43
+ # Condition should be based on $REPO url format, not $PRIVATE_KEY. Need to fix regex.
44
+ # SSH_CLONE=""
45
+
46
+ # echo "$REPO" | grep -Eq "^git.*?@.*?:(?:.*?\/)?.*?\/.*?\.git$" && SSH_CLONE=true
47
+ # if [ -n $SSH_CLONE ]
39
48
if [ -n " $PRIVATE_KEY " ]; then
49
+ echo " Cloning using SSH: $REPO "
50
+
51
+ [ -z " $PRIVATE_KEY " ] && (echo " missing PRIVATE_KEY var" | tee /dev/stderr) && exit 1
52
+
40
53
echo " $PRIVATE_KEY " > /root/.ssh/codefresh
41
54
chmod 700 ~ /.ssh/
42
55
chmod 600 ~ /.ssh/*
43
56
44
57
# git@github.com:username/repo.git
45
58
# match "github.com" from ssh uri
46
- echo " REPO $REPO "
47
59
SSH_HOST=$( echo " $REPO " | cut -d " :" -f 1 | cut -d " @" -f 2)
48
- echo " SSH_HOST $SSH_HOST "
49
60
50
- ssh-keygen -R $SSH_HOST
51
- ssh-keyscan -H $SSH_HOST >> ~ /.ssh/known_hosts
61
+ echo " Adding " $SSH_HOST " to known_hosts"
62
+ suppress_stderr ssh-keygen -R $SSH_HOST
63
+ suppress_stderr ssh-keyscan -H $SSH_HOST >> ~ /.ssh/known_hosts
52
64
fi
53
65
54
66
mkdir -p " $WORKING_DIRECTORY "
You can’t perform that action at this time.
0 commit comments