Add possibility to check system reclass

Change-Id: I306518f50cf2771901439a81ee3fc91f927703b3
diff --git a/test-salt-models-pipeline.groovy b/test-salt-models-pipeline.groovy
index 0058ef3..de4110d 100644
--- a/test-salt-models-pipeline.groovy
+++ b/test-salt-models-pipeline.groovy
@@ -3,12 +3,31 @@
 def ssh = new com.mirantis.mk.Ssh()
 def git = new com.mirantis.mk.Git()
 
+def gerritRef
+try {
+  gerritRef = GERRIT_REFSPEC
+} catch (MissingPropertyException e) {
+  gerritRef = null
+}
+
+try {
+    systemGitRef = RECLAS_SYSTEM_GIT_REF
+    systemGitUrl = RECLAS_SYSTEM_GIT_URL
+} catch (MissingPropertyException e) {
+    systemGitRef = null
+    systemGitUrl = null
+}
+
 node("python") {
   try{
     stage("checkout") {
-      gerrit.gerritPatchsetCheckout ([
+      if (gerritRef) {
+        gerrit.gerritPatchsetCheckout ([
           credentialsId : CREDENTIALS_ID
-      ])
+        ])
+      } else {
+        git.checkoutGitRepository('.', GIT_URL, "master", CREDENTIALS_ID)
+      }
 
       if (fileExists('classes/system')) {
         ssh.prepareSshAgentKey(CREDENTIALS_ID)
@@ -17,6 +36,14 @@
           ssh.ensureKnownHosts(remoteUrl)
         }
         ssh.agentSh("git submodule init; git submodule sync; git submodule update --recursive")
+
+        if (systemGitRef) {
+          common.infoMsg("Fetching alternate system reclass (${systemGitUrl} ${systemGitRef})")
+          dir('classes/system') {
+            ssh.ensureKnownHosts(RECLASS_SYSTEM_GIT_URL)
+            ssh.agentSh("git fetch ${systemGitUrl} ${systemGitRef} && git checkout FETCH_HEAD")
+          }
+        }
       }
     }
     stage("test") {