From 5d28512fe48de4724bbb23239396133a4d6cf208 Mon Sep 17 00:00:00 2001
From: Martin Hierholzer <martin.hierholzer@desy.de>
Date: Mon, 18 Feb 2019 12:57:34 +0100
Subject: [PATCH] checkout scm before updating project template

---
 vars/buildTestDeploy.groovy | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/vars/buildTestDeploy.groovy b/vars/buildTestDeploy.groovy
index 6d31e5c..125e0e3 100644
--- a/vars/buildTestDeploy.groovy
+++ b/vars/buildTestDeploy.groovy
@@ -65,7 +65,13 @@ def call(ArrayList<String> dependencyList, String gitUrl='') {
         steps {
           script {
             node('Docker') {
+              if (env.BRANCH_NAME && env.BRANCH_NAME != '') {
+                git branch: env.BRANCH_NAME, url: gitUrl
+              } else {
+                git gitUrl
+              }
               sh """
+                git config credential.helper store
                 git remote add project-template "https://github.com/ChimeraTK/project-template" || true
                 git remote update
                 git merge --no-edit project-template/master && git push origin master || true
-- 
GitLab