sonar QualityGate Should be Checked before SVN Commit-- How to achive this?

212 views Asked by At

QualityGate Should be Checked before SVN Commit

I have to check sonar quality gate before SVN commit, Quality gate should check before code commit into SVN repository only,

Can you suugest any suitable aproach.

1

There are 1 answers

0
David M. Karr On

What you're asking for is not practical, but you can get the same effective result by redesigning your branch and build architecture.

If we were using git, the solution would include the following elements:

When developers first implement changes, they do it on a feature branch and create a "pull request" for that branch. The pull request is reviewed by humans, but when the pull request is created, an automated build starts in the CI server, which also runs the SonarQube scan. The quality gate in SonarQube specifies that particular quality thresholds have to be satisfied. If they are not satisfied, then the scan is marked as failed, and that also causes the pull request build to be marked as failed.

In the central git repository (BitBucket, for instance), the repository can be configured so that pull requests cannot be merged to a target branch if they don't have a successful build.

With these elements, code that does not satisfy the SonarQube quality gates cannot be merged to the target branch.