Changed default gerrit checkout branch, fixed gating

Change-Id: I1274b72e6d49460ab4317e1305d523834a758cf8
diff --git a/test-groovy-pipeline.groovy b/test-groovy-pipeline.groovy
index acf2a6e..71e9fc0 100644
--- a/test-groovy-pipeline.groovy
+++ b/test-groovy-pipeline.groovy
@@ -9,6 +9,13 @@
 gerrit = new com.mirantis.mk.Gerrit()
 common = new com.mirantis.mk.Common()
 
+def gerritRef
+try {
+  gerritRef = GERRIT_REFSPEC
+} catch (MissingPropertyException e) {
+  gerritRef = null
+}
+
 def defaultGitRef, defaultGitUrl
 try {
     defaultGitRef = DEFAULT_GIT_REF
@@ -28,7 +35,7 @@
               credentialsId : CREDENTIALS_ID
             ])
           } else if(defaultGitRef && defaultGitUrl) {
-              checkouted = gerrit.gerritPatchsetCheckout(defaultGitUrl, defaultGitRef, "master", CREDENTIALS_ID)
+              checkouted = gerrit.gerritPatchsetCheckout(defaultGitUrl, defaultGitRef, "HEAD", CREDENTIALS_ID)
           }
           if(!checkouted){
             common.errorMsg("Cannot checkout gerrit patchset, GERRIT_REFSPEC and DEFAULT_GIT_REF is null")
diff --git a/test-salt-formulas-pipeline.groovy b/test-salt-formulas-pipeline.groovy
index 24e5bb3..91f977b 100644
--- a/test-salt-formulas-pipeline.groovy
+++ b/test-salt-formulas-pipeline.groovy
@@ -34,7 +34,7 @@
           credentialsId : CREDENTIALS_ID
         ])
       } else if(defaultGitRef && defaultGitUrl) {
-          checkouted = gerrit.gerritPatchsetCheckout(defaultGitUrl, defaultGitRef, "master", CREDENTIALS_ID)
+          checkouted = gerrit.gerritPatchsetCheckout(defaultGitUrl, defaultGitRef, "HEAD", CREDENTIALS_ID)
       }
       if(!checkouted){
         common.errorMsg("Cannot checkout gerrit patchset, GERRIT_REFSPEC and DEFAULT_GIT_REF is null")
diff --git a/test-salt-models-pipeline.groovy b/test-salt-models-pipeline.groovy
index 1a31f88..05695b2 100644
--- a/test-salt-models-pipeline.groovy
+++ b/test-salt-models-pipeline.groovy
@@ -37,7 +37,7 @@
           credentialsId : CREDENTIALS_ID
         ])
       } else if(defaultGitRef && defaultGitUrl) {
-          checkouted = gerrit.gerritPatchsetCheckout(defaultGitUrl, defaultGitRef, "master", CREDENTIALS_ID)
+          checkouted = gerrit.gerritPatchsetCheckout(defaultGitUrl, defaultGitRef, "HEAD", CREDENTIALS_ID)
       }
       if(checkouted){
         if (fileExists('classes/system')) {