I have a Jenkins Declarative Pipeline with 2 different test stages both are configured to generate allure-results
I would like to merge these two allure-reports into a single allure-report and present it to the user in the Jenkins Pipeline workspace...
pipeline {
agent none
stages {
stage('Sanity') {
agent { label 'sanity-node' }
steps {
sh 'pytest -m sanity'
stash name: 'sanity-results', includes: 'allure-results/**'
}
}
stage('Regression') {
agent { label 'regression-node' }
steps {
sh 'pytest -m regression'
stash name: 'regression-results', includes: 'allure-results/**'
}
}
}
post {
always {
node('master') {
dir('merged-allure-results') {
unstash 'sanity-results'
unstash 'regression-results'
}
allure([
includeProperties: false,
jdk: '',
properties: [],
reportBuildPolicy: 'ALWAYS',
results: [[path: 'merged-allure-results']]
])
}
}
}
}
But some reason it doesn't seem to work! What am I doing wrong here? How can I achieve the desired outcome?
Allure does not know about the nested directories, so you need to pass both as results. Something like this:
Also, I would double check if those stashes are unstashed into different directories. I don't remember the structure of the results, but I doubt they could be safely merged just by copying everything in one place.