Jenkins: Cache allure history between job runs

This commit is contained in:
Tobias Gruetzmacher 2020-11-28 00:37:05 +01:00
parent 0ac2f560a4
commit 0ea45ce986
2 changed files with 13 additions and 2 deletions

8
Jenkinsfile vendored
View file

@ -125,7 +125,13 @@ def processAllure() {
node { node {
deleteDir() deleteDir()
unstash 'allure' unstash 'allure'
sh 'docker run --rm -v $PWD:/work -u $(id -u) tobix/allure-cli generate allure-*' sh 'mv allure-* allure-data'
copyArtifacts filter: 'allure-history.zip', optional: true, projectName: JOB_NAME
if (fileExists('allure-history.zip')) {
unzip dir: 'allure-data', quiet: true, zipFile: 'allure-history.zip'
sh 'rm -f allure-history.zip'
}
sh 'docker run --rm -v $PWD:/work -u $(id -u) tobix/allure-cli generate allure-data'
zip archive: true, dir: 'allure-report', glob: 'history/**', zipFile: 'allure-history.zip' zip archive: true, dir: 'allure-report', glob: 'history/**', zipFile: 'allure-history.zip'
publishHTML reportDir: 'allure-report', reportFiles: 'index.html', reportName: 'Allure Report' publishHTML reportDir: 'allure-report', reportFiles: 'index.html', reportName: 'Allure Report'
} }

View file

@ -53,8 +53,13 @@ ansiColor('xterm') {
} }
stage('Allure Report') { stage('Allure Report') {
copyArtifacts filter: 'allure-history.zip', optional: true, projectName: JOB_NAME
if (fileExists('allure-history.zip')) {
unzip dir: 'allure-data', quiet: true, zipFile: 'allure-history.zip'
sh 'rm -f allure-history.zip'
}
sh 'docker run --rm -v $PWD:/work -u $(id -u) tobix/allure-cli generate allure-data' sh 'docker run --rm -v $PWD:/work -u $(id -u) tobix/allure-cli generate allure-data'
zip archive: true, dir: 'allure-report', glob: 'history/**', overwrite: true, zipFile: 'allure-history.zip' zip archive: true, dir: 'allure-report', glob: 'history/**', zipFile: 'allure-history.zip'
publishHTML reportDir: 'allure-report', reportFiles: 'index.html', reportName: 'Allure Report' publishHTML reportDir: 'allure-report', reportFiles: 'index.html', reportName: 'Allure Report'
} }
} }