Pass name and email of author/committer as env variables too
Related-To: PRODX-5658
Change-Id: I4640ab439cff56bab8163e69af37ba2ea9df9172
diff --git a/src/com/mirantis/mk/Git.groovy b/src/com/mirantis/mk/Git.groovy
index f699b3e..d724b8f 100644
--- a/src/com/mirantis/mk/Git.groovy
+++ b/src/com/mirantis/mk/Git.groovy
@@ -129,6 +129,12 @@
} else {
gitOpts = ''
}
+ def gitEnv = [
+ "GIT_AUTHOR_NAME=${gitName}",
+ "GIT_AUTHOR_EMAIL=${gitEmail}",
+ "GIT_COMMITTER_NAME=${gitName}",
+ "GIT_COMMITTER_EMAIL=${gitEmail}",
+ ]
dir(path) {
sh "git config ${global_arg} user.email '${gitEmail}'"
sh "git config ${global_arg} user.name '${gitName}'"
@@ -137,10 +143,12 @@
script: 'git add -A',
returnStdout: true
).trim()
- git_cmd = sh(
- script: "git commit ${gitOpts} -m '${message}'",
- returnStdout: true
- ).trim()
+ withEnv(gitEnv) {
+ git_cmd = sh(
+ script: "git commit ${gitOpts} -m '${message}'",
+ returnStdout: true
+ ).trim()
+ }
}
return git_cmd
}