From: madavi Date: Mon, 1 Jul 2019 09:54:56 +0000 (+0530) Subject: merging 792 and send email related changes X-Git-Tag: v6.0.1~1 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=e84eb2c167a02f7531f47dee9d89587674ca72f9;p=osm%2Fdevops.git merging 792 and send email related changes Change-Id: I347dbae131bb0890513110f3edf10c04986b2dbf Signed-off-by: madavi --- diff --git a/docker/osmclient/Dockerfile b/docker/osmclient/Dockerfile index d544a6ee..0d2ec31b 100644 --- a/docker/osmclient/Dockerfile +++ b/docker/osmclient/Dockerfile @@ -7,7 +7,7 @@ RUN apt-get update && apt-get -y install curl software-properties-common RUN apt-get update && apt-get -y install python \ libcurl4-gnutls-dev libgnutls-dev iputils-ping python-pip \ python-openstackclient wget -RUN pip install python-magic pytest +RUN pip install python-magic pytest==4.6.3 ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian ARG RELEASE=ReleaseFOUR-daily diff --git a/jenkins/ci-pipelines/ci_stage_1.groovy b/jenkins/ci-pipelines/ci_stage_1.groovy index d74de591..676e51e8 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('/') @@ -88,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-dot-releasesix')){ + 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()] + ) } } } diff --git a/jenkins/ci-pipelines/ci_stage_3.groovy b/jenkins/ci-pipelines/ci_stage_3.groovy index 89e9ae8b..e6264e59 100644 --- a/jenkins/ci-pipelines/ci_stage_3.groovy +++ b/jenkins/ci-pipelines/ci_stage_3.groovy @@ -32,7 +32,7 @@ properties([ string(defaultValue: 'artifactory-osm', description: '', name: 'ARTIFACTORY_SERVER'), string(defaultValue: 'osm-stage_4', description: '', name: 'DOWNSTREAM_STAGE_NAME'), string(defaultValue: '6.0.1-rc', description: '', name: 'DOCKER_TAG'), - booleanParam(defaultValue: false, description: '', name: 'SAVE_CONTAINER_ON_FAIL'), + booleanParam(defaultValue: true, description: '', name: 'SAVE_CONTAINER_ON_FAIL'), booleanParam(defaultValue: false, description: '', name: 'SAVE_CONTAINER_ON_PASS'), booleanParam(defaultValue: true, description: '', name: 'SAVE_ARTIFACTS_ON_SMOKE_SUCCESS'), booleanParam(defaultValue: true, description: '', name: 'DO_STAGE_4'), @@ -229,7 +229,9 @@ node("${params.NODE}") { { repo_base_url = "-u ${params.REPOSITORY_BASE}" } - + if ( params.DO_STAGE_4 ) { + sh "docker stack list | grep v60 | awk '{ print \$1 }'| xargs docker stack rm" + } sh """ export PATH=$PATH:/snap/bin installers/full_install_osm.sh -y -s ${container_name} --test --nolxd --nodocker --nojuju --nohostports --nohostclient \ @@ -296,19 +298,22 @@ node("${params.NODE}") { currentBuild.result = 'FAILURE' } finally { - sh "docker stop ${http_server_name}" - sh "docker rm ${http_server_name}" + if ( params.DO_INSTALL ) { if (error) { if ( !params.SAVE_CONTAINER_ON_FAIL ) { uninstall_osm container_name + sh "docker stop ${http_server_name}" + sh "docker rm ${http_server_name}" } throw error } else { if ( !params.SAVE_CONTAINER_ON_PASS ) { uninstall_osm container_name + sh "docker stop ${http_server_name}" + sh "docker rm ${http_server_name}" } } }