{"id":18494939,"url":"https://github.com/qaware/sonarqube-build-breaker","last_synced_at":"2025-04-08T22:31:41.079Z","repository":{"id":46624038,"uuid":"199412864","full_name":"qaware/sonarqube-build-breaker","owner":"qaware","description":"Breaks the build if the quality gate of the project is red","archived":false,"fork":false,"pushed_at":"2023-12-05T22:39:17.000Z","size":196,"stargazers_count":17,"open_issues_count":6,"forks_count":11,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-23T19:11:09.745Z","etag":null,"topics":["build","ci","codequality","continuous-integration","gitlab","hacktoberfest","jenkins","quality-gate","sonarqube"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qaware.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-29T08:38:12.000Z","updated_at":"2025-01-02T09:31:27.000Z","dependencies_parsed_at":"2024-11-14T12:45:12.271Z","dependency_job_id":"5f9462ef-fa3a-499f-b048-52898d05d103","html_url":"https://github.com/qaware/sonarqube-build-breaker","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qaware%2Fsonarqube-build-breaker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qaware%2Fsonarqube-build-breaker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qaware%2Fsonarqube-build-breaker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qaware%2Fsonarqube-build-breaker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qaware","download_url":"https://codeload.github.com/qaware/sonarqube-build-breaker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247940396,"owners_count":21021958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build","ci","codequality","continuous-integration","gitlab","hacktoberfest","jenkins","quality-gate","sonarqube"],"created_at":"2024-11-06T13:22:48.102Z","updated_at":"2025-04-08T22:31:38.092Z","avatar_url":"https://github.com/qaware.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SonarQube build breaker\n\n[![Build](https://github.com/qaware/sonarqube-build-breaker/workflows/Java%20CI%20with%20Maven/badge.svg)](https://github.com/qaware/sonarqube-build-breaker/actions?query=workflow%3A%22Java+CI+with+Maven%22)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/de.qaware.tools.sonarqube-build-breaker/sonarqube-build-breaker/badge.svg)](https://maven-badges.herokuapp.com/maven-central/de.qaware.tools.sonarqube-build-breaker/sonarqube-build-breaker)\n\nBreaks the build if the SonarQube quality gate of the project is red.\n\nSee [the blog post I wrote](https://blog.qaware.de/posts/sonar-qube-build-breaker/) for more details.\n\n## Components\n\n* [Maven plugin](sqbb-maven-plugin/) - You can use this to run it in your Maven build.\n* [CLI](cli/) - You can use this to run it in your CI pipeline as standalone application.\n* [Library](library/) - A library which provides the building blocks. You only need this if you want to develop your own build breaker.\n\n# Usage\n\n## Recommended usage in the GitLab pipeline\n\nPut this line directly after the SonarQube analysis:\n\n```\nmvn --batch-mode --update-snapshots --non-recursive de.qaware.tools.sonarqube-build-breaker:sqbb-maven-plugin:sqbb -Dsqbb.sonarQubeUrl=$SONAR_URL -Dsqbb.sonarQubeToken=$SONAR_TOKEN -Dsqbb.branch=$CI_BUILD_REF_NAME\n```\n\nThis line will automatically download the newest SonarQube build breaker and run it.\n\nThe build breaker needs two environment variables set:\n\n* `SONAR_TOKEN`\n* `SONAR_URL`\n\nThese can be configured in the CI/CD settings in the GitLab project configuration.\n\n# Branch analysis\n\nSonarQube supports two modes of branch analysis: \n\nOld versions of SonarQube supported appending the branch to the project key, e.g. if the project key is \n`de.qaware.tools.sonarqube-build-breaker:sonarqube-build-breaker` and you set `-Dsonar.branch=master` when running the analysis,\nthe project for the branch is `de.qaware.tools.sonarqube-build-breaker:sonarqube-build-breaker:master`.\n\nIf you have such projects, this is how you would run the Maven plugin:\n\n```shell script\nmvn --batch-mode --update-snapshots --non-recursive de.qaware.tools.sonarqube-build-breaker:sqbb-maven-plugin:sqbb -Dsqbb.sonarQubeUrl=$SONAR_URL -Dsqbb.sonarQubeToken=$SONAR_TOKEN -Dsqbb.branch=\u003cbranch\u003e -Dsqbb.branchMode=projectKey\n```\n\nand the CLI:\n\n```\njava -jar cli.jar --branch=master --branch-mode=projectKey \u003cyour project key\u003e\n```\n\nIf you use newer versions of SonarQube, the `-Dsonar.branch` is deprecated and no longer works. You can either purchase a license if you want to support the\nSonarQube developers or you can [install this plugin](https://github.com/mc1arke/sonarqube-community-branch-plugin).\n\nThen you can use the `-Dsonar.branch.name` property when running the SonarQube analysis.\n\nIf you have such projects, this is how you would run the Maven plugin:\n\n```shell script\nmvn --batch-mode --update-snapshots --non-recursive de.qaware.tools.sonarqube-build-breaker:sqbb-maven-plugin:sqbb -Dsqbb.sonarQubeUrl=$SONAR_URL -Dsqbb.sonarQubeToken=$SONAR_TOKEN -Dsqbb.branch=\u003cbranch\u003e -Dsqbb.branchMode=sonarQube\n```\n\nand the CLI:\n\n```\njava -jar cli.jar --branch=master --branch-mode=sonarQube \u003cyour project key\u003e\n```\n\n# Changelog\n\nSee [this document](CHANGELOG.md).\n\n# License\n\nLicensed under [MIT](https://opensource.org/licenses/MIT), Copyright (c) 2019 - 2021 QAware GmbH\n\n# Contributors\n\n[See this page](https://github.com/qaware/sonarqube-build-breaker/graphs/contributors).\n\n# Maintainer\n\nMoritz Kammerer (moritz.kammerer@qaware.de | [@phxql](https://github.com/phxql/))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqaware%2Fsonarqube-build-breaker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqaware%2Fsonarqube-build-breaker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqaware%2Fsonarqube-build-breaker/lists"}