X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=jenkins%2Fci-pipelines%2Fci_stage_1.groovy;h=d3c4fa1b0b5dfc8cc77d693ea984a471c1112730;hb=8cb84422834b7e5ae312a804d23842f8af923a25;hp=251d36e7cedb0101f6cb19bc3a4f8aa3d3cab3fd;hpb=83976034623fadc32551ef389928482910b3797f;p=osm%2Fdevops.git diff --git a/jenkins/ci-pipelines/ci_stage_1.groovy b/jenkins/ci-pipelines/ci_stage_1.groovy index 251d36e7..d3c4fa1b 100644 --- a/jenkins/ci-pipelines/ci_stage_1.groovy +++ b/jenkins/ci-pipelines/ci_stage_1.groovy @@ -15,6 +15,7 @@ * under the License. */ +stage_3_merge_result = '' def Get_MDG(project) { // split the project. def values = project.split('/') @@ -36,18 +37,24 @@ node("${params.NODE}") { } stage('downstream') { - // initially use stage_name as the event_type - def stage_name = GERRIT_EVENT_TYPE + // default to stage_2 (patchset) + def stage_name = "stage_2" - switch(GERRIT_EVENT_TYPE) { - case "change-merged": - stage_name = "stage_2-merge" - break + try { + switch(GERRIT_EVENT_TYPE) { + case "change-merged": + stage_name = "stage_2-merge" + break - case "patchset-created": - stage_name = "stage_2" - break + case "patchset-created": + stage_name = "stage_2" + break + } + } + catch(caughtError) { + println("No gerrit event found") } + do_stage_4 = false if (params.DO_STAGE_4) { @@ -82,11 +89,22 @@ node("${params.NODE}") { println("TEST_INSTALL = ${params.TEST_INSTALL}, downstream job: ${downstream_job_name}") - stage_2_result = build job: "${downstream_job_name}", parameters: downstream_params, propagate: true - if (stage_2_result.getResult() != 'SUCCESS') { - project = stage_2_result.getProjectName() - build = stage_2_result.getNumber() - error("${project} build ${build} failed") + stage_3_merge_result = build job: "${downstream_job_name}", parameters: downstream_params, propagate: true + if (stage_3_merge_result.getResult() != 'SUCCESS') { + project = stage_3_merge_result.getProjectName() + build = stage_3_merge_result.getNumber() + // Jayant if the build fails the below error will cause the pipeline to terminate. + // error("${project} build ${build} failed") + } + } + stage('Send Email') { + if((stage_3_merge_result.getResult() != 'SUCCESS') && (${env.JOB_NAME} == 'daily-stage_4')){ + emailext ( + subject: "[OSM-Jenkins] Job: ${env.JOB_NAME} Build: ${env.BUILD_NUMBER} Result: ${stage_3_merge_result.getResult()}", + body: """ Check console output at "${env.BUILD_URL}" """, + to: 'OSM_MDL@list.etsi.org', + recipientProviders: [culprits()] + ) } } }