archiving pod logs in test builds
Change-Id: I3acccd3c7272aa8af3189817228a0abde3746bf4
diff --git a/Jenkinsfile-voltha-test b/Jenkinsfile-voltha-test
index e1c1f48..358ddc2 100644
--- a/Jenkinsfile-voltha-test
+++ b/Jenkinsfile-voltha-test
@@ -46,6 +46,25 @@
if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs;
mkdir RobotLogs/TestDoc || true
cp -r $WORKSPACE/voltha-system-tests/tests/Log/* $WORKSPACE/RobotLogs || true
+ export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
+ ## get default pod logs
+ for pod in \$(kubectl get pods --no-headers | awk '{print \$1}');
+ do
+ if [[ \$pod == *"onos"* && \$pod != *"onos-service"* ]]; then
+ kubectl logs \$pod onos> $WORKSPACE/\$pod.log;
+ else
+ kubectl logs \$pod> $WORKSPACE/\$pod.log;
+ fi
+ done
+ ## get voltha pod logs
+ for pod in \$(kubectl get pods --no-headers -n voltha | awk '{print \$1}');
+ do
+ if [[ \$pod == *"-api-"* ]]; then
+ kubectl logs \$pod arouter -n voltha > $WORKSPACE/\$pod.log;
+ else
+ kubectl logs \$pod -n voltha > $WORKSPACE/\$pod.log;
+ fi
+ done
"""
step([$class: 'RobotPublisher',
disableArchiveOutput: false,
@@ -56,7 +75,8 @@
passThreshold: 100,
reportFileName: 'RobotLogs/report*.html',
unstableThreshold: 0
- ])
+ ]);
+ archiveArtifacts artifacts: '*.log'
}
currentBuild.result = 'SUCCESS'
} catch (err) {