Commit 2559a995 authored by Jim Klimov's avatar Jim Klimov

Improve handling of Jenkinsfile failed testlog archives

Port from zproject / czmq : Jenkinsfile :
* add RETRY_NUMBER suffix to test-suite tarballs
* and set build UNSTABLE if retries were needed
parent c6bd1236
......@@ -182,15 +182,18 @@ pipeline {
dir("tmp/test-check-withDRAFT") {
deleteDir()
unstash 'built-draft'
script {
def RETRY_NUMBER = 0
retry(3) {
RETRY_NUMBER++
timeout (time: "${params.USE_TEST_TIMEOUT}".toInteger(), unit: 'MINUTES') {
script {
try {
sh 'CCACHE_BASEDIR="`pwd`" ; export CCACHE_BASEDIR; LD_LIBRARY_PATH="`pwd`/src/.libs:$LD_LIBRARY_PATH"; export LD_LIBRARY_PATH; make LD_LIBRARY_PATH="$LD_LIBRARY_PATH" check'
}
catch (Exception e) {
sh 'D="`pwd`"; B="`basename "$D"`" ; tar czf test-suite_"$B".tgz `find . -name '*.trs'` `find . -name '*.log'`'
archiveArtifacts artifacts: "**/test-suite*.tgz", allowEmpty: true
currentBuild.result = 'UNSTABLE' // Jenkins should not let the verdict "improve"
sh """D="`pwd`"; B="`basename "\$D"`" ; [ "${RETRY_NUMBER}" -gt 0 ] && T="_try-${RETRY_NUMBER}" || T="" ; tar czf "test-suite_${BUILD_TAG}_\${B}\${T}.tar.gz" `find . -name '*.trs'` `find . -name '*.log'`"""
archiveArtifacts artifacts: "**/test-suite*.tar.gz", allowEmpty: true
throw e
}
}
......@@ -211,15 +214,18 @@ pipeline {
dir("tmp/test-check-withoutDRAFT") {
deleteDir()
unstash 'built-nondraft'
script {
def RETRY_NUMBER = 0
retry(3) {
RETRY_NUMBER++
timeout (time: "${params.USE_TEST_TIMEOUT}".toInteger(), unit: 'MINUTES') {
script {
try {
sh 'CCACHE_BASEDIR="`pwd`" ; export CCACHE_BASEDIR; LD_LIBRARY_PATH="`pwd`/src/.libs:$LD_LIBRARY_PATH"; export LD_LIBRARY_PATH; make LD_LIBRARY_PATH="$LD_LIBRARY_PATH" check'
}
catch (Exception e) {
sh 'D="`pwd`"; B="`basename "$D"`" ; tar czf test-suite_"$B".tgz `find . -name '*.trs'` `find . -name '*.log'`'
archiveArtifacts artifacts: "**/test-suite*.tgz", allowEmpty: true
currentBuild.result = 'UNSTABLE' // Jenkins should not let the verdict "improve"
sh """D="`pwd`"; B="`basename "\$D"`" ; [ "${RETRY_NUMBER}" -gt 0 ] && T="_try-${RETRY_NUMBER}" || T="" ; tar czf "test-suite_${BUILD_TAG}_\${B}\${T}.tar.gz" `find . -name '*.trs'` `find . -name '*.log'`"""
archiveArtifacts artifacts: "**/test-suite*.tar.gz", allowEmpty: true
throw e
}
}
......@@ -240,15 +246,18 @@ pipeline {
dir("tmp/test-memcheck-withDRAFT") {
deleteDir()
unstash 'built-draft'
script {
def RETRY_NUMBER = 0
retry(3) {
RETRY_NUMBER++
timeout (time: "${params.USE_TEST_TIMEOUT}".toInteger(), unit: 'MINUTES') {
script {
try {
sh 'CCACHE_BASEDIR="`pwd`" ; export CCACHE_BASEDIR; LD_LIBRARY_PATH="`pwd`/src/.libs:$LD_LIBRARY_PATH"; export LD_LIBRARY_PATH; make LD_LIBRARY_PATH="$LD_LIBRARY_PATH" memcheck && exit 0 ; echo "Re-running failed ($?) memcheck with greater verbosity" >&2 ; make LD_LIBRARY_PATH="$LD_LIBRARY_PATH" VERBOSE=1 memcheck-verbose'
}
catch (Exception e) {
sh 'D="`pwd`"; B="`basename "$D"`" ; tar czf test-suite_"$B".tgz `find . -name '*.trs'` `find . -name '*.log'`'
archiveArtifacts artifacts: "**/test-suite*.tgz", allowEmpty: true
currentBuild.result = 'UNSTABLE' // Jenkins should not let the verdict "improve"
sh """D="`pwd`"; B="`basename "\$D"`" ; [ "${RETRY_NUMBER}" -gt 0 ] && T="_try-${RETRY_NUMBER}" || T="" ; tar czf "test-suite_${BUILD_TAG}_\${B}\${T}.tar.gz" `find . -name '*.trs'` `find . -name '*.log'`"""
archiveArtifacts artifacts: "**/test-suite*.tar.gz", allowEmpty: true
throw e
}
}
......@@ -269,15 +278,18 @@ pipeline {
dir("tmp/test-memcheck-withoutDRAFT") {
deleteDir()
unstash 'built-nondraft'
script {
def RETRY_NUMBER = 0
retry(3) {
RETRY_NUMBER++
timeout (time: "${params.USE_TEST_TIMEOUT}".toInteger(), unit: 'MINUTES') {
script {
try {
sh 'CCACHE_BASEDIR="`pwd`" ; export CCACHE_BASEDIR; LD_LIBRARY_PATH="`pwd`/src/.libs:$LD_LIBRARY_PATH"; export LD_LIBRARY_PATH; make LD_LIBRARY_PATH="$LD_LIBRARY_PATH" memcheck && exit 0 ; echo "Re-running failed ($?) memcheck with greater verbosity" >&2 ; make LD_LIBRARY_PATH="$LD_LIBRARY_PATH" VERBOSE=1 memcheck-verbose'
}
catch (Exception e) {
sh 'D="`pwd`"; B="`basename "$D"`" ; tar czf test-suite_"$B".tgz `find . -name '*.trs'` `find . -name '*.log'`'
archiveArtifacts artifacts: "**/test-suite*.tgz", allowEmpty: true
currentBuild.result = 'UNSTABLE' // Jenkins should not let the verdict "improve"
sh """D="`pwd`"; B="`basename "\$D"`" ; [ "${RETRY_NUMBER}" -gt 0 ] && T="_try-${RETRY_NUMBER}" || T="" ; tar czf "test-suite_${BUILD_TAG}_\${B}\${T}.tar.gz" `find . -name '*.trs'` `find . -name '*.log'`"""
archiveArtifacts artifacts: "**/test-suite*.tar.gz", allowEmpty: true
throw e
}
}
......@@ -298,15 +310,18 @@ pipeline {
dir("tmp/test-distcheck-withDRAFT") {
deleteDir()
unstash 'built-draft'
script {
def RETRY_NUMBER = 0
retry(3) {
RETRY_NUMBER++
timeout (time: "${params.USE_TEST_TIMEOUT}".toInteger(), unit: 'MINUTES') {
script {
try {
sh 'CCACHE_BASEDIR="`pwd`" ; export CCACHE_BASEDIR; LD_LIBRARY_PATH="`pwd`/src/.libs:$LD_LIBRARY_PATH"; export LD_LIBRARY_PATH; DISTCHECK_CONFIGURE_FLAGS="--enable-drafts=yes --with-docs=no" ; export DISTCHECK_CONFIGURE_FLAGS; make DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS" LD_LIBRARY_PATH="$LD_LIBRARY_PATH" distcheck'
}
catch (Exception e) {
sh 'D="`pwd`"; B="`basename "$D"`" ; tar czf test-suite_"$B".tgz `find . -name '*.trs'` `find . -name '*.log'`'
archiveArtifacts artifacts: "**/test-suite*.tgz", allowEmpty: true
currentBuild.result = 'UNSTABLE' // Jenkins should not let the verdict "improve"
sh """D="`pwd`"; B="`basename "\$D"`" ; [ "${RETRY_NUMBER}" -gt 0 ] && T="_try-${RETRY_NUMBER}" || T="" ; tar czf "test-suite_${BUILD_TAG}_\${B}\${T}.tar.gz" `find . -name '*.trs'` `find . -name '*.log'`"""
archiveArtifacts artifacts: "**/test-suite*.tar.gz", allowEmpty: true
throw e
}
}
......@@ -327,15 +342,18 @@ pipeline {
dir("tmp/test-distcheck-withoutDRAFT") {
deleteDir()
unstash 'built-nondraft'
script {
def RETRY_NUMBER = 0
retry(3) {
RETRY_NUMBER++
timeout (time: "${params.USE_TEST_TIMEOUT}".toInteger(), unit: 'MINUTES') {
script {
try {
sh 'CCACHE_BASEDIR="`pwd`" ; export CCACHE_BASEDIR; LD_LIBRARY_PATH="`pwd`/src/.libs:$LD_LIBRARY_PATH"; export LD_LIBRARY_PATH; DISTCHECK_CONFIGURE_FLAGS="--enable-drafts=no --with-docs=no" ; export DISTCHECK_CONFIGURE_FLAGS; make DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS" LD_LIBRARY_PATH="$LD_LIBRARY_PATH" distcheck'
}
catch (Exception e) {
sh 'D="`pwd`"; B="`basename "$D"`" ; tar czf test-suite_"$B".tgz `find . -name '*.trs'` `find . -name '*.log'`'
archiveArtifacts artifacts: "**/test-suite*.tgz", allowEmpty: true
currentBuild.result = 'UNSTABLE' // Jenkins should not let the verdict "improve"
sh """D="`pwd`"; B="`basename "\$D"`" ; [ "${RETRY_NUMBER}" -gt 0 ] && T="_try-${RETRY_NUMBER}" || T="" ; tar czf "test-suite_${BUILD_TAG}_\${B}\${T}.tar.gz" `find . -name '*.trs'` `find . -name '*.log'`"""
archiveArtifacts artifacts: "**/test-suite*.tar.gz", allowEmpty: true
throw e
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment