Score:0

Jenkins SonarQube Scanner's withSonarQubeEnv and Docker build container

bz flag

I build my app from Jenkins inside a Docker container using a series of commands like docker exec mycontainer /bin/bash -c 'mvn clean install'. I'm also used to the SonarQube plugin to configure the server URL and the authentication token, i.e.

...
withSonarQubeEnv('MySonarQubeServer') {
    script {
        sh "docker exec mycontainer /bin/bash -c 'mvn sonar:sonar'"
    }
}
...

I'm getting

SonarQube server [http://localhost:9000] can not be reached

obviously because the server is not configured inside the container. My question is how Jenkins configures it. At https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-maven/ I found how to set the server URL in the pom.xml and the authentication token on the command line. Is there another way to forward URL and token, for example via environment variables?

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.