jenkinsci / allure-plugin

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

Running allure plugin inside a container throws error: AllureCommandlineInstallation/Allure_2.21.0/bin/allure: no such file or directory: unknown #348

Open saritvakrat opened 9 months ago

saritvakrat commented 9 months ago

Jenkins and plugins versions report

Environment ```text Paste the output here ```

What Operating System are you using (both controller, and any agents involved in the problem)?

Linux, Jenkins

Reproduction steps

Allure plugin version: 2.30.3 Allure CLI Installation from maven: Allure 2.27.0

I am using a docker agent to run tests inside a container and than generate allure report inside the "post" section. Everytime the allure plugin is being called inside a container I get this errors when the allure plugin is in post:

15:58:54 OCI runtime exec failed: exec failed: unable to start container process: exec: "/home/ec2-user/tools/ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation/Allure_2.21.0/bin/allure": stat /home/ec2-user/tools/ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation/Allure_2.21.0/bin/allure: no such file or directory: unknown [Pipeline] } [Pipeline] // script Error when executing always post condition: Also: org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: f5cbc352-0a53-454a-b486-e326e42261f7 ru.yandex.qatools.allure.jenkins.exception.AllurePluginException: Can not generate Allure Report, exit code: 126 at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.generateReport(AllureReportPublisher.java:314) at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.perform(AllureReportPublisher.java:231) at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:101) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:71) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)

when I call the allure plugin from inside a step i get this error: 16:14:06 Ran all test suites matching /fields.test.ts/i. [Pipeline] allure 16:14:06 Cannot find a history information about previous builds. 16:14:06 java.nio.file.AccessDeniedException: /home/ec2-user/workspace/Ad-hoc/be_testing_ad_hoc/allure-results/history

I tried adding to the Jenkins global settings a new empty allure CLI install just for using it in docker - but tools is not supported in docker container!

I tried with and without installing the allure CLI from the docker image - same errors.

I tried uploading the allure-results data to S3 and than calling it in post - same errors

I tried stash unstash - same errors

I tried archive artifacts and generating via CLI- it works, but I cant serve the report without the plugin

I tried adding chmod for allure results: sh 'chmod -R 777 $(pwd)/allure-results' allure includeProperties: false, jdk: '', results: [[path: "allure-results"]]

Still same error:
               5:58:54  [be_testing_ad_hoc] $ docker exec --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** 4f6631cff8c8d977a20ba4265515c9ea710e164c31325811b6ab25463fdf8ad2 /home/ec2-user/tools/ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation/Allure_2.21.0/bin/allure generate -c -o /home/ec2-user/workspace/Ad-hoc/be_testing_ad_hoc/allure-report

15:58:54 OCI runtime exec failed: exec failed: unable to start container process: exec: "/home/ec2-user/tools/ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation/Allure_2.21.0/bin/allure": stat /home/ec2-user/tools/ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation/Allure_2.21.0/bin/allure: no such file or directory: unknown [Pipeline] } [Pipeline] // script Error when executing always post condition: Also: org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: f5cbc352-0a53-454a-b486-e326e42261f7 ru.yandex.qatools.allure.jenkins.exception.AllurePluginException: Can not generate Allure Report, exit code: 126 at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.generateReport(AllureReportPublisher.java:314) at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.perform(AllureReportPublisher.java:231) at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:101) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:71) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)

[Pipeline] } [Pipeline] // stage [Pipeline] } 15:58:54
[Pipeline] // ansiColor [Pipeline] } [Pipeline] // timestamps [Pipeline] } [Pipeline] // timeout [Pipeline] } [Pipeline] // withEnv [Pipeline] } $ docker stop --time=1 4f6631cff8c8d977a20ba4265515c9ea710e164c31325811b6ab25463fdf8ad2 $ docker rm -f --volumes 4f6631cff8c8d977a20ba4265515c9ea710e164c31325811b6ab25463fdf8ad2 [Pipeline] // withDockerContainer [Pipeline] } [Pipeline] // withDockerRegistry [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Also: org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: f5cbc352-0a53-454a-b486-e326e42261f7 ru.yandex.qatools.allure.jenkins.exception.AllurePluginException: Can not generate Allure Report, exit code: 126 at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.generateReport(AllureReportPublisher.java:314) at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.perform(AllureReportPublisher.java:231) at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:101) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:71) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) Finished: FAILURE

Another approach i tried is generating the report directly using the allure CLI without the plugin. But its not showing the report. Its trying to start a server which will keep my job hanging, also it wont show the report

My docker agent:

agent {
    dockerfile {
        label 'jenkins-auto-worker'
        filename 'be.dockerfile'
        dir 'pipeline'
        args '-u root -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v /etc/sysconfig/docker:/etc/sysconfig/docker -v /home/ec2-user/workspace:/home/ec2-user/workspace -v ${WORKSPACE}/results/allure-results:/allure-results --privileged'
    }
}

Plugins api:     allure includeProperties: false, jdk: '', results: [[path: "allure-results"]]

Expected Results

Allure to be shown!

Actual Results

Described above

Anything else?

No response

Are you interested in contributing a fix?

No response