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,510 points
477 views

1 answer to this question.

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,810 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,890 points
213 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,870 points
291 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 May 23 in Git & GitHub by Alok
97 views
0 votes
1 answer
0 votes
2 answers

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

The closest way to view branches in ...READ MORE

answered Aug 2 in Git & GitHub by Sirajul
• 38,420 points
88 views
+13 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 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
215 views
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,810 points
183 views