Parametrize usage of git global config
Since related issue is sporadic, disable usage of global
config and make it optional.
Change-Id: I5edffbdc0e845ea600a77c7714cfcf2ec1e988bc
Related-Prod: PROD-28160 (PROD:28160)
diff --git a/src/com/mirantis/mk/Git.groovy b/src/com/mirantis/mk/Git.groovy
index d20c159..1564fec 100644
--- a/src/com/mirantis/mk/Git.groovy
+++ b/src/com/mirantis/mk/Git.groovy
@@ -99,12 +99,17 @@
*
* @param path Path to the git repository
* @param message A commit message
+ * @param global Use global config
*/
-def commitGitChanges(path, message, gitEmail='jenkins@localhost', gitName='jenkins-slave') {
+def commitGitChanges(path, message, gitEmail='jenkins@localhost', gitName='jenkins-slave', global=false) {
def git_cmd
+ def global_arg = ''
+ if (global) {
+ global_arg = '--global'
+ }
dir(path) {
- sh "git config --global user.email '${gitEmail}'"
- sh "git config --global user.name '${gitName}'"
+ sh "git config ${global_arg} user.email '${gitEmail}'"
+ sh "git config ${global_arg} user.name '${gitName}'"
sh(
script: 'git add -A',