Adding timestamps to kubectl logs in stage3 34/10134/2
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 17 Dec 2020 15:16:53 +0000 (16:16 +0100)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 17 Dec 2020 16:20:37 +0000 (17:20 +0100)
Change-Id: I0ac9f519dcf0dbc28aa5ca14325d3d19528ee283
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
jenkins/ci-pipelines/ci_stage_3.groovy

index 0a7b5dc..541213b 100644 (file)
@@ -120,20 +120,20 @@ def archive_logs(remote) {
             for container in `kubectl get pods -n osm | grep -v operator | grep -v NAME| awk '{print $1}'`; do
                 logfile=`echo $container | cut -d- -f1`
                 echo "Extracting log for $logfile"
-                kubectl logs -n osm $container 2>&1 > logs/$logfile.log
+                kubectl logs -n osm $container --timestamps=true 2>&1 > logs/$logfile.log
             done
         '''
     } else {
         sshCommand remote: remote, command: '''
             for deployment in `kubectl -n osm get deployments | grep -v operator | grep -v NAME| awk '{print $1}'`; do
                 echo "Extracting log for $deployment"
-                kubectl -n osm logs deployments/$deployment --all-containers 2>&1 > logs/$deployment.log
+                kubectl -n osm logs deployments/$deployment --timestamps=true --all-containers 2>&1 > logs/$deployment.log
             done
         '''
         sshCommand remote: remote, command: '''
             for statefulset in `kubectl -n osm get statefulsets | grep -v operator | grep -v NAME| awk '{print $1}'`; do
                 echo "Extracting log for $statefulset"
-                kubectl -n osm logs statefulsets/$statefulset --all-containers 2>&1 > logs/$statefulset.log
+                kubectl -n osm logs statefulsets/$statefulset --timestamps=true --all-containers 2>&1 > logs/$statefulset.log
             done
         '''
     }
@@ -486,7 +486,7 @@ EOF"""
                         }
                     }
                 } finally {
-                    stage("Archive Contailer Logs") {
+                    stage("Archive Container Logs") {
                         // Archive logs to containers_logs.txt
                         archive_logs(remote)
                         if ( ! currentBuild.result.equals('UNSTABLE') && ! currentBuild.result.equals('FAILURE')) {