Slack notification for reclass test
Change-Id: I676dda164e96908a2b70a751e4e8ed8efe5cf40b
diff --git a/test-system-reclass-pipeline.groovy b/test-system-reclass-pipeline.groovy
index 7925819..559b891 100644
--- a/test-system-reclass-pipeline.groovy
+++ b/test-system-reclass-pipeline.groovy
@@ -1,15 +1,40 @@
-def branches = [:]
-def testModels = TEST_MODELS.split(',')
+def gerrit = new com.mirantis.mk.Gerrit()
-stage("Test") {
- for (int i = 0; i < testModels.size(); i++) {
- def cluster = testModels[i]
- branches["${cluster}"] = {
- build job: "test-salt-model-${cluster}", parameters: [
- [$class: 'StringParameterValue', name: 'RECLASS_SYSTEM_GIT_URL', value: "${GERRIT_SCHEME}://${GERRIT_NAME}@${GERRIT_HOST}:${GERRIT_PORT}/${GERRIT_PROJECT}.git"],
- [$class: 'StringParameterValue', name: 'RECLASS_SYSTEM_GIT_REF', value: GERRIT_REFSPEC]
- ]
+def gerritCredentials
+try {
+ gerritCredentials = CREDENTIALS_ID
+} catch (MissingPropertyException e) {
+ gerritCredentials = "gerrit"
+}
+
+try {
+ stage("Checkout") {
+ node() {
+ gerrit.gerritPatchsetCheckout ([
+ credentialsId : gerritCredentials
+ ])
}
}
- parallel branches
+
+ stage("Test") {
+ def branches = [:]
+ def testModels = TEST_MODELS.split(',')
+
+ for (int i = 0; i < testModels.size(); i++) {
+ def cluster = testModels[i]
+ branches["${cluster}"] = {
+ build job: "test-salt-model-${cluster}", parameters: [
+ [$class: 'StringParameterValue', name: 'RECLASS_SYSTEM_GIT_URL', value: "${GERRIT_SCHEME}://${GERRIT_NAME}@${GERRIT_HOST}:${GERRIT_PORT}/${GERRIT_PROJECT}.git"],
+ [$class: 'StringParameterValue', name: 'RECLASS_SYSTEM_GIT_REF', value: GERRIT_REFSPEC]
+ ]
+ }
+ }
+ parallel branches
+ }
+} catch (Throwable e) {
+ // If there was an error or exception thrown, the build failed
+ currentBuild.result = "FAILURE"
+ throw e
+} finally {
+ common.sendNotification(currentBuild.result,"",["slack"])
}