allure2 icon indicating copy to clipboard operation
allure2 copied to clipboard

Error when generates a report - Allure Test Reports(Molecula) plugin - Azure Devops(VSTS)

Open fescobar opened this issue 5 years ago • 19 comments

Describe the bug I'm using this plugin for Allure https://marketplace.visualstudio.com/items?itemName=Molecula.allure-test-reports When Azure try to generate the report throws next errors

For Ubuntu agent:

[command]/usr/local/bin/node /home/vsts/work/_tasks/AllureGenerate_5c975f9d-1c3a-469f-b7c2-8907bf3eacfb/1.0.0/node_modules/allure-commandline/bin/allure generate --output /home/vsts/work/1/s/allure-report/46 /home/vsts/work/1/s/allure-results
events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: spawn /home/vsts/work/_tasks/AllureGenerate_5c975f9d-1c3a-469f-b7c2-8907bf3eacfb/1.0.0/node_modules/allure-commandline/dist/bin/allure EACCES
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
    at onErrorNT (internal/child_process.js:415:16)
    [... lines matching original stack trace ...]
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
      throw er; // Unhandled 'error' event
      ^

Error: spawn /home/vsts/work/_tasks/AllureGenerate_5c975f9d-1c3a-469f-b7c2-8907bf3eacfb/1.0.0/node_modules/allure-commandline/dist/bin/allure EACCES
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
    at onErrorNT (internal/child_process.js:415:16)
    [... lines matching original stack trace ...]
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)

For Windows agent:

[command]C:\Program Files\nodejs\node.exe D:\a\_tasks\AllureGenerate_5c975f9d-1c3a-469f-b7c2-8907bf3eacfb\1.0.0\node_modules\allure-commandline\bin\allure generate --output D:\a\1\s\allure-report\49 D:\a\1\s\allure-results
Command aborted due to exception {}.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
	at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
	at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
	at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:153)
	at ru.yandex.qatools.allure.command.ReportGenerate.runUnsafe(ReportGenerate.java:48)
	at ru.yandex.qatools.allure.command.AbstractCommand.run(AbstractCommand.java:52)
	at ru.yandex.qatools.allure.CommandLine.main(CommandLine.java:46)
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
	at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
	at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
	at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:153)
	at ru.yandex.qatools.allure.command.ReportGenerate.runUnsafe(ReportGenerate.java:48)
	at ru.yandex.qatools.allure.command.AbstractCommand.run(AbstractCommand.java:52)
	at ru.yandex.qatools.allure.CommandLine.main(CommandLine.java:46)

	at ru.yandex.qatools.allure.data.AllureReportGenerator.generate(AllureReportGenerator.java:58)
	at ru.yandex.qatools.allure.data.AllureReportGenerator.generate(AllureReportGenerator.java:53)
	at ru.yandex.qatools.allure.AllureMain.main(AllureMain.java:48)

Exception in thread "main" ru.yandex.qatools.allure.data.ReportGenerationException: Could not find any allure results
	at ru.yandex.qatools.allure.data.AllureReportGenerator.generate(AllureReportGenerator.java:58)
	at ru.yandex.qatools.allure.data.AllureReportGenerator.generate(AllureReportGenerator.java:53)
	at ru.yandex.qatools.allure.AllureMain.main(AllureMain.java:48)

To Reproduce Steps to reproduce the behavior:

  1. Go to Azure Devops

  2. Install Allure plugin https://marketplace.visualstudio.com/items?itemName=Molecula.allure-test-reports

  3. Go to your Azure project according to your user/workspace.

  4. Go to Pipeline section

  5. Create a new pipeline.

  6. Setup a build with Ubuntu/Windows (according what error you need to reproduce) agent image

  7. Setup any project to generate results (In this case Maven/Java project)

  8. Setup sheel script for Ubuntu agent to verify files in allure-results directory (use CMD for Windows) image

  9. Setup allure plugin to take allure-results directory to generate a report. image

  10. Run pipeline

Expected behavior When pipeline finished (failed or not), it should generate Allure report files.

Screenshots Error for Ubuntu Verifying if allure-results directory exists and if it contains files results. image

Stack trace when Allure plugin is trying to generate a report. image

Error for Windows Verifying if allure-results directory exists and if it contains files results. image

Stack trace when Allure plugin is trying to generate a report. image

fescobar avatar Mar 21 '19 11:03 fescobar

Facing the same issue. Do we have any updates?

MegalaRajendran avatar Aug 09 '19 11:08 MegalaRajendran

@MegalaRajendran seems to be nobody is maintaining this plugin.

I have another solution for you. You could start up an Allure docker container in your server (Allure Docker Service: https://github.com/fescobar/allure-docker-service ) and you could send your results from AzureDevops to that container through API.

https://github.com/fescobar/allure-docker-service#send-results-through-api

fescobar avatar Aug 15 '19 11:08 fescobar

@fescobar Thanks for the workaround. Will Try . Hope this solves

MegalaRajendran avatar Aug 16 '19 10:08 MegalaRajendran

Hi Team,

Allure Test Reports plugin is not working on Azure, i am getting below error. Could you please look into it?

I have checked C:\agent_work\2\s\target\allure-results contains multiple files

2020-02-12T09:42:21.9156093Z ##[section]Starting: Generate Allure Report 2020-02-12T09:42:22.0589528Z ============================================================================== 2020-02-12T09:42:22.0589617Z Task : Generate Allure Report 2020-02-12T09:42:22.0589645Z Description : Generates Allure report based on the test results 2020-02-12T09:42:22.0589673Z Version : 1.0.0 2020-02-12T09:42:22.0589697Z Author : Molecula 2020-02-12T09:42:22.0589727Z Help : More Information 2020-02-12T09:42:22.0589752Z ============================================================================== 2020-02-12T09:42:22.9191463Z [command]C:\Program Files\nodejs\node.exe C:\agent_work_tasks\AllureGenerate_5c975f9d-1c3a-469f-b7c2-8907bf3eacfb\1.0.0\node_modules\allure-commandline\bin\allure generate --output C:\agent_work\2\s\allure-report\20200212.10 C:\agent_work\2\s\target\allure-results 2020-02-12T09:42:26.9963352Z Command aborted due to exception {}.

2020-02-12T09:42:26.9963671Z Exception in thread "main" ru.yandex.qatools.allure.data.ReportGenerationException: Could not find any allure results

2020-02-12T09:42:26.9963753Z org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)

2020-02-12T09:42:26.9963833Z at ru.yandex.qatools.allure.data.AllureReportGenerator.generate(AllureReportGenerator.java:58) 2020-02-12T09:42:26.9963900Z at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404) 2020-02-12T09:42:26.9964290Z at ru.yandex.qatools.allure.data.AllureReportGenerator.generate(AllureReportGenerator.java:53) 2020-02-12T09:42:26.9964350Z at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166) 2020-02-12T09:42:26.9964634Z at ru.yandex.qato

stambecg avatar Feb 12 '20 10:02 stambecg

@stambecg Nobody is maintaining this plugin.

fescobar avatar Feb 12 '20 10:02 fescobar

@fescobar Could you help me with advice on best way to attach a report to each azure work through ALLURE DOCKER SERVICE. Thanks for your work

Garynychxxx avatar Mar 06 '20 12:03 Garynychxxx

@Garynychxxx Allure Docker Service exposes an API. For example, you can send results from anywhere even from Azure. You can deploy 1 or multiple allure docker containers, it's up to you. But this solution is outside of Azure, you have to have your own infrastructure.

Another option is to run allure docker command in azure including your results to generate the emailable report https://github.com/fescobar/allure-docker-service#customize-emailable-report, after that you should stop the container.

You have multiple ways to use that container, it's up to you what is the best way in your case. You have all the documentation here https://github.com/fescobar/allure-docker-service

fescobar avatar Mar 06 '20 14:03 fescobar

@Garynychxxx Allure Docker Service exposes an API. For example, you can send results from anywhere even from Azure. You can deploy 1 or multiple allure docker containers, it's up to you. But this solution is outside of Azure, you have to have your own infrastructure.

Another option is to run allure docker command in azure including your results to generate the emailable report https://github.com/fescobar/allure-docker-service#customize-emailable-report, after that you should stop the container.

You have multiple ways to use that container, it's up to you what is the best way in your case. You have all the documentation here https://github.com/fescobar/allure-docker-service

Yep thanks, But as I understand it is impossible to create individual report for each job . Something like this.....

Untitled

Garynychxxx avatar Mar 09 '20 14:03 Garynychxxx

@Garynychxxx Use a different port for a different group of tests or categorize your tests.

fescobar avatar Mar 09 '20 15:03 fescobar

@fescobar

Is your project intended for local use only? I tried to run it on azure and could not open the API.

http://alluressreport.azurewebsites.net/index.html

Garynychxxx avatar Mar 10 '20 13:03 Garynychxxx

@Garynychxxx you can use it from everywhere, even from kubernetes. You need to expose the API (use different port, by default 5050). Read the doc https://github.com/fescobar/allure-docker-service#allure-api 4040 is for Allure UI 4040 is for Allure API

    ports:
      - "4040:4040"
      - "5050:5050"

fescobar avatar Mar 10 '20 14:03 fescobar

Same issues as orginally posted. Does this plugin ever works ? I copied results through script to allure-reports/buildId folder. still dont see allure showing reports on the finished build pipeline

khanzzirfan avatar Feb 24 '21 02:02 khanzzirfan

Same issue seen as in the original post. :(

mihaivilcufd avatar Mar 19 '21 14:03 mihaivilcufd

Here is the fix. There are two ways depending on agent you are using.

  1. Use Azure Pipelines - vs2017-win2016 agent
  2. Use any Linux agent (Azure Pipelines Ubuntu or self hosted) with extra task before creating Allure Report chmod 755 $(Agent.WorkFolder)/_tasks/AllureGenerate_5c975f9d-1c3a-469f-b7c2-8907bf3eacf1/1.0.0/node_modules/allure-commandline/dist/bin/allure

MikhailTamarinFlipdish avatar Apr 30 '21 11:04 MikhailTamarinFlipdish

As described above on Pipeline add an extra task (Bash) before creating Allure Report and add these lines

sed -i 's/allure-commandline.*/allure-commandline\": \">=2.13.8",/' $(Agent.WorkFolder)/_tasks/AllureGenerate_5c975f9d-1c3a-469f-b7c2-8907bf3eacfb/1.0.0/package.json
cd $(Agent.WorkFolder)/_tasks/AllureGenerate_5c975f9d-1c3a-469f-b7c2-8907bf3eacfb/1.0.0/ && npm update
chmod -R 777 $(Agent.WorkFolder)/_tasks/AllureGenerate_5c975f9d-1c3a-469f-b7c2-8907bf3eacfb/1.0.0/
chmod 755 $(Agent.WorkFolder)/_tasks/AllureGenerate_5c975f9d-1c3a-469f-b7c2-8907bf3eacfb/1.0.0/node_modules/allure-commandline/dist/bin/allure

If something is not working check Dir is exists( i mean AllureGenerate_5c975f9d-1c3a-469f-b7c2-8907bf3eacfb)!

SomeOne55468 avatar Jun 08 '21 14:06 SomeOne55468

Here is the fix. There are two ways depending on agent you are using.

  1. Use Azure Pipelines - vs2017-win2016 agent
  2. Use any Linux agent (Azure Pipelines Ubuntu or self hosted) with extra task before creating Allure Report chmod 755 $(Agent.WorkFolder)/_tasks/AllureGenerate_5c975f9d-1c3a-469f-b7c2-8907bf3eacf1/1.0.0/node_modules/allure-commandline/dist/bin/allure

chmod resolves the original issue in this post. But then ran into another error "Unknown Test Runner" as reported in #880 From the log, it says report has been successfully generated before displaying "Unknown Test Runner" error Report successfully generated to the directory </Users/xxxx/myagent/_work/51/s/e2e/reports/allure/reports/>. Use 'allure report open' command to show the report. Custom paths were specified instead of using default ones btw.

salientsysios avatar Aug 26 '21 21:08 salientsysios

Will someone fix this issue?

ElkRom avatar Dec 30 '21 08:12 ElkRom

@ElkRom I don't think so.

fescobar avatar Dec 30 '21 12:12 fescobar

Any update on above issue ?

asalmano avatar Jun 28 '22 19:06 asalmano

Hey, are will still without standard solution? :(

uLucasFraga avatar Dec 29 '22 10:12 uLucasFraga

@MikhailTamarinFlipdish Can you please guide if below is correct? I am getting an error as no such file or dir.

image

Madiha20 avatar May 01 '23 12:05 Madiha20

@MikhailTamarinFlipdish Can you please guide if below is correct? I am getting an error as no such file or dir.

image

find $(Agent.WorkFolder)/_tasks/ -name allure -type f -exec chmod 755 {} \; This is the command we are executing before AllureGenerate task. Works like a charm.

MikhailTamarinFlipdish avatar May 01 '23 12:05 MikhailTamarinFlipdish

@MikhailTamarinFlipdish Thanks, the bash job worked but now getting a different error for generating the report. Looks like i am pretty close.

This is how I am generating report via script in package.json file

"generate": "allure generate --clean allure-results"

Pipeline

# Script to run the automation tests
- script: |
    ENV=${{ parameters.environment }} npm run test
    npm run generate
    if [ $? -ne 0 ]; then
        exit 1
  displayName: 'Run Tests'

# Copy the target folder to Azure Pipelines
- task: CopyFiles@2
  condition: succeededOrFailed()
  inputs:
    Contents: 'allure-report/**'
    TargetFolder: '$(Build.ArtifactStagingDirectory)'

# Publish build artifacts to Azure Pipelines
- task: PublishPipelineArtifact@1
  condition: succeededOrFailed()
  inputs:
    targetPath: '$(Build.ArtifactStagingDirectory)'
    publishLocation: 'pipeline'

- task: Bash@3
  condition: succeededOrFailed()
  inputs:
    targetType: 'inline'
    script: chmod 755 $(Agent.WorkFolder)/_tasks/AllureGenerate_5c975f9d-1c3a-469f-b7c2-8907bf3eacfb/1.0.0/node_modules/allure-commandline/dist/bin/allure

# Publish Allure report to Azure Pipelines
- task: AllureGenerate@1
  condition: succeededOrFailed()
  inputs:
    resultsDir: 'allure-results'
    targetDir: 'allure-report/$(Build.BuildNumber)'
image

Madiha20 avatar May 01 '23 12:05 Madiha20

@MikhailTamarinFlipdish Can you please confirm if your report is generated at this URL as there is a difference of path and I think that is why the report is not getting generated.

image

Madiha20 avatar May 01 '23 13:05 Madiha20

see https://github.com/allure-framework/allure2/issues/1140

baev avatar Jan 08 '24 17:01 baev

Official Allure extension for Azure Pipelines are now available https://marketplace.visualstudio.com/items?itemName=qameta.allure-azure-pipelines

History isn't yet supported, but we'll get there! Please submit feedback to our discussions

baev avatar Feb 01 '24 12:02 baev