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 Drone.io.

The sequence is mentioned below:

  • PR is made
  • Drone.io 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 \
 -Dsonar.github.oauth=<github_token>

I cannot find the PR ID in the Drone environment.

Can you resolve this query ?

Thanks.

Jun 27, 2018 in Git & GitHub by Atul
• 10,170 points
130 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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:

pipeline:
  build:
    image: golang
    commands:
      - env # dump environment variables

You will see something like this in your build logs:

...
DRONE_PULL_REQUEST=42
DRONE_BUILD_EVENT=pull_request
...

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
• 6,480 points

Related Questions In Git & GitHub

0 votes
1 answer

How to perform a sonarqube analysis from drone.io in github?

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

answered Jul 6, 2018 in Git & GitHub by DareDev
• 6,520 points
252 views
+1 vote
0 answers

Give full access permission to another user in GitHub

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

4 days ago in Git & GitHub by Umer
19 views
0 votes
2 answers

Trying to change the password in gitlab's active directory

I think gitlab does not have write ...READ MORE

answered 2 days ago in Git & GitHub by Umer
14 views
0 votes
1 answer

meaning of check-in code in github

It simply means to upload code to ...READ MORE

answered Apr 29, 2018 in Git & GitHub by ajs3033
• 7,000 points
62 views
+13 votes
2 answers
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.