From 19ff1f3b8322bdbd1f19eca19b17644019a716fc Mon Sep 17 00:00:00 2001
From: Pierre Nicolas <pierre.nicolas@savoirfairelinux.com>
Date: Wed, 19 Jun 2024 11:57:21 -0400
Subject: [PATCH] build: fix jenkins

GitLab: #1693
Change-Id: I0a9839e4dd709c21a8baebd65783ad5e54c89376
---
 ci/Jenkinsfile | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile
index 287f3cdb6..26299cf80 100644
--- a/ci/Jenkinsfile
+++ b/ci/Jenkinsfile
@@ -109,7 +109,13 @@ pipeline {
                 script {
                     sh 'su jenkins -c "cd /jami-client-android && ./compile.sh --test"'
                     sh 'cd /jami-client-android/ci && ./start_emu_headless.sh'
-                    sh 'su jenkins -c "cd /jami-client-android/ci && ./jami_test.sh"'
+
+                    boolean errorOccurred = false
+                    try{
+                        sh 'su jenkins -c "cd /jami-client-android/ci && ./jami_test.sh"'
+                    } catch (Exception e) {
+                        errorOccurred = true
+                    }
 
                     // Archive tests output save it as Jenkins artifact
                     sh 'cd /jami-client-android/ci/spoon-output && zip -r ../ui-test-output.zip *'
@@ -124,6 +130,11 @@ pipeline {
                         reportFiles: 'index.html',
                         reportName: "Jami UI Test Report"
                     ])
+
+                    // Mark the build as failed if there was an error
+                    if (errorOccurred) {
+                        error("Pipeline failed due to errors in the test execution.")
+                    }
                 }
             }
         }
-- 
GitLab