From 3cc071a349163dd4e53434ef57e842bd56567f3f Mon Sep 17 00:00:00 2001
From: "gioacchino.vino" <gioacchino.vino@infn.it>
Date: Wed, 27 Sep 2023 09:48:35 +0200
Subject: [PATCH] Added greenbone check

---
 jenkinsfile/Jenkinsfile | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/jenkinsfile/Jenkinsfile b/jenkinsfile/Jenkinsfile
index be5492b..26b9fca 100644
--- a/jenkinsfile/Jenkinsfile
+++ b/jenkinsfile/Jenkinsfile
@@ -13,27 +13,31 @@ pipeline {
                     usernamePassword(credentialsId: "jenkins_scans_creds", usernameVariable: 'GMP_USER', passwordVariable: 'GMP_PASSWORD')
                 ]) {
                     sh '''#!/bin/bash
+                        # oidc-agent initialization
                         eval `oidc-agent-service use`
                         oidc-add infn-cloud-ops
                         
-                        env
-
                         # Orchent connection test
                         orchent depls > depls.output
-                        if cat depls.output | grep -q ERROR
+                        if grep -q ERROR depls.output
                         then 
                             echo "orchent depls: NOT ok" 
                             cat depls.output 
                             exit 1
                         else 
-                            echo "orchent depls: ok" 
+                            echo "orchent depls: OK" 
                         fi
 
-                        which gvm-cli
-
                         # Greenbone connection test
-                        /var/lib/jenkins/.local/bin/gvm-cli --gmp-username $GMP_USER --gmp-password $GMP_PASSWORD tls --hostname $HOST_IP --xml "<get_version/>"
-
+                        /var/lib/jenkins/.local/bin/gvm-cli --gmp-username $GMP_USER --gmp-password $GMP_PASSWORD    tls --hostname $HOST_IP --xml "<get_version/>" > gvm.output
+                        if grep -q OK gvm.output
+                        then 
+                            echo "gvm check: OK" 
+                        else 
+                            echo "gvm check: NOT ok" 
+                            cat gvm.output 
+                            exit 1
+                        fi
                     '''
                 }
             }
-- 
GitLab