Level 2

Jenkins Code Insight Pipeline script - how to generate report

Code Insight 2021 R1 Plugins Guide mentions about the Jenkins Code Insight plugin. Via the Jenkins plugin, we get a dialog wherein we can specify code insight server details and also an option (in the form of a checkbox) to generate report after scan. However, we want to use Jenkins pipeline script to run scan and generate report. The pipeline code example, both declarative and scripted pipeline code, mentions about StartScan step wherein we can specify BaseURL, projectName, alias, host and token. However, there is no step given for generating report after scan via pipeline. How to generate report on Jenkins side after scan?

Labels (1)
1 Reply
Level 2

We just use the REST API via shell:

curl -H "Authorization: Bearer ${TOKEN}" -o "$SERVER/api/project/generateReport?projectId=${PROJECTID}&reportType=AUDIT"


Luckily (even if the resource naming might suggest just starting the asynchronous report generation process) it regenerates and downloads the report in one stop.

0 Kudos