Skip to content
Snippets Groups Projects
Commit 654f2d48 authored by garciadeblas's avatar garciadeblas
Browse files

Adding timestamps to kubectl logs in stage3


Change-Id: I0ac9f519dcf0dbc28aa5ca14325d3d19528ee283
Signed-off-by: default avatargarciadeblas <gerardo.garciadeblas@telefonica.com>
parent 777f112a
No related branches found
No related tags found
No related merge requests found
......@@ -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')) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment