I'm building pipeline/jenkins-based CI for several projects and want to store allure results just as it would be done in regular build with fast access icon. Is it possible from pipeline?
Click New Item on your Jenkins home page, enter a name for your (pipeline) job, select Pipeline, and click OK. In the Script text area of the configuration screen, enter your pipeline syntax.
We were failed to use Allure Jenkins Plugin in pipeline. It seems that it supports job-dsl-plugin only. So... just add stage where you generate report using Allure CLI and publish report as regular HTML report. Icon for it will be available on job and build screen.
UPDATE
Allure v2 has supported pipeline - see documentation.
stage('reports') {
steps {
script {
allure([
includeProperties: false,
jdk: '',
properties: [],
reportBuildPolicy: 'ALWAYS',
results: [[path: 'target/allure-results']]
])
}
}
}
install the allure plugin for your jenkins. Go to your pipleline build configuration. click on pipeline syntax, select allure reports, fill-in the required fields, click generate syntax, it will give you the required code to be added to your existing groovy scripts
I am now using Allure report with Jenkins pipeline You have to perform some additional configuration steps:
_1. Jenkins master must start with the following options as described in http://wiki.qatools.ru/display/AL/Allure+Jenkins+Plugin (sample docker-compose.yaml)
version: '2'
services:
jenkins.master:
image: jenkins
# ...
environment:
JAVA_OPTS: "-Dhudson.model.DirectoryBrowserSupport.CSP=\"default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline';\" -Djenkins.model.DirectoryBrowserSupport.CSP=\"default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline';\""
_2. HTML Publisher plugin installed from jenkins plugin center
_3. Allure report is generated by maven, sample pom.xml is here https://github.com/ludenus/mobile_test_poc/blob/master/pom.xml
$ mvn -Dmaven.test.failure.ignore=true site
_4. Allure report is published by HTML publisher
stage('Publish') {
echo 'Publish Allure report'
publishHTML(
target: [
allowMissing : false,
alwaysLinkToLastBuild: false,
keepAll : true,
reportDir : 'target/site/allure-maven-plugin',
reportFiles : 'index.html',
reportName : "Allure Report"
]
)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With