Sonarqube badge not working on github README - github

Recently I wanted to add badges to an enterprise GitHub repository I order to have an overview of the Sonarqube statuses like coverage or quality gate.
The issue is that the badges generated by the Sonarqube server(I am using a Sonarqbe server not Sonarcloud) do not show the image when added to the GitHub repository.
I tried using the api from Sonarqube but there isn't any call that helped.
Do you have any idea which I can try to make the images visible from a Sonarqube server to a repository from GitHub enterprise?

FYI - This feature is now available with SonarQube 9.2 version.
From there official documentation.
Badges for private projects and other long-awaited features
SonarQube 9.2 includes a number of long-awaited features to help you better integrate SonarQube into your organization. First, with this version we've finally been able to deliver badges for private projects. Next, is the new functionality to delegate administration of a single Quality Gate. Previously, administrators could delegate permissions for all Quality Gates; now they can be more selective. Speaking of delegation, delegating authentication to Bitbucket Cloud is now built in.

Apparently the issue was that for the badges we were using the URL with http instead of https and that's why the badges images weren't displayed. After we changed the URL to https we got the badges images to be displayed.

To get the SonarQube Badges in the readme.md are two configuration settings important.
"Force user authentication" in Administration -> Configuration -> General settings -> Security, has to be set to false
The SonarQube project has to be public
(tested on SonarQube version 8.9 LTS)

Related

Disable "commit mention ..." settings for Git repo by default

For every repository there are two "commit mention" settings enabled by default.
Is there a way to disable one of these or both by default (per project or even org) when a new repo is created?
I did not find any project or org setting in the web ui. Can this maybe done using some rest api?
Thank you
Instead of manually changing these options you can use the very same API as the WebUI does:
Endpoint:
https://dev.azure.com/{ORG}/{PROJECT-ID}/_api/_versioncontrol/UpdateRepositoryOption?__v=5&repositoryId={REPO-ID}
Request Type:
POST
Payload:
{"key":"WitResolutionMentionsEnabled","value": <true|false>}
Project ID and REPO ID (hash values) can be extracted either using the Developer Tools in your browser or using the Python API Wrapper.
I searched and tried with the related REST API (Repositories - Update) and Azure CLI (az repos), but did not find any available interface can change two option on repository settings.
Looks like, currently we have no available method to change the options of repository settings in batches. You may need to manually change these options.
If your projects really need this feature, I recommend that you can report a feature request on Developer Community. That will allow you to directly interact with the appropriate product team, and make it more convenient for the product team to collect and categorize your suggestions.

sonarqube github project analysis

I have a repository in my github account and i want to analyse it with sonarqube after each commit
I put the repository url in my sonar scanner properties :
sonar.sources=https://github.com/rahma/JavaTest but does not work .
any idea about this please ?
Depending on the nature (confidential or public) of your project, you could use a GitHub Actions like SonarSource/sonarcloud-github-action
That way, on each push, you would scan your code with SonarCloud.io.
But if you have a local SonarQube instance running, then you need the Developer edition, and check if your GitHub credentials are correct.

How do I disable a Github check for Google Cloud Build

I've installed the Google Cloud Build app from Github Marketplace, and enabled it on several repositories, only to discover that enabling access for those repositories automatically starts running the Google Cloud Build "check" after every PR or push to a PR. Since some of those repositories are not actually ready for Google Cloud build, I needed to turn off the checks... I used the URL mentioned in the docs to get to the page where you can select which repositories should be connected to your GCP project, and unchecked a bunch of them... this disconnected them from the project, but, surprisingly, did not disable the Github checks! So now, there are Github checks on several repositories that just result in an error because they're not connected to any projects in Cloud Build.
Surely, it is not an uncommon use case to need a way to "disable Checks" on a per-repository basis - is there any way to do that?
(If not, consider it a requested feature if there are any Google Engineers reading!) ;)
I did talk to chat support, and the only way we could figure out to remove the checks would be to uninstall Google Cloud Build completely from the entire organization, which I don't want to do because we do have some setup that I want to keep, and I don't know how much of that configuration would have to be redone if I uninstalled it completely.
Here is a screenshot of the broken check that I can't disable:
I think there are 2 steps to disable CloudBuild,
1. Disable on CloudBuild itself. For some time I kept seeing 2 builds per push made, but disabling a trigger on CloudBuild helped fix that.
2. On Github, you can configure the Cloudbuild app to monitor a specific repo on the organization level setting.
3. If you feel a lot adventurous though and it's not solved, on the project level setting, you could delete the Webhooks integration for cloudbuild, as that's what Github notifies of each build.
It can be found within GH App installations:
https://console.cloud.google.com/gcb-github-registration
Select the GH account used for your link between Cloud Build and GH, then the GCP project you want to edit.
Here connected repositories can be edited, and in the second step (Trigger settings), the "Default GitHub Checks" can be disabled.
You can also goto settings of your repository and click installations inside settings.
And then remove Google cloud build from Installed apps and authorized github apps.
Cloud Build Triggers are still in beta, and have gone through several updates since this question was posted, but it now appears that the "Github Default Checks" are no longer hidden from management. They are now explicitly offered (but not automatically created) when connecting a repo, and you can finally view and disable (or delete) individual "Github Default Checks" on the trigger management page: https://console.cloud.google.com/cloud-build/triggers
I'll leave this as unanswered, because I'm uncertain this is how it is working for everyone, or that this answer will remain true, but if it works for you, feel free to vote up the answer!
To link GCP Project to the Github repository, create a trigger by clicking on resolve link, besides Action Required and then disable the same. For me this procedure worked out.

How to prevent the pull request integration for SonarQube to report issues as inline comments on Githuib?

I configured SonarQube analysis to report it's status to pull requests on my GitHub project. SonarCloud already supports pull requests as first class citizen as described in https://blog.sonarsource.com/sonarcloud-loves-your-build-pipeline. As I understand, this kind of integration is not using the GitHub Plugin for SonarQube.
The configuration provides these properties (look here for the complete configuration)
sonar.pullrequest.provider
sonar.pullrequest.github.repository
sonar.pullrequest.branch
sonar.pullrequest.key
The credentials for the technical user are set in the SonarCloud project administration.
You can see the results here: https://github.com/BudgetFreak/BudgetFreak/pull/86#pullrequestreview-125364230
Every issue is reported as an inline comment, one summary comment is made and the status is reported for the code-quality/sonarqube check.
I would like to disable the inline comment on every issue. This was possible using the GitHub plugin. Can this also be achieved with the new pull request integration?
Unfortunately, on SonarCloud, this feature is not available.

Is it possible to use git hub login for local sonar application?

Is it possible to use git hub login for sonar application?
Just like Jenkins can be configured.
if possible please provide steps to configure.
A SonarQube GitHub Authentication Plugin has been created since the accepted answer was written.
For SONAR you need not connect with GITHUB directly, use jenkins to get the latest code to your agent and in the smae job invoke your sonar analysis - either using runner or maven goals, it should work fine
There is currently no plugin allowing the delegation of authentication to GitHub