I am trying to assign a new issue to a specific user.
Wrote a tool which will query the issues after a specific date and do the assignment.
** I am running a task in the build pipeline after SonarScanner is completed. This task will fetch the issues created after a specific date and assign to a user. **
** I observed while doing the query, it returns all the issues which was published earlier, but not in the current analysis **
** For example, TFS shows the log 2023-09-28T17:49:26.2406588Z The SonarScanner CLI has finished - means 07:49 PM CET SonarQube dashboard shows the specific issue is created at September 28, 2023, at 10:59 PM CET**. This means there is a time offset, and that’s the reason I am not getting the new issue when I query immediately after the analysis.
An analysis is not complete until the relevant background task has been completed. Even though the SonarScanner’s log shows EXECUTION SUCCESS, the analysis results will not be visible in the SonarQube project until the background task has been completed. After a SonarScanner has finished analyzing your code, the result of the analysis (sources, issues, metrics) is sent to SonarQube server for final processing by the compute engine. Analysis reports are queued and processed serially.
Also, at the end of analysis log you’ll see something like this:
Or use the sonar.qualitygate.wait parameter in the analysis step to make the SonarQube Scanner wait until the background task finishes.
Or get the ceTaskUrl from the .scannerwork\report-task.txt file in analysis directory and query the SonarQube API yourself to check if the background task finished.