1

I am working on publishing generic html report in Azure Devops release pipeline but not able to get any useful extension or approach to achieve it.

Also got a link in which same ticket is opened from two years in developer community.

Link: https://developercommunity.visualstudio.com/t/support-for-generic-html-publishing-inside-build-a/491426

Thank you, Shivam

shivam
  • 111
  • 2
  • 13

1 Answers1

0

You have to use the following task :

PublishTestResults@2

E.g. This is what I use to publish a test result from the OWASP code analysis app

- task: PublishTestResults@2
  displayName: 'Publish Dependency Check Test Results'
  inputs:
    testResultsFiles: 'dependency-check-junit.xml'
    searchFolder: '/home/vsts/work/1/TestResults/dependency-check/'
    testRunTitle: 'Dependency Check'

What you need to do is create a report following the formatting specification described in this link and target the directory where you saved (searchFolder) it (and possibly the name of the file in testResultsFiles) in the publishtestresults task.

The owasp task I am referencing is this:

dependency-check.dependencycheck.dependency-check-build-task.dependency-check-build-task@6

and here is the code for the whole task if you want to test it in your application (we analyze a package.json and package-lock.json in our case)

- task: dependency-check.dependencycheck.dependency-check-build-task.dependency-check-build-task@6
  displayName: 'Dependency Check'
  inputs:
    projectName: dependencies-check
    scanPath: '**/*.json'
    warnOnCVSSViolation: true
    format: 'ALL'
  continueOnError: true

- task: PublishTestResults@2
  displayName: 'Publish Dependency Check Test Results'
  inputs:
    testResultsFiles: 'dependency-check-junit.xml'
    searchFolder: '/home/vsts/work/1/TestResults/dependency-check/'
    testRunTitle: 'Dependency Check'

the result will be displayed in your pipeline screen under Tests enter image description here

Danilo Patrucco
  • 110
  • 3
  • 10
  • Thank you @Danilo for the above pointer, however I am trying to publish generic html report and there is no xml file I am getting in my pipeline flow. – shivam Apr 20 '22 at 15:00
  • 1
    Unfortunately there is no way to publish HTML reports using a task from Azure (MS), you may be able to test an application like [this one](https://github.com/JakubRumpca/azure-pipeline-html-report), but the fact that has not bee updated since Jan 2021 may be a problem. You may have some luck using what is described in this question: [convert html to xml](https://stackoverflow.com/questions/10473875/converting-html-to-xml), but again, you would need to format it to match Azure req. – Danilo Patrucco Apr 20 '22 at 15:06