Add gitRef parameter to checkoutReleaseMetadataRepo() function
It should allow to checkout specific git reference instead of just branch
Change-Id: I89de1626a29b2713952e84175e393c2748692472
Related-Prod: PROD-31595
diff --git a/src/com/mirantis/mk/ReleaseWorkflow.groovy b/src/com/mirantis/mk/ReleaseWorkflow.groovy
index efc588b..7da212d 100644
--- a/src/com/mirantis/mk/ReleaseWorkflow.groovy
+++ b/src/com/mirantis/mk/ReleaseWorkflow.groovy
@@ -15,18 +15,19 @@
String gitCredentialsId = params.get('metadataCredentialsId', 'mcp-ci-gerrit')
String gitUrl = params.get('metadataGitRepoUrl', "ssh://${gitCredentialsId}@gerrit.mcp.mirantis.net:29418/mcp/release-metadata")
String gitBranch = params.get('metadataGitRepoBranch', 'master')
+ String gitRef = params.get('metadataGitRepoRef', '')
String repoDir = params.get('repoDir', 'release-metadata')
- if (cloneRepo){
+ if (cloneRepo) {
stage('Cleanup repo dir') {
dir(repoDir) {
deleteDir()
}
}
stage('Cloning release-metadata repository') {
- git.checkoutGitRepository(repoDir, gitUrl, gitBranch, gitCredentialsId, true, 10, 0)
+ git.checkoutGitRepository(repoDir, gitUrl, gitBranch, gitCredentialsId, true, 10, 0, gitRef)
}
} else {
- git.changeGitBranch(repoDir, gitBranch)
+ git.changeGitBranch(repoDir, gitRef ?: gitBranch)
}
}
@@ -154,4 +155,4 @@
//post change
gerrit.postGerritReview(credentialsID, venvDir, repoDir, changeAuthorName, changeAuthorEmail, gitRemote, crTopic, metadataGerritBranch)
}
-}
\ No newline at end of file
+}