WebApi call to determine task we're waiting for

We’re using SonarQube 7.9.2.

Our Jenkins builds use the pipeline steps “withSonarQubeEnv” and “waitForQualityGate”, and in between we use “mvn sonar:sonar” to run the scan. At the end of the latter, it prints the task id it’s going to be waiting for in “waitForQualityGate”. It also shows that task id in the results of that step.

What WebApi call(s) can I perform in between “mvn sonar:sonar” and “waitForQualityGate” that will let me store into a variable the task id that is going to be polled for? I know the project key at that point. I’ve inspected all of the environment variables in scope at that point.

I know how to find the WebApi documentation, and I’ve scanned through what I think are the relevant operations, but I can’t figure out which operation I need for this particular “task”.

Welcome to the community forum!

You can watch for the report-task.txt file generated by the scanner, it contains the taskId. You can customise the location of that report-task.txt file by specifying the scanner property sonar.scanner.metadataFilePath. See https://docs.sonarqube.org/7.4/analysis/analysis-parameters/

Thanks, that’s what I needed. I’m going to use the default location of “target/sonar/” for now. I might set the property to that just so it’s explicit, but this code is supposed to be temporary anyway.