jenkinsci / allure-plugin

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

Unable to find Allure CommandLine #205

Open chandrapola opened 6 years ago

chandrapola commented 6 years ago

Issue

Unable to find Allure Command Line

Context

Problem description

Trying to run the Allure report from the Jenkins Pipeline with the below pom.xml entries in the project

<plugin>
         <groupId>io.qameta.allure</groupId>
    <artifactId>allure-maven</artifactId>
    <version>2.8</version>                     
</plugin>
<dependency>
    <groupId>ru.yandex.qatools.allure</groupId>
    <artifactId>allure-testng-adaptor</artifactId>
    <version>1.5.4</version>
</dependency>

We are using the following Allure Configuration Description in the Jenkins File

allure([
        includeProperties: false,
        jdk: '',
        properties: [],
        reportBuildPolicy: 'ALWAYS',
            results: [[path: 'target/allure-results']]
    ])

Logs & Traces

[Pipeline] // node
[Pipeline] End of Pipeline

GitHub has been notified of this commit’s build result

java.io.IOException: Can't find allure commandline <null>
    at ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation$2.call(AllureCommandlineInstallation.java:63)
    at ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation$2.call(AllureCommandlineInstallation.java:58)
    at hudson.remoting.UserRequest.perform(UserRequest.java:153)
    at hudson.remoting.UserRequest.perform(UserRequest.java:50)
    at hudson.remoting.Request$2.run(Request.java:336)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
    at ......remote call to ansible-rcbuild3(Native Method)
    at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1545)
    at hudson.remoting.UserResponse.retrieve(UserRequest.java:253)
    at hudson.remoting.Channel.call(Channel.java:830)
    at ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation.getMajorVersion(AllureCommandlineInstallation.java:58)
    at ru.yandex.qatools.allure.jenkins.ReportBuilder.build(ReportBuilder.java:44)
    at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.generateReport(AllureReportPublisher.java:298)
    at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.perform(AllureReportPublisher.java:223)
    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:78)
    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:65)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:49)
    at hudson.security.ACL.impersonate(ACL.java:260)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:46)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Finished: FAILURE
tkzv commented 6 years ago

Same problem with freestyle project and multi-configuration project. Both for Allure installed in system and by Jenkins. Same versions.

Why can't the plugin use Allure installed in the system? Why does it need to install its own? (Which it fails to do properly.)

wendywww commented 6 years ago

Is this issue somehow related to my question? https://github.com/webdriverio/wdio-allure-reporter/issues/114 If anyone know how to fix it please let me know. Thx!

klamping commented 6 years ago

I think you can fix this by going to the tool configuration page (/configureTools/) and finding the "allure commandline" section. Then click "Add Allure Commandline" then give it a name and click "install automatically": image

taraspos commented 6 years ago

Same problem here. Allure plugin doesn't resolve allure executable from path or ALLURE_HOME it works only if Allure Commandline installation is set :/

vipinnambiar commented 5 years ago

On the agent configuration setting,set the Allure installation home directory(without the "bin") should resolve this issue. That worked for me. image

taraspos commented 5 years ago

@vipinnambiar yeah, I know, this works, but I still believe that it should work without this configuration if ALLURE_HOME is set. Thing is, I have many slaves that are configured automatically with allure installed and I can't use them until this configuration added.

vipinnambiar commented 5 years ago

Ok. I have only couple of slaves configured and don't have permissions to configure tools installations, they are managed by Devops Admin. Agree to your point, jenkins should resolve this using ALLURE_HOME instead of looking at the setup in tools configuration.

binbjz commented 5 years ago

Same problem here. Allure plugin doesn't resolve allure executable from path or ALLURE_HOME it works only if Allure Commandline installation is set :/

@Trane9991 I don't know if Allure Commandline installation is set :/, ":/" what this means ?

taraspos commented 5 years ago

@binbjz following, on the UI is:

I think you can fix this by going to the tool configuration page (/configureTools/) and finding the "allure commandline" section. Then click "Add Allure Commandline" then give it a name and click "install automatically": image

binbjz commented 5 years ago

@Trane9991 I tried this solution, but it doesn't work. Allure version is 2.9.0 image

wendywww commented 5 years ago

@binbjz Is your jenkins job run with pipeline file? What i figured is, it needs stash/unstash for the report to be generated. https://github.com/jenkinsci/allure-plugin/issues/207

ingdany commented 4 years ago

I think you can fix this by going to the tool configuration page (/configureTools/) and finding the "allure commandline" section. Then click "Add Allure Commandline" then give it a name and click "install automatically": image

Works fine, thank you!

mshonichev commented 1 year ago

somewhat reproduced.

Allure Command line 2.13.7 Allure plugin 2.30.2

Pre conditions: home directories for Jenkins agents and command line Tool Path mismatch, e.g. all hosts have tool home at /home/ci/tools and some agent host have /home/ci/agent/tools.

When configuring allure command line installation with Install automatically and Run shell command, the tool is installed at agent host properly, but when running allure step it breaks with NPE:


Tool Path: /home/ci/tools/ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation/allure/allure-2.13.7

Installation Shell command

#!/bin/bash

set -x

ALLURE_VERSION=2.13.7
ALLURE_ARCHIVE=allure-commandline-$ALLURE_VERSION.zip

if [[ -f "allure-$ALLURE_VERSION/bin/allure" ]]; then
    echo "allure binary already exists"
else
    echo "cleanup and download $ALLURE_ARCHIVE"
    rm -rfv allure-*
    wget http://***/share/allure/$ALLURE_ARCHIVE
    unzip -q $ALLURE_ARCHIVE 
    rm $ALLURE_ARCHIVE
fi

Installation successful:

2022-10-28 18:38:43  [allure] $ sh -e /home/ci/agent/tools/ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation/allure/hudson7520593169652667319.sh
2022-10-28 18:38:43  + ALLURE_VERSION=2.13.7
2022-10-28 18:38:43  + ALLURE_ARCHIVE=allure-commandline-2.13.7.zip
2022-10-28 18:38:43  + [[ -f allure-2.13.7/bin/allure ]]
2022-10-28 18:38:43  + echo 'allure binary already exists'

...

Allure step crashes:

2022-10-28 18:38:43  java.io.IOException: Can't find allure commandline <null>
2022-10-28 18:38:43     at ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation$GetMajorVersion.call(AllureCommandlineInstallation.java:74)
2022-10-28 18:38:43     at ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation$GetMajorVersion.call(AllureCommandlineInstallation.java:65)
2022-10-28 18:38:43     at hudson.remoting.UserRequest.perform(UserRequest.java:211)
2022-10-28 18:38:43     at hudson.remoting.UserRequest.perform(UserRequest.java:54)
2022-10-28 18:38:43     at hudson.remoting.Request$2.run(Request.java:376)
2022-10-28 18:38:43     at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
2022-10-28 18:38:43     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
2022-10-28 18:38:43     at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
2022-10-28 18:38:43     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
2022-10-28 18:38:43     at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:122)
2022-10-28 18:38:43     at java.base/java.lang.Thread.run(Thread.java:829)

ls -la /home/ci/ at ordinary agent:

-rw-r--r--  1 ci ci  666 Sep 24 23:04 agent.xml
drwxr-xr-x  3 ci   ci   4096 Sep 26 09:54 caches
drwxr-xr-x  4 ci   ci   4096 Sep 24 23:04 remoting
drwxr-xr-x  3 ci   ci   4096 Oct 28 14:31 tools
drwxr-xr-x 24 ci   ci   4096 Oct 28 22:21 workspace

ls -la /home/ci/ at broken agent:

drwxrwxr-x 8 ci   ci      4096 Sep 24 23:04 agent

Seems that plugin resolves configured agent home directory (/home/ci/agent/) for installation, but then crashes trying to find utility by using configured tool path (/home/ci/tools/...)

workaround: symlinked /home/ci/tools to /home/ci/agent/tools at agent host and NPE disappeared