blob: 94eb55b549c3270c55caba21f75212d1fb58043e [file] [log] [blame]
Sergey Kolekonovba203982016-12-21 18:32:17 +04001package com.mirantis.mk
2
3/**
4 *
5 * Git functions
6 *
7 */
8
9/**
10 * Checkout single git repository
11 *
12 * @param path Directory to checkout repository to
13 * @param url Source Git repository URL
14 * @param branch Source Git repository branch
15 * @param credentialsId Credentials ID to use for source Git
Jakub Josef7dccebe2017-03-06 18:08:32 +010016 * @param poll Enable git polling (default true)
17 * @param timeout Set checkout timeout (default 10)
Jakub Josef61f29e62017-03-08 16:42:06 +010018 * @param depth Git depth param (default 0 means no depth)
Alexandr Lovtsove818e102019-07-29 14:45:01 +030019 * @param reference Git reference param to checkout (default empyt, i.e. no reference)
Sergey Kolekonovba203982016-12-21 18:32:17 +040020 */
Alexandr Lovtsove818e102019-07-29 14:45:01 +030021def checkoutGitRepository(path, url, branch, credentialsId = null, poll = true, timeout = 10, depth = 0, reference = ''){
Alexandr Lovtsov73786142019-09-02 17:45:12 +030022 def branch_name = reference ? 'FETCH_HEAD' : "*/${branch}"
Sergey Kolekonovba203982016-12-21 18:32:17 +040023 dir(path) {
Jakub Josef6fa8cb12017-03-06 18:20:08 +010024 checkout(
25 changelog:true,
26 poll: poll,
27 scm: [
28 $class: 'GitSCM',
Alexandr Lovtsov73786142019-09-02 17:45:12 +030029 branches: [[name: branch_name]],
Jakub Josef6fa8cb12017-03-06 18:20:08 +010030 doGenerateSubmoduleConfigurations: false,
31 extensions: [
Jakub Josef61f29e62017-03-08 16:42:06 +010032 [$class: 'CheckoutOption', timeout: timeout],
Alexandr Lovtsov73786142019-09-02 17:45:12 +030033 [$class: 'CloneOption', depth: depth, noTags: false, shallow: depth > 0, timeout: timeout]],
Jakub Josef6fa8cb12017-03-06 18:20:08 +010034 submoduleCfg: [],
Alexandr Lovtsov73786142019-09-02 17:45:12 +030035 userRemoteConfigs: [[url: url, credentialsId: credentialsId, refspec: reference]]]
Jakub Josef6fa8cb12017-03-06 18:20:08 +010036 )
Sergey Kolekonovba203982016-12-21 18:32:17 +040037 sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
38 }
39}
40
41/**
42 * Parse HEAD of current directory and return commit hash
43 */
44def getGitCommit() {
45 git_commit = sh (
46 script: 'git rev-parse HEAD',
47 returnStdout: true
48 ).trim()
49 return git_commit
50}
51
52/**
Ales Komarekfb7cbcb2017-02-24 14:02:03 +010053 * Change actual working branch of repo
54 *
55 * @param path Path to the git repository
56 * @param branch Branch desired to switch to
57 */
58def changeGitBranch(path, branch) {
59 dir(path) {
60 git_cmd = sh (
Leontii Istominb4f4ae12018-02-27 20:25:43 +010061 script: "git checkout ${branch}",
Ales Komarekfb7cbcb2017-02-24 14:02:03 +010062 returnStdout: true
63 ).trim()
64 }
65 return git_cmd
66}
67
68/**
Ales Komarekc3a8b972017-03-24 13:57:25 +010069 * Get remote URL
70 *
71 * @param name Name of remote (default any)
72 * @param type Type (fetch or push, default fetch)
73 */
74def getGitRemote(name = '', type = 'fetch') {
75 gitRemote = sh (
76 script: "git remote -v | grep '${name}' | grep ${type} | awk '{print \$2}' | head -1",
77 returnStdout: true
78 ).trim()
79 return gitRemote
80}
81
82/**
83 * Create new working branch for repo
84 *
85 * @param path Path to the git repository
86 * @param branch Branch desired to switch to
87 */
88def createGitBranch(path, branch) {
89 def git_cmd
90 dir(path) {
91 git_cmd = sh (
92 script: "git checkout -b ${branch}",
93 returnStdout: true
94 ).trim()
95 }
96 return git_cmd
97}
98
99/**
Ales Komarekfb7cbcb2017-02-24 14:02:03 +0100100 * Commit changes to the git repo
101 *
102 * @param path Path to the git repository
103 * @param message A commit message
Denis Egorenkof4c45512019-03-04 15:53:36 +0400104 * @param global Use global config
Oleksii Grudeva64e5b22019-06-11 11:21:02 +0300105 * @param amend Whether to use "--amend" in commit command
Ales Komarekfb7cbcb2017-02-24 14:02:03 +0100106 */
Oleksii Grudeva64e5b22019-06-11 11:21:02 +0300107def commitGitChanges(path, message, gitEmail='jenkins@localhost', gitName='jenkins-slave', global=false, amend=false) {
Ales Komarekc3a8b972017-03-24 13:57:25 +0100108 def git_cmd
Oleksii Grudeva64e5b22019-06-11 11:21:02 +0300109 def gitOpts
Denis Egorenkof4c45512019-03-04 15:53:36 +0400110 def global_arg = ''
111 if (global) {
112 global_arg = '--global'
113 }
Oleksii Grudeva64e5b22019-06-11 11:21:02 +0300114 if (amend) {
115 gitOpts = '--amend'
116 } else {
117 gitOpts = ''
118 }
Ales Komarekfb7cbcb2017-02-24 14:02:03 +0100119 dir(path) {
Denis Egorenkof4c45512019-03-04 15:53:36 +0400120 sh "git config ${global_arg} user.email '${gitEmail}'"
121 sh "git config ${global_arg} user.name '${gitName}'"
Tomáš Kukráldf7bebc2017-03-27 15:12:43 +0200122
Ales Komarekfb7cbcb2017-02-24 14:02:03 +0100123 sh(
124 script: 'git add -A',
125 returnStdout: true
126 ).trim()
127 git_cmd = sh(
Oleksii Grudeva64e5b22019-06-11 11:21:02 +0300128 script: "git commit ${gitOpts} -m '${message}'",
Ales Komarekfb7cbcb2017-02-24 14:02:03 +0100129 returnStdout: true
130 ).trim()
131 }
132 return git_cmd
133}
134
Ales Komarekfb7cbcb2017-02-24 14:02:03 +0100135/**
136 * Push git changes to remote repo
137 *
Ales Komarekc3a8b972017-03-24 13:57:25 +0100138 * @param path Path to the local git repository
Ales Komarekfb7cbcb2017-02-24 14:02:03 +0100139 * @param branch Branch on the remote git repository
140 * @param remote Name of the remote repository
Ales Komarekc3a8b972017-03-24 13:57:25 +0100141 * @param credentialsId Credentials with write permissions
Ales Komarekfb7cbcb2017-02-24 14:02:03 +0100142 */
Ales Komarekc3a8b972017-03-24 13:57:25 +0100143def pushGitChanges(path, branch = 'master', remote = 'origin', credentialsId = null) {
144 def ssh = new com.mirantis.mk.Ssh()
Ales Komarekfb7cbcb2017-02-24 14:02:03 +0100145 dir(path) {
Ales Komarekc3a8b972017-03-24 13:57:25 +0100146 if (credentialsId == null) {
147 sh script: "git push ${remote} ${branch}"
148 }
149 else {
150 ssh.prepareSshAgentKey(credentialsId)
151 ssh.runSshAgentCommand("git push ${remote} ${branch}")
152 }
Ales Komarekfb7cbcb2017-02-24 14:02:03 +0100153 }
Ales Komarekfb7cbcb2017-02-24 14:02:03 +0100154}
155
Ales Komarekc3a8b972017-03-24 13:57:25 +0100156
Sergey Kolekonovba203982016-12-21 18:32:17 +0400157/**
Filip Pytloun49d66302017-03-06 10:26:22 +0100158 * Mirror git repository, merge target changes (downstream) on top of source
159 * (upstream) and push target or both if pushSource is true
160 *
161 * @param sourceUrl Source git repository
162 * @param targetUrl Target git repository
Ivan Berezovskiycf269442019-07-18 16:15:26 +0400163 * @param credentialsId Credentials id to use for accessing target repositories
Filip Pytloun49d66302017-03-06 10:26:22 +0100164 * @param branches List or comma-separated string of branches to sync
165 * @param followTags Mirror tags
166 * @param pushSource Push back into source branch, resulting in 2-way sync
167 * @param pushSourceTags Push target tags into source or skip pushing tags
168 * @param gitEmail Email for creation of merge commits
169 * @param gitName Name for creation of merge commits
Sergey Kolekonovba203982016-12-21 18:32:17 +0400170 */
Ivan Berezovskiycf269442019-07-18 16:15:26 +0400171def mirrorGit(sourceUrl, targetUrl, credentialsId, branches, followTags = false, pushSource = false, pushSourceTags = false, gitEmail = 'jenkins@localhost', gitName = 'Jenkins', sourceRemote = 'origin') {
Jakub Josef668dc2b2017-06-19 16:55:26 +0200172 def common = new com.mirantis.mk.Common()
173 def ssh = new com.mirantis.mk.Ssh()
Sergey Kolekonovba203982016-12-21 18:32:17 +0400174 if (branches instanceof String) {
175 branches = branches.tokenize(',')
176 }
Ivan Berezovskiycf269442019-07-18 16:15:26 +0400177 // If both source and target repos are secured and accessible via http/https,
178 // we need to switch GIT_ASKPASS value when running git commands
179 def sourceAskPass
180 def targetAskPass
Sergey Kolekonovba203982016-12-21 18:32:17 +0400181
Ivan Berezovskiycf269442019-07-18 16:15:26 +0400182 def sshCreds = common.getCredentialsById(credentialsId, 'sshKey') // True if found
183 if (sshCreds) {
184 ssh.prepareSshAgentKey(credentialsId)
185 ssh.ensureKnownHosts(targetUrl)
186 sh "git config user.name '${gitName}'"
187 } else {
188 withCredentials([[$class : 'UsernamePasswordMultiBinding',
189 credentialsId : credentialsId,
190 passwordVariable: 'GIT_PASSWORD',
191 usernameVariable: 'GIT_USERNAME']]) {
192 sh """
193 set +x
194 git config --global credential.${targetUrl}.username \${GIT_USERNAME}
195 echo "echo \${GIT_PASSWORD}" > ${WORKSPACE}/${credentialsId}_askpass.sh
196 chmod +x ${WORKSPACE}/${credentialsId}_askpass.sh
197 git config user.name \${GIT_USERNAME}
198 """
199 sourceAskPass = env.GIT_ASKPASS ?: ''
200 targetAskPass = "${WORKSPACE}/${credentialsId}_askpass.sh"
201 }
202 }
Filip Pytloun49d66302017-03-06 10:26:22 +0100203 sh "git config user.email '${gitEmail}'"
Filip Pytloun49d66302017-03-06 10:26:22 +0100204
Jakub Josef1caa7ae2017-08-21 16:39:00 +0200205 def remoteExistence = sh(script: "git remote -v | grep ${TARGET_URL} | grep target", returnStatus: true)
Ivan Berezovskiycf269442019-07-18 16:15:26 +0400206 if(remoteExistence == 0) {
207 // silently try to remove target
208 sh(script: "git remote remove target", returnStatus: true)
Jakub Josef1caa7ae2017-08-21 16:39:00 +0200209 }
Ivan Berezovskiycf269442019-07-18 16:15:26 +0400210 sh("git remote add target ${TARGET_URL}")
211 if (sshCreds) {
212 ssh.agentSh "git remote update --prune"
213 } else {
214 env.GIT_ASKPASS = sourceAskPass
215 sh "git remote update ${sourceRemote} --prune"
216 env.GIT_ASKPASS = targetAskPass
217 sh "git remote update target --prune"
218 }
Filip Pytloun49d66302017-03-06 10:26:22 +0100219
Sergey Kolekonovba203982016-12-21 18:32:17 +0400220 for (i=0; i < branches.size; i++) {
221 branch = branches[i]
Jakub Josef668dc2b2017-06-19 16:55:26 +0200222 sh "git branch | grep ${branch} || git checkout -b ${branch}"
223 def resetResult = sh(script: "git checkout ${branch} && git reset --hard origin/${branch}", returnStatus: true)
224 if(resetResult != 0){
225 common.warningMsg("Cannot reset to origin/${branch} for perform git mirror, trying to reset from target/${branch}")
226 resetResult = sh(script: "git checkout ${branch} && git reset --hard target/${branch}", returnStatus: true)
227 if(resetResult != 0){
228 throw new Exception("Cannot reset even to target/${branch}, git mirroring failed!")
229 }
230 }
Sergey Kolekonovba203982016-12-21 18:32:17 +0400231
Sergey Kolekonovba203982016-12-21 18:32:17 +0400232 sh "git ls-tree target/${branch} && git merge --no-edit --ff target/${branch} || echo 'Target repository is empty, skipping merge'"
233 followTagsArg = followTags ? "--follow-tags" : ""
Ivan Berezovskiycf269442019-07-18 16:15:26 +0400234 if (sshCreds) {
235 ssh.agentSh "git push ${followTagsArg} target HEAD:${branch}"
236 } else {
237 sh "git push ${followTagsArg} target HEAD:${branch}"
238 }
Filip Pytloun49d66302017-03-06 10:26:22 +0100239
240 if (pushSource == true) {
241 followTagsArg = followTags && pushSourceTags ? "--follow-tags" : ""
Ivan Berezovskiycf269442019-07-18 16:15:26 +0400242 if (sshCreds) {
243 ssh.agentSh "git push ${followTagsArg} origin HEAD:${branch}"
244 } else {
245 sh "git push ${followTagsArg} origin HEAD:${branch}"
246 }
Filip Pytloun49d66302017-03-06 10:26:22 +0100247 }
248 }
Filip Pytloun49d66302017-03-06 10:26:22 +0100249 if (followTags == true) {
Ivan Berezovskiycf269442019-07-18 16:15:26 +0400250 if (sshCreds) {
251 ssh.agentSh "git push -f target --tags"
252 } else {
253 sh "git push -f target --tags"
254 }
Filip Pytloun49d66302017-03-06 10:26:22 +0100255
256 if (pushSourceTags == true) {
Ivan Berezovskiycf269442019-07-18 16:15:26 +0400257 if (sshCreds) {
258 ssh.agentSh "git push -f origin --tags"
259 } else {
260 sh "git push -f origin --tags"
261 }
Filip Pytloun49d66302017-03-06 10:26:22 +0100262 }
Sergey Kolekonovba203982016-12-21 18:32:17 +0400263 }
Jakub Josefecf8b452017-04-20 13:34:29 +0200264 sh "git remote rm target"
Ivan Berezovskiycf269442019-07-18 16:15:26 +0400265 if (!sshCreds) {
266 sh "set +x; rm -f ${targetAskPass}"
267 sh "git config --global --unset credential.${targetUrl}.username"
268 }
Sergey Kolekonovba203982016-12-21 18:32:17 +0400269}
Martin Polreich765f7ba2019-03-12 16:39:25 +0100270
271
272/**
273 * Return all branches for the defined git repository that match the matcher.
274 *
275 * @param repoUrl URL of git repository
276 * @param branchMatcher matcher to filter out the branches (If '' or '*', returns all branches without filtering)
277 * @return branchesList list of branches
278 */
279
280def getBranchesForGitRepo(repoUrl, branchMatcher = ''){
281
282 if (branchMatcher.equals("*")) {
283 branchMatcher = ''
284 }
285 branchesList = sh (
286 script: "git ls-remote --heads ${repoUrl} | cut -f2 | grep -e '${branchMatcher}' | sed 's/refs\\/heads\\///g'",
287 returnStdout: true
288 ).trim()
289 return branchesList.tokenize('\n')
Oleksii Grudeva64e5b22019-06-11 11:21:02 +0300290}
291
Mykyta Karpin82437932019-06-06 14:08:18 +0300292/**
293 * Method for preparing a tag to be SemVer 2 compatible, and can handle next cases:
294 * - length of tag splitted by dots is more than 3
295 * - first part of splitted tag starts not from digit
296 * - length of tag is lower than 3
297 *
298 * @param tag String which contains a git tag from repository
299 * @return HashMap HashMap in the form: ['version': 'x.x.x', 'extra': 'x.x.x'], extra
300 * is added only if size of original tag splitted by dots is more than 3
301 */
302
303def prepareTag(tag){
304 def parts = tag.tokenize('.')
305 def res = [:]
306 // Handle case with tags like v1.1.1
307 parts[0] = parts[0].replaceFirst("[^\\d.]", '')
308 // handle different sizes of tags - 1.1.1.1 or 1.1.1.1rc1
309 if (parts.size() > 3){
310 res['extra'] = parts[3..-1].join('.')
311 } else if (parts.size() < 3){
312 (parts.size()..2).each {
313 parts[it] = '0'
314 }
315 }
316 res['version'] = "${parts[0]}.${parts[1]}.${parts[2]}"
317 return res
318}
319
320/**
321 * Method for incrementing SemVer 2 compatible version
322 *
323 * @param version String which contains main part of SemVer2 version - '2.1.0'
324 * @return string String conaining version with Patch part of version incremented by 1
325 */
326
327def incrementVersion(version){
328 def parts = checkVersion(version)
329 return "${parts[0]}.${parts[1]}.${parts[2].toInteger() + 1}"
330}
331
332/**
333 * Method for checking whether version is compatible with Sem Ver 2
334 *
335 * @param version String which contains main part of SemVer2 version - '2.1.0'
336 * @return list With 3 strings as result of splitting version by dots
337 */
338
339def checkVersion(version) {
340 def parts = version.tokenize('.')
341 if (parts.size() != 3 || !(parts[0] ==~ /^\d+/)) {
342 error "Bad version ${version}"
343 }
344 return parts
345}
346
347/**
348 * Method for constructing SemVer2 compatible version from tag in Git repository:
349 * - if current commit matches the last tag, last tag will be returned as version
350 * - if no tag found assuming no release was done, version will be 0.0.1 with pre release metadata
351 * - if tag found - patch part of version will be incremented and pre-release metadata will be added
352 *
353 *
354 * @param repoDir String which contains path to directory with git repository
355 * @param allowNonSemVer2 Bool whether to allow working with tags which aren't compatible
356 * with Sem Ver 2 (not in form X.Y.Z). if set to true tag will be
357* converted to Sem Ver 2 version e.g tag 1.1.1.1rc1 -> version 1.1.1-1rc1
358 * @return version String
359 */
360def getVersion(repoDir, allowNonSemVer2 = false) {
361 def common = new com.mirantis.mk.Common()
362 dir(repoDir){
363 def cmd = common.shCmdStatus('git describe --tags --first-parent --abbrev=0')
364 def tag_data = [:]
365 def last_tag = cmd['stdout'].trim()
366 def commits_since_tag
367 if (cmd['status'] != 0){
368 if (cmd['stderr'].contains('fatal: No names found, cannot describe anything')){
369 common.warningMsg('No parent tag found, using initial version 0.0.0')
370 tag_data['version'] = '0.0.0'
371 commits_since_tag = sh(script: 'git rev-list --count HEAD', returnStdout: true).trim()
372 } else {
373 error("Something went wrong, cannot find git information ${cmd['stderr']}")
374 }
375 } else {
376 tag_data['version'] = last_tag
377 commits_since_tag = sh(script: "git rev-list --count ${last_tag}..HEAD", returnStdout: true).trim()
378 }
379 try {
380 checkVersion(tag_data['version'])
381 } catch (Exception e) {
382 if (allowNonSemVer2){
383 common.errorMsg(
384 """Git tag isn't compatible with SemVer2, but allowNonSemVer2 is set.
385 Trying to convert git tag to Sem Ver 2 compatible version
386 ${e.message}""")
387 tag_data = prepareTag(tag_data['version'])
388 } else {
389 error("Git tag isn't compatible with SemVer2\n${e.message}")
390 }
391 }
392 // If current commit is exact match to the first parent tag than return it
393 def pre_release_meta = []
394 if (tag_data.get('extra')){
395 pre_release_meta.add(tag_data['extra'])
396 }
397 if (common.shCmdStatus('git describe --tags --first-parent --exact-match')['status'] == 0){
398 if (pre_release_meta){
399 return "${tag_data['version']}-${pre_release_meta[0]}"
400 } else {
401 return tag_data['version']
402 }
403 }
404 // If we away from last tag for some number of commits - add additional metadata and increment version
405 pre_release_meta.add(commits_since_tag)
406 def next_version = incrementVersion(tag_data['version'])
407 def commit_sha = sh(script: 'git rev-parse --short=7 HEAD', returnStdout: true).trim()
408 return "${next_version}-${pre_release_meta.join('.')}-${commit_sha}"
409 }
410}
Mykyta Karpinf5b6c162019-08-08 14:28:15 +0300411
412
413/**
414 * Method for uploading a change request
415 *
416 * @param repo String which contains path to directory with git repository
417 * @param credentialsId Credentials id to use for accessing target repositories
418 * @param commit Id of commit which should be uploaded
419 * @param branch Name of the branch for uploading
420 * @param topic Topic of the change
421 *
422 */
423def pushForReview(repo, credentialsId, commit, branch, topic='', remote='origin') {
424 def common = new com.mirantis.mk.Common()
425 def ssh = new com.mirantis.mk.Ssh()
426 common.infoMsg("Uploading commit ${commit} to ${branch} for review...")
427
428 def pushArg = "${commit}:refs/for/${branch}"
429 def process = [:]
430 if (topic){
431 pushArg += '%topic=' + topic
432 }
433 dir(repo){
434 ssh.prepareSshAgentKey(credentialsId)
435 ssh.runSshAgentCommand("git push ${remote} ${pushArg}")
436 }
437}
438
439/**
440 * Generates a commit message with predefined or auto generate change id. If change
441 * id isn't provided, changeIdSeed and current sha of git head will be used in
442 * generation of commit change id.
443 *
444 * @param repo String which contains path to directory with git repository
445 * @param message Commit message main part
446 * @param changeId User defined change-id usually sha1 hash
447 * @param changeIdSeed Custom part of change id which can be added during change id generation
448 *
449 *
450 * @return commitMessage Multiline String with generated commit message
451 */
452def genCommitMessage(repo, message, changeId = '', changeIdSeed = ''){
453 def git = new com.mirantis.mk.Git()
454 def common = new com.mirantis.mk.Common()
455 def commitMessage
456 def id = changeId
457 def seed = changeIdSeed
458 if (!id) {
459 if (!seed){
460 seed = common.generateRandomHashString(32)
461 }
462 def head_sha
463 dir(repo){
464 head_sha = git.getGitCommit()
465 }
466 id = 'I' + sh(script: 'echo -n ' + seed + head_sha + ' | sha1sum | awk \'{print $1}\'', returnStdout: true)
467 }
468 commitMessage =
469 """${message}
470
471 |Change-Id: ${id}
472 """.stripMargin()
473
474 return commitMessage
475}
Alexandr Lovtsov4fdafd92019-09-09 17:52:16 +0200476
477/**
478 * Update (or create if cannot find) gerrit change request
479 *
480 * @param params Map of parameters to customize commit
481 * - gerritAuth A map containing information about Gerrit. Should include HOST, PORT and USER
482 * - credentialsId Jenkins credentials id for gerrit
483 * - repo Local directory with repository
484 * - comment Commit comment
485 * - change_id_seed Custom part of change id which can be added during change id generation
486 * - branch Name of the branch for uploading
487 * - topic Topic of the change
488 * - project Gerrit project to search in for gerrit change request
489 * - status Change request's status to search for
490 * - changeAuthorEmail Author's email of the change
491 * - changeAuthorName Author's name of the change
492 */
493def updateChangeRequest(Map params) {
494 def gerrit = new com.mirantis.mk.Gerrit()
495
496 def commitMessage
497 def auth = params['gerritAuth']
498 def creds = params['credentialsId']
499 def repo = params['repo']
500 def comment = params['comment']
501 def change_id_seed = params.get('change_id_seed', JOB_NAME)
502 def branch = params['branch']
503 def topic = params['topic']
504 def project = params['project']
505 def status = params.get('status', 'open')
506 def changeAuthorEmail = params['changeAuthorEmail']
507 def changeAuthorName = params['changeAuthorName']
508
509 def changeParams = ['owner': auth['USER'], 'status': status, 'project': project, 'branch': branch, 'topic': topic]
510 def gerritChange = gerrit.findGerritChange(creds, auth, changeParams)
511 def changeId
512 def commit
513 if (gerritChange) {
514 def jsonChange = readJSON text: gerritChange
515 changeId = jsonChange['id']
516 }
517 commitMessage = genCommitMessage(repo, comment, changeId, change_id_seed)
518 commitGitChanges(repo, commitMessage, changeAuthorEmail, changeAuthorName, false, false)
519 dir(repo){
520 commit = getGitCommit()
521 }
522 pushForReview(repo, creds, commit, branch, topic)
523}