Retry Jenkins CI tests up to 3 times to improve reliability (#3769)

This commit is contained in:
Philip Hyunsu Cho 2018-10-08 09:55:39 -07:00 committed by GitHub
parent ea99b53d8e
commit 7a7269e983
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 55 additions and 49 deletions

44
Jenkinsfile vendored
View File

@ -74,29 +74,31 @@ def buildPlatformCmake(buildName, conf, nodeReq, dockerTarget) {
def test_suite = conf["withGpu"] ? (conf["multiGpu"] ? "mgpu" : "gpu") : "cpu" def test_suite = conf["withGpu"] ? (conf["multiGpu"] ? "mgpu" : "gpu") : "cpu"
// Build node - this is returned result // Build node - this is returned result
node(nodeReq) { node(nodeReq) {
unstash name: 'srcs' retry(3) {
echo """ unstash name: 'srcs'
|===== XGBoost CMake build ===== echo """
| dockerTarget: ${dockerTarget} |===== XGBoost CMake build =====
| cmakeOpts : ${opts} | dockerTarget: ${dockerTarget}
|========================= | cmakeOpts : ${opts}
""".stripMargin('|') |=========================
// Invoke command inside docker """.stripMargin('|')
sh """ // Invoke command inside docker
${dockerRun} ${dockerTarget} ${dockerArgs} tests/ci_build/build_via_cmake.sh ${opts}
${dockerRun} ${dockerTarget} ${dockerArgs} tests/ci_build/test_${test_suite}.sh
"""
if (!conf["multiGpu"]) {
sh """ sh """
${dockerRun} ${dockerTarget} ${dockerArgs} bash -c "cd python-package; rm -f dist/*; python setup.py bdist_wheel --universal" ${dockerRun} ${dockerTarget} ${dockerArgs} tests/ci_build/build_via_cmake.sh ${opts}
rm -rf "${distDir}"; mkdir -p "${distDir}/py" ${dockerRun} ${dockerTarget} ${dockerArgs} tests/ci_build/test_${test_suite}.sh
cp xgboost "${distDir}"
cp -r python-package/dist "${distDir}/py"
# Test the wheel for compatibility on a barebones CPU container
${dockerRun} release ${dockerArgs} bash -c " \
pip install --user python-package/dist/xgboost-*-none-any.whl && \
python -m nose tests/python"
""" """
if (!conf["multiGpu"]) {
sh """
${dockerRun} ${dockerTarget} ${dockerArgs} bash -c "cd python-package; rm -f dist/*; python setup.py bdist_wheel --universal"
rm -rf "${distDir}"; mkdir -p "${distDir}/py"
cp xgboost "${distDir}"
cp -r python-package/dist "${distDir}/py"
# Test the wheel for compatibility on a barebones CPU container
${dockerRun} release ${dockerArgs} bash -c " \
pip install --user python-package/dist/xgboost-*-none-any.whl && \
python -m nose tests/python"
"""
}
} }
} }
} }

View File

@ -52,17 +52,19 @@ pipeline {
label 'linux && cpu && restricted' label 'linux && cpu && restricted'
} }
steps { steps {
unstash name: 'srcs' retry(3) {
script { unstash name: 'srcs'
def commit_id = "${GIT_COMMIT}" script {
def branch_name = "${GIT_LOCAL_BRANCH}" def commit_id = "${GIT_COMMIT}"
echo 'Building doc...' def branch_name = "${GIT_LOCAL_BRANCH}"
dir ('jvm-packages') { echo 'Building doc...'
sh "bash ./build_doc.sh ${commit_id}" dir ('jvm-packages') {
archiveArtifacts artifacts: "${commit_id}.tar.bz2", allowEmptyArchive: true sh "bash ./build_doc.sh ${commit_id}"
echo 'Deploying doc...' archiveArtifacts artifacts: "${commit_id}.tar.bz2", allowEmptyArchive: true
withAWS(credentials:'xgboost-doc-bucket') { echo 'Deploying doc...'
s3Upload file: "${commit_id}.tar.bz2", bucket: 'xgboost-docs', acl: 'PublicRead', path: "${branch_name}.tar.bz2" withAWS(credentials:'xgboost-doc-bucket') {
s3Upload file: "${commit_id}.tar.bz2", bucket: 'xgboost-docs', acl: 'PublicRead', path: "${branch_name}.tar.bz2"
}
} }
} }
} }
@ -95,22 +97,24 @@ def buildPlatformCmake(buildName, conf, nodeReq, dockerTarget) {
} }
// Build node - this is returned result // Build node - this is returned result
node(nodeReq) { node(nodeReq) {
unstash name: 'srcs' retry(3) {
echo """ unstash name: 'srcs'
|===== XGBoost CMake build ===== echo """
| dockerTarget: ${dockerTarget} |===== XGBoost CMake build =====
| cmakeOpts : ${opts} | dockerTarget: ${dockerTarget}
|========================= | cmakeOpts : ${opts}
""".stripMargin('|') |=========================
// Invoke command inside docker """.stripMargin('|')
sh """ // Invoke command inside docker
${dockerRun} ${dockerTarget} ${dockerArgs} tests/ci_build/build_via_cmake.sh ${opts} sh """
${dockerRun} ${dockerTarget} ${dockerArgs} bash -c "cd python-package; rm -f dist/*; python setup.py bdist_wheel --universal" ${dockerRun} ${dockerTarget} ${dockerArgs} tests/ci_build/build_via_cmake.sh ${opts}
rm -rf "${distDir}"; mkdir -p "${distDir}/py" ${dockerRun} ${dockerTarget} ${dockerArgs} bash -c "cd python-package; rm -f dist/*; python setup.py bdist_wheel --universal"
cp xgboost "${distDir}" rm -rf "${distDir}"; mkdir -p "${distDir}/py"
cp -r lib "${distDir}" cp xgboost "${distDir}"
cp -r python-package/dist "${distDir}/py" cp -r lib "${distDir}"
""" cp -r python-package/dist "${distDir}/py"
archiveArtifacts artifacts: "${distDir}/**/*.*", allowEmptyArchive: true """
archiveArtifacts artifacts: "${distDir}/**/*.*", allowEmptyArchive: true
}
} }
} }