Completed gating pipeline, fixed aborting job pipeline
Change-Id: Idf2e14c73294760788f8005781971483ead9ef45
diff --git a/gating-pipeline.groovy b/gating-pipeline.groovy
index dad56ee..73ef7d6 100644
--- a/gating-pipeline.groovy
+++ b/gating-pipeline.groovy
@@ -11,21 +11,32 @@
node("python") {
try{
stage("test") {
- wrap([$class: 'AnsiColorBuildWrapper']) {
- 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))
+ if (!SKIP_TEST.equals("true")){
+ wrap([$class: 'AnsiColorBuildWrapper']) {
+ def gerritProjectArray = GERRIT_PROJECT.tokenize("/")
+ def gerritProject = gerritProjectArray[gerritProjectArray.size() - 1]
+ def jobsNamespace = JOBS_NAMESPACE
+ // remove plural s on the end of job namespace
+ if (JOBS_NAMESPACE[JOBS_NAMESPACE.length() - 1].equals("s")){
+ jobsNamespace = JOBS_NAMESPACE.substring(0, JOBS_NAMESPACE.length() - 1)
+ }
+ def testJob = "test-${jobsNamespace}-${gerritProject}"
+ if (_jobExists(testJob)) {
+ common.infoMsg("Test job ${testJob} found, running")
+ 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("Test job ${testJob} not found")
+ }
}
+ } else {
+ common.infoMsg("Test job skipped")
}
}
stage("submit review"){