Getting analysisid from sonarqube scanning inside a docker

Hello

I’m running sonarqube scanning inside a docker container through dockerfile and building the container in Jenkins pipeline. It’s not done through Sonarqube plugin.

  1. How do I get the analysisid to retrieve quality gates results once the scanning is complete?

  2. Where is the report-task.txt located in the docker container? I’m trying to copy the report-task.txt file from docker to Jenkins through docker cp so that I can read the analysisid from the file to call the api/project_status?analysisid=

Below is the code in dockerfile

RUN dotnet sonarscanner begin /k:"{SONARQUBE_PROJECTKEY}" /d:sonar.host.url="<servername>" /d:sonar.login="{SONARQUBE_TOKEN}" /version:"${SONARQUBE_ANAYISIS_VERSION}"

RUN dotnet build --no-restore -c $BUILD_CONFIGURATION

RUN dotnet sonarscanner end /d:sonar.login="${SONARQUBE_TOKEN}"

Thanks for the help.

Hi Ponna and welcome to the community!

First of all, a reminder to share some must-have information so that the community may be able to help you:

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

Secondly, I would be interested to know why you cannot or don’t use the SonarQube plugin for Jenkins? This already implements the “waitForQualityGate” logic, which would save you quite some headaches.

Cheers,
Daniel