merging 792 and send email related changes 32/7732/1
authormadavi <jm00553988@techmahindra.com>
Mon, 1 Jul 2019 09:54:56 +0000 (15:24 +0530)
committermadavi <jm00553988@techmahindra.com>
Mon, 1 Jul 2019 09:54:56 +0000 (15:24 +0530)
Change-Id: I347dbae131bb0890513110f3edf10c04986b2dbf
Signed-off-by: madavi <jm00553988@techmahindra.com>
docker/osmclient/Dockerfile
jenkins/ci-pipelines/ci_stage_1.groovy
jenkins/ci-pipelines/ci_stage_3.groovy

index d544a6e..0d2ec31 100644 (file)
@@ -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
index d74de59..676e51e 100644 (file)
@@ -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()]
+            )
         }
     }
 }
index 89e9ae8..e6264e5 100644 (file)
@@ -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}"
                     }
                 }
             }