From 7b4a7589b3a696e3a869ffcc5bdc76afd54d95f8 Mon Sep 17 00:00:00 2001
From: Raphael Defosseux <raphael.defosseux@eurecom.fr>
Date: Tue, 30 May 2023 10:18:44 +0200
Subject: [PATCH] chore(ci): removing the RAN temporary image when done

Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
---
 ci-scripts/Jenkinsfile-GitLab-COTS-UE-Test | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/ci-scripts/Jenkinsfile-GitLab-COTS-UE-Test b/ci-scripts/Jenkinsfile-GitLab-COTS-UE-Test
index f6f2bb3e..baa9bc38 100644
--- a/ci-scripts/Jenkinsfile-GitLab-COTS-UE-Test
+++ b/ci-scripts/Jenkinsfile-GitLab-COTS-UE-Test
@@ -69,6 +69,7 @@ boolean testStart0   = true
 boolean testStart1   = true
 boolean testStop0    = true
 boolean testStop1    = true
+boolean pulledImage  = false
 
 //-------------------------------------------------------------------------------
 // Pipeline start
@@ -268,6 +269,9 @@ pipeline {
             testStart1   = false
             testStop0    = false
             testStop1    = false
+            if (pulledImage) {
+              sh "docker rmi ${ranFullImage} || true"
+            }
           }
         }
       }
@@ -341,6 +345,9 @@ pipeline {
               sh "docker-compose down -t 3 || true"
             }
             deployedGNB = false
+            if (pulledImage) {
+              sh "docker rmi ${ranFullImage} || true"
+            }
           }
         }
       }
@@ -599,6 +606,7 @@ def checkAndPullRanImage (ranFullImage) {
     if (ranFullImage.contains('porcepix')) {
       sh 'docker logout porcepix.sboai.cs.eurecom.fr'
     }
+    pulledImage  = true
   }
 }
 
-- 
GitLab