Skip to content
This repository was archived by the owner on Oct 22, 2024. It is now read-only.

Commit 500c24c

Browse files
committed
Jenkinsfile: fix logs file creation, do it always
Due to misused shell redirection, kubelet log contained the output from last worker only, and no cluster information. Save kubelet logs in all cases, means we do not need exception intercepting block any more.
1 parent 38c42b0 commit 500c24c

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Jenkinsfile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -490,15 +490,13 @@ void TestInVM(worker, distro, distroVersion, kubernetesVersion, skipIfPR) {
490490
testrun=\$(echo '${distro}-${distroVersion}-${kubernetesVersion}' | sed -e s/--*/-/g | tr . _ ) && \
491491
make test_e2e TEST_E2E_REPORT_DIR=${WORKSPACE}/build/reports.tmp/\$testrun \
492492
TEST_E2E_SKIP=\$(if [ \"${env.CHANGE_ID}\" ] && [ \"${env.CHANGE_ID}\" != null ]; then echo \\\\[Slow\\\\]@${skipIfPR}; fi) \
493-
' |tee joblog-${BUILD_TAG}-test-${kubernetesVersion}.log |egrep 'Passed|FAIL:|^ERROR' 2>&1 \
493+
' |tee joblog-${BUILD_TAG}-test-${kubernetesVersion}.log |egrep 'Passed|FAIL:|^ERROR' 2>&1\
494494
"
495-
} catch (exc) {
496-
echo "Handling exception, writing pod state and kubelet logs into joblog-${BUILD_TAG}-kubeletlogs-${kubernetesVersion}.log"
497-
sh "_work/${env.CLUSTER}/ssh.0 kubectl get pods --all-namespaces -o wide > joblog-${BUILD_TAG}-kubeletlogs-${kubernetesVersion}.log"
498-
sh "for cmd in `ls _work/${env.CLUSTER}/ssh.*`; do \$cmd sudo journalctl -u kubelet > joblog-${BUILD_TAG}-kubeletlogs-${kubernetesVersion}.log; done"
499-
// regular error handling
500-
throw exc
501495
} finally {
496+
echo "Writing cluster state and kubelet logs into files."
497+
sh "_work/${env.CLUSTER}/ssh.0 kubectl get nodes -o wide > joblog-${BUILD_TAG}-nodestate-${kubernetesVersion}.log"
498+
sh "_work/${env.CLUSTER}/ssh.0 kubectl get pods --all-namespaces -o wide > joblog-${BUILD_TAG}-podstate-${kubernetesVersion}.log"
499+
sh "for cmd in `ls _work/${env.CLUSTER}/ssh.*`; do \$cmd sudo journalctl -u kubelet >> joblog-${BUILD_TAG}-kubeletlogs-${kubernetesVersion}.log; done"
502500
// Each test run produces junit_*.xml files with testsuite name="PMEM E2E suite".
503501
// To make test names unique in the Jenkins UI, we rename that test suite per run,
504502
// mangle the <testcase name="..." classname="..."> such that

0 commit comments

Comments
 (0)