SonarQube Scanner failing in master in docker run

We are trying to run Code coverage for PR Branch and master in a Ruby project using docker run, we are successful in running in PR branch but master failing will the following error

Parameter ‘sonar.pullrequest.key’ is mandatory for a pull request analysis

Please let me know how we can run both PR and master code coverage at the same time.

This is how we are running ./build/sonar-cloud

docker run \



 -e PROJECT_VERSION=$(git rev-parse --short=7 HEAD) \


 -e SONAR_PROJECT_BASE_DIR="/home/app" \

 --user="$(id -u):$(id -g)" \

 -v "$(pwd):/home/app" \








# Custom report paths



# Pull Request information





**Jenkins Log**

+ ./build/sonar-cloud

Unable to find image 'sonarsource/sonar-scanner-cli:latest' locally

latest: Pulling from sonarsource/sonar-scanner-cli

804555ee0376: Pulling fs layer

3c9135236624: Pulling fs layer

3c98ba2e08d9: Pulling fs layer

58d36242bf10: Pulling fs layer

492b4d196001: Pulling fs layer

58d36242bf10: Waiting

3c98ba2e08d9: Verifying Checksum

3c98ba2e08d9: Download complete

804555ee0376: Verifying Checksum

804555ee0376: Download complete

492b4d196001: Verifying Checksum

492b4d196001: Download complete

58d36242bf10: Verifying Checksum

58d36242bf10: Download complete

3c9135236624: Verifying Checksum

3c9135236624: Download complete

804555ee0376: Pull complete

3c9135236624: Pull complete

3c98ba2e08d9: Pull complete

58d36242bf10: Pull complete

492b4d196001: Pull complete

Digest: sha256:d57263c689fd3131730916642cd76595e78a174342e72e6a43a340efed49088f

Status: Downloaded newer image for sonarsource/sonar-scanner-cli:latest

INFO: Scanner configuration file: /opt/sonar-scanner/conf/

INFO: Project root configuration file: /home/app/

INFO: SonarQube Scanner

INFO: Java 11.0.3 AdoptOpenJDK (64-bit)

INFO: Linux 4.15.0-1050-gcp amd64

INFO: User cache: /home/app/.sonar/cache

INFO: SonarQube server 8.0.0

INFO: Default locale: "en_US", source code encoding: "US-ASCII" (analysis is platform dependent)

INFO: Load global settings

INFO: Load global settings (done) | time=745ms

INFO: Server id: 1BD809FA-AWHW8ct9-T_TB3XqouNu

INFO: User cache: /home/app/.sonar/cache

INFO: Load/download plugins

INFO: Load plugins index

INFO: Load plugins index (done) | time=173ms

INFO: Load/download plugins (done) | time=26147ms

INFO: Loaded core extensions: developer-scanner

INFO: Process project properties

INFO: Execute project builders

INFO: Execute project builders (done) | time=4ms

INFO: Project key: LiveRamp_company_admin

INFO: Base dir: /home/app

INFO: Working dir: /home/app/.scannerwork

INFO: Load project settings for component key: 'LiveRamp_company_admin'

INFO: Load project settings for component key: 'LiveRamp_company_admin' (done) | time=186ms

INFO: Load project branches

INFO: Load project branches (done) | time=129ms

INFO: Load projects for organization 'liveramp'

INFO: Load projects for organization 'liveramp' (done) | time=20993ms

INFO: Load project pull requests

INFO: Load project pull requests (done) | time=130ms

INFO: Load branch configuration

INFO: ------------------------------------------------------------------------


INFO: ------------------------------------------------------------------------

INFO: Total time: 53.535s

INFO: Final Memory: 6M/27M

INFO: ------------------------------------------------------------------------

ERROR: Error during SonarQube Scanner execution

ERROR: Parameter 'sonar.pullrequest.key' is mandatory for a pull request analysis


ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

Hello @monsam, welcome to the community forum!

When starting an analysis we check if there are any PR related properties, and if there are we start a PR analysis. In your case it seems those PR related properties like sonar.pullrequest.key, sonar.pullrequest.branch or sonar.pullrequest.base are still present when running regular branch analysis on master (eventhough the value is probably empty).

If you do not set those properties when running branch analysis everything should work as expected.

Hope that helps,