allure-plugin icon indicating copy to clipboard operation
allure-plugin copied to clipboard

Unable to find Allure CommandLine

Open chandrapola opened this issue 6 years ago • 13 comments

Issue

Unable to find Allure Command Line

Context

  • Jenkins version: 2.67

  • Job type: Pipeline

  • Allure plugin version:

  • Allure commandline version: 2.4.1

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

chandrapola avatar Apr 20 '18 10:04 chandrapola

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.)

tkzv avatar Apr 27 '18 13:04 tkzv

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!

wendywww avatar Apr 30 '18 20:04 wendywww

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

klamping avatar Aug 14 '18 23:08 klamping

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

taraspos avatar Aug 30 '18 10:08 taraspos

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

vipinnambiar avatar Jan 25 '19 13:01 vipinnambiar

@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.

taraspos avatar Jan 25 '19 13:01 taraspos

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.

vipinnambiar avatar Jan 27 '19 13:01 vipinnambiar

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 ?

binbjz avatar Apr 09 '19 12:04 binbjz

@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

taraspos avatar Apr 09 '19 12:04 taraspos

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

binbjz avatar Apr 09 '19 15:04 binbjz

@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

wendywww avatar Apr 10 '19 21:04 wendywww

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!

ingdany avatar Aug 04 '20 04:08 ingdany

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

mshonichev avatar Oct 28 '22 22:10 mshonichev