Added git merge branches pipeline + related changes in rollout and test-service pipelines
Change-Id: Id43a3a37da7876c14cfa9ee4fb40320652f74b17
diff --git a/git-merge-branches-pipeline.groovy b/git-merge-branches-pipeline.groovy
new file mode 100644
index 0000000..cff1db5
--- /dev/null
+++ b/git-merge-branches-pipeline.groovy
@@ -0,0 +1,28 @@
+/**
+ * Git merge branches pipeline
+ * REPO_URL - Repository URL
+ * TARGET_BRANCH - Target branch for merging
+ * SOURCE_BRANCH - The branch will be merged to TARGET_BRANCH
+ * CREDENTIALS_ID - Used credentails ID
+ *
+**/
+
+def common = new com.mirantis.mk.Common()
+def git = new com.mirantis.mk.Git()
+node {
+ try{
+ stage("checkout") {
+ git.checkoutGitRepository('repo', REPO_URL, TARGET_BRANCH, IMAGE_CREDENTIALS_ID)
+ }
+ stage("merge") {
+ dir("repo"){
+ sh("git fetch origin/${SOURCE_BRANCH} && git merge ${SOURCE_BRANCH} && git push origin ${TARGET_BRANCH}")
+ }
+ }
+ } catch (Throwable e) {
+ // If there was an error or exception thrown, the build failed
+ currentBuild.result = "FAILURE"
+ throw e
+ }
+}
+