allure2: Allure-results does not exists - cant change the result path

I am using Allure 2.28.1 plugin for Jenkins via declarative pipeline as below. But I could not able to read allure reports. So reports seems generated below ~/workspace/selenium_tests@2/ApiTestAutomation/ApiHubTestAutomation/target but I could not able to change the path in script.

How can I change the allure path to read the reports from below path ? Or even if I use dir and specify the path, why allure ignore this path to generate reports ?

ubuntu@play-0:~/workspace/selenium_tests@2/ApiTestAutomation/ApiHubTestAutomation/target$ ls                                                                                            
allure-results  generated-test-sources  maven-status  surefire  surefire-reports  test-classes

[selenium_tests] $ /home/ubuntu/tools/ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation/Allure_2.13.5/bin/allure generate -c -o /home/ubuntu/workspace/selenium_tests/allure-report
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
allure-results does not exists
Report successfully generated to /home/ubuntu/workspace/selenium_tests/allure-report
Allure report was successfully generated.
Creating artifact for the build.
Artifact was added to the build.

Here is what I tried

        steps {
            script {
                dir ('~/workspace/selenium_tests@2/ApiTestAutomation/ApiHubTestAutomation') {
                    allure([
                            includeProperties: false,
                            jdk: '',
                            properties: [],
                            reportBuildPolicy: 'ALWAYS',
                            results: [[path: 'target/allure-results']]
                    ])
                }
            }
        }
    }

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 25 (8 by maintainers)

Most upvoted comments

@semihural try doing this

ws allows you to create a custom workspace with the name that you want. Use ws when you generate the results and when you generate the report. In my case I’m creating a custom workspace named my-workspace. I’m using ws in every stage.

automation_repository = 'https://github.com/fescobar/allure-docker-service.git'
default_branch = 'master'
my_workspace = 'my-workspace'
pipeline {
    agent any
    options {
        disableConcurrentBuilds()
        buildDiscarder(logRotator(numToKeepStr: '10'))
    }

    stages {
        stage('Clone Project Testing Repository') {
            steps {
                ws(my_workspace){
                    cleanWs()
                    git(url: automation_repository, branch: default_branch)
                }
            }
        }

        stage('Run Tests') {
            steps {
                ws(my_workspace){
                    warnError('Unstable Tests') {
                        print('This stage should be use it to run tests generating allure-results directory')
                    }
                }
            }
        }

        stage('ALLURE') {
            steps {
                ws(my_workspace+"/allure-docker-api-usage/"){
                    script {
                            allure([
                                includeProperties: false,
                                jdk: '',
                                properties: [],
                                reportBuildPolicy: 'ALWAYS',
                                results: [[path: "allure-results-example"]]
                            ])
                    }
                }
            }
        }
    }
}