'Publish generic HTML report in Azure DevOps release pipeline

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



Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Danilo Patrucco