Trying to analyse Sonarqube from Drone io in Github PRs

0 votes

I have been trying to run Sonar scans at Github's Pull Requests from

The sequence is mentioned below:

  • PR is made
  • build is triggered
  • Gradle task is executed
  • Gradle's Sonar plugin with Drone's environment is run

This is the command used in Drone's build:

gradle/wrapper all sonarqube \
 -Dsonar.analysis.mode=preview \
 -Dsonar.github.pullRequest=$DRONE_BUILD_NUMBER \

I cannot find the PR ID in the Drone environment.

Can you resolve this query ?


Jun 27, 2018 in Git & GitHub by Atul
• 10,230 points

1 answer to this question.

0 votes

Just try the below steps.The DRONE_PULL_REQUEST environment variable has the pull request number.

You can see a list of all environment variables by dumping them to your build logs. This can be done by adding the env command to your yaml:

    image: golang
      - env # dump environment variables

You will see something like this in your build logs:


Note that the pull request is only set when Drone is building a pull request hook. You can confirm this by looking at the build event environment variable.

I hope the above explanation will be helpful to you.

answered Jun 27, 2018 by shubham
• 7,320 points

Related Questions In Git & GitHub

0 votes
1 answer

How to perform a sonarqube analysis from in github?

DRONE_PULL_REQUEST  env variable holds the pull request ...READ MORE

answered Jul 6, 2018 in Git & GitHub by DareDev
• 6,890 points
0 votes
1 answer

How to share images in GitHub from local system?

Hi@akhtar, You can follow the below steps to ...READ MORE

answered May 7, 2020 in Git & GitHub by MD
• 95,320 points
0 votes
1 answer

How to create branch in GitHub from my local Git repo?

Hi@akhtar, To sync your existing branch in GitHub, ...READ MORE

answered May 7, 2020 in Git & GitHub by MD
• 95,320 points
+1 vote
0 answers

Give full access permission to another user in GitHub

How do I give full access permission ...READ MORE

May 15, 2019 in Git & GitHub by Umer
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
+2 votes
1 answer
–1 vote
1 answer

Having problem in Github and remote Git repo with production and development code

I think you could start with this. The ...READ MORE

answered Apr 10, 2018 in Git & GitHub by shubham
• 7,320 points
0 votes
1 answer