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

0 votes

I am running sonar scans on github's pull requests from drone.io. This is the procedure I am following:

  1. PR is made
  2. Drone.io build is triggered
  3. Gradle task is executed
  4. Gradle's Sonar plugin with Drone's environment is run

The command I use in drone build:

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

I am unable to find the PR ID in the drone environment. Is there any other way I can find it?

Jul 6, 2018 in Git & GitHub by Damon Salvatore
• 5,250 points
258 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

DRONE_PULL_REQUEST  env variable holds the pull request number(Check This). You can access all the environment variables through your build logs. You can do this by adding env command in your yaml file:

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

Your build logs after execution:

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

Pull request is only set if drone is building a pull request hook.

answered Jul 6, 2018 by DareDev
• 6,520 points

Related Questions In Git & GitHub

0 votes
1 answer

Trying to analyse Sonarqube from Drone.io in Github PRs

Just try the below steps.The DRONE_PULL_REQUEST environment variable has ...READ MORE

answered Jun 27, 2018 in Git & GitHub by shubham
• 6,480 points
133 views
0 votes
1 answer

How to give a file execute mode permissions in Git?

You can easily do this in one ...READ MORE

answered Aug 6, 2018 in Git & GitHub by Sophie may
• 9,050 points
67 views
0 votes
1 answer

How to add a remote git repository in Jenkins

Follow these steps: Step 1 Go to Manage ...READ MORE

answered 11 hours ago in Git & GitHub by Alok
3 views
0 votes
1 answer
0 votes
1 answer

How to view the nested workflow of a local git repository?

The ‘git log’ command is your closest ...READ MORE

answered Jul 4, 2018 in Git & GitHub by Sophie may
• 9,050 points
38 views
+13 votes
2 answers
0 votes
1 answer
0 votes
1 answer

How to do a re-merge into another branch in git

Seems like you want to rebase your ...READ MORE

answered May 7, 2018 in Git & GitHub by DareDev
• 6,520 points
60 views

© 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.