-
-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support clone all repo by ssh protocol in testJob (#4228)
- Loading branch information
1 parent
7fc91a2
commit 46e205a
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,6 +141,15 @@ def setupEnv() { | |
} else { | ||
sh 'printenv' | ||
} | ||
if ( params.USE_GIT_SSH ) { | ||
def gitGlobalConfig = fileExists('~/.gitconfig') ? sh(script:"git config --global -l", returnStdout:true) : '' | ||
if (!gitGlobalConfig || !gitGlobalConfig.contains('[email protected]:.insteadof')) { | ||
sh "git config --global url.'[email protected]:'.insteadOf 'https://github.com/'" | ||
} | ||
if (!gitGlobalConfig.contains('[email protected]:.insteadof')) { | ||
sh "git config --global url.'[email protected]:'.insteadOf 'https://gitlab.com/'" | ||
} | ||
} | ||
} | ||
|
||
def setupParallelEnv() { | ||
|
@@ -805,6 +814,15 @@ def testBuild() { | |
sh "find /tmp -name '*core*' -print 2>/dev/null -exec rm -f {} \\; || true" | ||
} | ||
} | ||
if ( params.USE_GIT_SSH ) { | ||
def gitGlobalConfig = sh(script:"git config --global -l", returnStdout:true) | ||
if (gitGlobalConfig.contains('[email protected]:.insteadof')) { | ||
sh "git config --global --unset url.'[email protected]:'.insteadOf" | ||
} | ||
if (gitGlobalConfig.contains('[email protected]:.insteadof')) { | ||
sh "git config --global --unset url.'[email protected]:'.insteadOf" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters