jenkinsci / allure-plugin

Allure Jenkins Plugin
https://plugins.jenkins.io/allure-jenkins-plugin/
Other
85 stars 66 forks source link

No such file or directory ./AllureCommandline/bin/allure #207

Closed wendywww closed 5 years ago

wendywww commented 6 years ago

when install allure-plugin through jenkins piplin, got error message as" No such file or directory ./AllureCommandline/bin/allure"

Context

Problem description

Describe your problem in a meaningful way:

Screen shot for commandline installer from global tools setting maven_commondline_install

Logs & Traces

Error messages:

/home/ec2-user/tools/ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation/AllureCommandline/bin/allure generate -c -o /home/ec2-user/workspace/integration-tests-allure/allure-report

env: '/home/ec2-user/tools/ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation/AllureCommandline/bin/allure': No such file or directory

Under wdio.config

reporters: ['dot', 'spec', 'junit', 'allure'],
reporterOptions: {
junit: {
outputDir: process.env.CIRCLE_TEST_REPORTS ? ${process.env.CIRCLE_TEST_REPORTS}/webdriverio/ : './logs/',
},
allure: {
outputDir: './allure-results'
}

package-lock.json

"wdio-allure-reporter": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/wdio-allure-reporter/-/wdio-allure-reporter-0.6.0.tgz",
"integrity": "sha512-EMeNuCjrvL2qPzOHDomb3sfdNINC2RuaK4v80i8Lj1TZT08HMHZYqJbqxWsxrLH0py1LN1cOwKxzSUT++P5U/w==",
"dev": true,
"requires": {
"allure-js-commons": "1.3.1",
"babel-runtime": "6.26.0"
},

package.json "devDependencies": "wdio-allure-reporter": "^0.6.1"

jenkins file for pipline script:

post {
always {
archiveArtifacts allowEmptyArchive: true, artifacts: 'integration/logs/.'
archiveArtifacts allowEmptyArchive: true, artifacts: 'integration/shots/.'
junit 'integration/logs/*.xml'
allure([includeProperties: false, jdk: '', properties: [[key: 'variant', value: '${VARIANT}']], reportBuildPolicy: 'ALWAYS',results: [[path: 'allure-results']]])
cleanWs()
}
}

Please help resolve this issue ASAP. Thanks!

wendywww commented 6 years ago

@eroshenkoam @baev Could you please take a look at this issue? Thank you:)

wendywww commented 6 years ago

@baev I tried global tools configuration in 1) maven auto install and 2) zip file install, none of those are successful. The error has listed above, seems like after run all the test the allure command line was trying to install but while look up the downloaded file, it cannot find the executable file(allure2.6->bin->allure executable file).
The observation is similar as #163 and all related to Jenkins Pipeline job set up. I have included the corresponding pipeline file above. Please take a look.

pipeline {
    agent any
    options {
        timestamps()
        timeout(time: 2, unit: 'HOURS')
    }
    environment {
        JOB_USER = getJobUsername()
    }

    parameters {
        string(defaultValue: 'end_to_end_all_browsers', description: 'Test suite', name: 'testSuite')
    }
    stages {
        stage('Set description') {
            steps {
                script {
                    currentBuild.description = "${params.testOrg}: ${params.testSuite} on ${params.testBrowser}"
                }
            }
        }
        stage('Run tests') {
            agent {
                docker {
                    image 'sagan/selenium:3.10.0-argon'
                    args '-v /dev/shm:/dev/shm -u root --ulimit nofile=8000:8000' // otherwise Chrome crashes running out of memory, or SauceLabs complains
                    registryUrl 'https://registry.hub.docker.com'
                    registryCredentialsId 'dockerHub'
                }
            }
            post {
                always {
                    archiveArtifacts allowEmptyArchive: true, artifacts: 'integration/logs/*.*'
                    archiveArtifacts allowEmptyArchive: true, artifacts: 'integration/shots/*.*'
                    junit 'integration/logs/*.xml'
                    //allure([includeProperties: false, jdk: '', properties: [[key: 'variant', value: '${VARIANT}']], reportBuildPolicy: 'ALWAYS',results: [[path: 'allure-results']]]) 
                    allure results: [[path: 'allure-results']]
                    //cleanWs()
                }
            }

            steps {
                // clone build-harness
               checkout([$class: 'GitSCM', branches: [[name: 'origin/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'build-harness']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'github', url: 'https://github.com/sagansystems/build-harness.git']]])
                // workaround for https://issues.jenkins-ci.org/browse/JENKINS-41316
                sh '''
                nohup /opt/bin/entry_point.sh &
                sleep 10
                '''
                sshagent(['saganbotSSH']) { // need SSH to fetch private deps
                    sh 'make -C integration deps'
                }
                // run tests
                sh 'make -C integration test-suite'
            }
        }

    } 
}
eroshenkoam commented 6 years ago

@wendywww ty, I will look at this tomorrow

eroshenkoam commented 6 years ago
pipeline {
    agent { ... }
    stages {
        stage('Run tests') {
            agent {
                docker {
                    reuseNode true
                    image 'maven'
                }
            }
            steps {                
               checkout([$class: 'GitSCM', branches: [[name: 'origin/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/allure-examples/allure-junit-example']]])
               sh 'mvn clean test -Dmaven.test.failure.ignore=true'
               stash name: 'allure-results', includes: 'target/allure-results/*' // save results
            }
        }
    }
    post {
        always {
           unstash 'allure-results' //extract results
           allure results: [[path: 'target/allure-results']]
        }   
    }
}
eroshenkoam commented 6 years ago

@wendywww please test it

eroshenkoam commented 6 years ago

You need to use stash-unstash feature in this case. With this feature the problem will be solved.

wendywww commented 6 years ago
fail_to_extract

Thank you @eroshenkoam This is the current error i am having after add stash-unstash in my .jenkins file.

eroshenkoam commented 6 years ago

@wendywww You need to split test run and report build. Jenkins isn't support tools inside docker container agent.

So what you should do:

pipeline {
   agent ... //this is common agent 
   stages {
      stage("Run tests") {
         agent { docker ... } //only for tests 
         steps {
            // run your test
            // save results
         }
      }
      stage("Build report") { // 1. You can build allure report here
          agent { ... } //not docker
          steps {
              //unpack test results
              //build allure report
          }
      }
   }
   post { // 2. Or you can build report here
      always {
           //unpack test results
           //build allure report
       }
   }
}
wendywww commented 6 years ago

@eroshenkoam I tried both the options you suggested, but I am still getting the same errors. This seems from the

java.nio.file.AccessDeniedException:/home/ec2-user/workspace/test-allure-integration@2/integration/allure-results/0008a34b-9c30-4e6b-ba93-84993298ebda-attachment.json

and

Also:hudson.remoting.Channel$CallSiteStackTrace: Remote call to slaves.jenkins-dev.mertslounge.ca (i-0b669f80dc65c18b3)

I have attached the detailed error message here. error_2.txt

wendywww commented 6 years ago

@eroshenkoam I am not able to unstash the allure-results successful, which doesn't feed data to the allure report. I think it's very close, do you have any suggestion on how to make unstash work? (as you suggested, the unstash is under agent any

wendywww commented 6 years ago
screen shot 2018-07-11 at 2 34 24 am
wendywww commented 6 years ago
post {
        always{
            unstash 'allure-results' //unpack test results
            script {
                allure results: [[path: 'integration/allure-results']]
            }
        }
    }

by adding the script snippet script { allure results: [[path: 'integration/allure-results']] } the report is able to read the data from the results. Hope this help others who's in same issue

wendywww commented 5 years ago

@eroshenkoam you can close this issue as we have resolved it long time back, thank you.

VigneshRamamoorthy25 commented 1 month ago

Hi @eroshenkoam / @wendywww , I'm facing this issue in my current project and May I know the exact workaround step by step please

pipeline { agent { docker { image 'mcr.microsoft.com/playwright:v1.47.0-noble' } } tools {nodejs "22.8.0" }

stages {
    stage('Test') {
        steps {
            sh '''
                      npm install
                      npx playwright install 
                      npx playwright test -g "@rewards" --workers=1
                      stash name: 'allure-results', includes: 'target/allure-results/*
                      allure generate allure-results -o allure-report --clean
                      npx allure serve allure-results
                    '''
        }
       post {
            always {
                unstash 'allure-results'
                allure includeProperties:
                 false,
                 jdk: '',
                 results: [[path: 'build/allure-results']]
            }
        }
    }
}

}

This is my jenkins file for your reference