From: garciadeblas Date: Thu, 17 Dec 2020 15:16:53 +0000 (+0100) Subject: Adding timestamps to kubectl logs in stage3 X-Git-Tag: release-v9.0-start~1 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=654f2d488e063575c56e37591f6c793197c4b9c4;p=osm%2Fdevops.git Adding timestamps to kubectl logs in stage3 Change-Id: I0ac9f519dcf0dbc28aa5ca14325d3d19528ee283 Signed-off-by: garciadeblas --- diff --git a/jenkins/ci-pipelines/ci_stage_3.groovy b/jenkins/ci-pipelines/ci_stage_3.groovy index 0a7b5dc9..541213b4 100644 --- a/jenkins/ci-pipelines/ci_stage_3.groovy +++ b/jenkins/ci-pipelines/ci_stage_3.groovy @@ -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')) {