How does one run allure plugin in jenkins pipeline?

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']]
            ])
    }
    }
}

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"
                ]
        )
    }

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

Tags:

Jenkins

Allure