Completed first version of gating pipeline.

Change-Id: Ibd43e63482f7b2b8e5d1b535c2303e69f6d00371
diff --git a/gating-pipeline.groovy b/gating-pipeline.groovy
index 481dedb..871a355 100644
--- a/gating-pipeline.groovy
+++ b/gating-pipeline.groovy
@@ -1,6 +1,7 @@
 /**
  * Gerrit gating pipeline
  * CREDENTIALS_ID - Gerrit credentails ID
+ * JOBS_NAMESPACE - Gerrit gating jobs namespace (mk, contrail, ...)
  *
 **/
 
@@ -11,17 +12,19 @@
   try{
     stage("test") {
       wrap([$class: 'AnsiColorBuildWrapper']) {
-          def testJob = String.format("test-%s-%s-latest", JOBS_NAMESPACE, GERRIT_PROJECT)
-          if(_jobExists(testJob)){
-            build job: testJob, parameters: [
-              [$class: 'StringParameterValue', name: 'GERRIT_BRANCH', value: GERRIT_BRANCH],
-              [$class: 'StringParameterValue', name: 'GERRIT_NAME', value: GERRIT_NAME],
-              [$class: 'StringParameterValue', name: 'GERRIT_HOST', value: GERRIT_HOST],
-              [$class: 'StringParameterValue', name: 'GERRIT_PORT', value: GERRIT_PORT],
-              [$class: 'StringParameterValue', name: 'GERRIT_PROJECT', value: GERRIT_PROJECT],
-              [$class: 'StringParameterValue', name: 'GERRIT_REFSPEC', value: GERRIT_REFSPEC]
-            ]
-          }
+        def testJob = String.format("test-%s-%s-latest", JOBS_NAMESPACE, GERRIT_PROJECT)
+        if (_jobExists(testJob)) {
+          common.infoMsg(String.format("Test job %s found, running", testJob))
+          build job: testJob, parameters: [
+            [$class: 'StringParameterValue', name: 'GERRIT_BRANCH', value: GERRIT_BRANCH],
+            [$class: 'StringParameterValue', name: 'GERRIT_NAME', value: GERRIT_NAME],
+            [$class: 'StringParameterValue', name: 'GERRIT_HOST', value: GERRIT_HOST],
+            [$class: 'StringParameterValue', name: 'GERRIT_PORT', value: GERRIT_PORT],
+            [$class: 'StringParameterValue', name: 'GERRIT_PROJECT', value: GERRIT_PROJECT],
+            [$class: 'StringParameterValue', name: 'GERRIT_REFSPEC', value: GERRIT_REFSPEC]
+          ]
+        } else {
+          common.infoMsg(String.format("Test job %s not found", testJob))
         }
       }
     }
@@ -29,7 +32,7 @@
       ssh.prepareSshAgentKey(CREDENTIALS_ID)
       ssh.ensureKnownHosts(GERRIT_HOST)
       ssh.agentSh(String.format("ssh -p 29418 %s@%s gerrit review --submit %s,%s", GERRIT_NAME, GERRIT_HOST, GERRIT_CHANGE_NUMBER, GERRIT_PATCHSET_NUMBER))
-      println(String.format("Gerrit review %s,%s submitted", GERRIT_CHANGE_NUMBER, GERRIT_PATCHSET_NUMBER))
+      common.infoMsg(String.format("Gerrit review %s,%s submitted", GERRIT_CHANGE_NUMBER, GERRIT_PATCHSET_NUMBER))
     }
   } catch (Throwable e) {
      // If there was an error or exception thrown, the build failed