@@ -14,39 +14,7 @@ detect-os
14
14
readonly git_private_token=" ${! PARAM_GIT_PRIVATE_TOKEN} "
15
15
readonly CONTAINER_NAME=" ${CIRCLE_PROJECT_REPONAME} -${CIRCLE_BUILD_NUM} "
16
16
17
- trap_exit () {
18
- local exit_status=" $? "
19
-
20
- if [ " $exit_status " -ne 0 ]; then
21
- printf ' %s\n' ' The script did not complete successfully.'
22
-
23
- printf ' %s\n' " Removing the container \" $CONTAINER_NAME \" ."
24
- docker rm -f " $CONTAINER_NAME " & > /dev/null || true
25
-
26
- exit " $exit_status "
27
- fi
28
- }
29
- trap trap_exit EXIT
30
-
31
-
32
- if [ -z " ${git_private_token} " ]
33
- then
34
- echo " GIT_PRIVATE_TOKEN unset skipping"
35
- else
36
- echo " GIT_PRIVATE_TOKEN is set configuring git credentials"
37
-
38
- docker exec " $CONTAINER_NAME " " git config --global credential.helper store"
39
- docker
exec " $CONTAINER_NAME " " git config --global --replace-all url.\" https://token:$git_private_token @github.com/\" .insteadOf ssh://[email protected] /"
40
- docker
exec " $CONTAINER_NAME " " git config --global --add url.\" https://token:$git_private_token @github.com/\" .insteadOf [email protected] "
41
- docker exec " $CONTAINER_NAME " " git config --global --add url.\" https://token:$git_private_token @github.com/\" .insteadOf \" https://github.com/\" "
42
-
43
- docker
exec " $CONTAINER_NAME " " git config --global url.\" https://ssh:$git_private_token @github.com/\" .insteadOf \" ssh://[email protected] /\" "
44
- docker
exec " $CONTAINER_NAME " " git config --global url.\" https://git:$git_private_token @github.com/\" .insteadOf \" [email protected] :\" "
45
-
17
+ if [ " $PLATFORM " = " linux" ]; then eval " $SCRIPT_GIT_CREDENTIAL_LINUX " ;
18
+ elif [ " $PLATFORM " = " macos" ]; then eval " $SCRIPT_GIT_CREDENTIAL_MACOS " ;
19
+ elif [ " $PLATFORM " = " windows" ]; then eval " $SCRIPT_GIT_CREDENTIAL_WINDOWS " ;
46
20
fi
47
-
48
- echo " ---------- git config --list -------------"
49
- docker exec " $CONTAINER_NAME " " git config --list"
50
-
51
- echo " ---------- git config --list --show-origin -------------"
52
- docker exec " $CONTAINER_NAME " " git config --list --show-origin"
0 commit comments