From a867e4ebcceeb7d552623c4af84c2c7e6dbe6af8 Mon Sep 17 00:00:00 2001
From: Raphael Defosseux <raphael.defosseux@eurecom.fr>
Date: Thu, 2 Aug 2018 16:38:57 +0200
Subject: [PATCH] CI: Moving html archiving in case of error

Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
---
 ci-scripts/Jenkinsfile-tmp-ran | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/ci-scripts/Jenkinsfile-tmp-ran b/ci-scripts/Jenkinsfile-tmp-ran
index 93192dd8be..df9caac82e 100644
--- a/ci-scripts/Jenkinsfile-tmp-ran
+++ b/ci-scripts/Jenkinsfile-tmp-ran
@@ -186,11 +186,6 @@ pipeline {
                                 [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password']
                             ]) {
                                 sh "python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${testXMLFile}"
-                                if(fileExists("test_results.html")) {
-                                    sh "mv test_results.html test_results-${JOB_NAME}.html"
-                                    sh "sed -i -e 's#TEMPLATE_JOB_NAME#${JOB_NAME}#' -e 's#TEMPLATE_BUILD_ID#${BUILD_ID}#' test_results-${JOB_NAME}.html"
-                                    archiveArtifacts "test_results-${JOB_NAME}.html"
-                                }
                             }
                         } catch (Exception e) {
                             currentBuild.result = 'FAILURE'
@@ -324,6 +319,11 @@ pipeline {
                                 archiveArtifacts "enb.log.${env.BUILD_ID}.zip"
                             }
                         }
+                        if(fileExists("ci-scripts/test_results.html")) {
+                            sh "mv ci-scripts/test_results.html test_results-${JOB_NAME}.html"
+                            sh "sed -i -e 's#TEMPLATE_JOB_NAME#${JOB_NAME}#' -e 's#TEMPLATE_BUILD_ID#${BUILD_ID}#' test_results-${JOB_NAME}.html"
+                            archiveArtifacts "test_results-${JOB_NAME}.html"
+                        }
                     }
                 }
                 stage('Log Collection (SPGW)') {
-- 
GitLab