imbi-plugin-sonarqube
SonarQube integration plugin for Imbi (Plugin Architecture v3).
The package ships a single SonarQubePlugin (slug sonarqube), discovered
by the imbi-common registry's imbi_plugin_* convention scan via the
module-level PLUGIN attribute. Its manifest declares:
- a
service_urlintegration-level option (the SonarQube base URL), - an
api_tokencredential (the integration's only credential) holding a SonarQube user token, - one
webhook-actionscapability cataloging theupdate_project_from_webhookaction, - an
analysiscapability (the Project Doctor), and - a
lifecyclecapability that deletes the SonarQube project when the Imbi project is archived or deleted.
When a SonarQube webhook arrives at imbi-gateway and a matching
WebhookRule dispatches to sonarqube#update_project_from_webhook, the
handler:
- Reads the metric→JSONPointer mapping from
WebhookRule.handler_config. - Fetches
/api/measures/componentfrom SonarQube using the Integration's decryptedapi_tokencredential and itsservice_urloption. - Patches the matched Imbi project's facts.
Configuration
Operators create a SonarQube Integration, set its service_url option, and
store the SonarQube API token in the Integration's encrypted credentials.
The api_token must be a user token — created under My Account >
Security in SonarQube and prefixed squ_. SonarQube's analysis tokens,
sqa_ (global) and sqp_ (project), are restricted to the endpoints a
scanner uses and answer 403 to every request this plugin makes, including
/api/measures/component and the Project Doctor's component lookup. The
restriction rides on the token type, so issuing an analysis token from an
administrator account does not help. Grant the token's account Browse on the
projects being read, plus Create Projects if the Project Doctor should create
missing SonarQube projects and Administer on a project whose main branch it
should switch or that the lifecycle capability should delete.
Lifecycle
The lifecycle capability handles two events, archived and deleted, and
does the same thing for both: POST /api/projects/delete with the
EXISTS_IN edge's identifier as the component key, then asks the host to
drop the edge and the sonarqube dashboard link. A project with no edge is
skipped -- the <team-slug>:<project-slug> convention the Doctor falls
back on is a guess, and a delete must not act on one. A project SonarQube
no longer has is also skipped (the edge and
link are still removed); a refused call -- 403 when the token's account
lacks Administer on the project -- is failed and leaves the edge in place.
There is no create hook, and an unarchived project is not re-created: an
analysis or the Project Doctor's repair creates it again.
Any project writer can link any key, so the capability deletes only the
key <owning-team-slug>:<project-slug> of the project. It does not use the
convention to find a key; the edge must name it. Another key is skipped
and not deleted, and the skip is logged. A key that another Imbi project
also links, through any SonarQube Integration of the organization, is
skipped and not deleted.
To keep keys apart, the plugin declares its identifier not shareable, so
the host refuses a manual link to a key that another project holds through
the same Integration. A plugin writeback is refused only by a project whose
edge the plugin verified. Only an admin can change the verified key that a
plugin writeback records. A manual edit changes only the linked key, and
the key check above still applies to it.
Project Doctor
The analysis capability checks three things, offering a fix for the
first two:
- The
EXISTS_INedge — that the component key (<team-slug>:<project-slug>, or the edge's own identifier) exists in SonarQube, and that the edge's canonical URL andsonarqubedashboard link match it. The fix searches for the component, creates it when absent, and writes the edge. - The main branch (
main-branch) — SonarQube reports a project's state from the single branch flaggedisMain, so a repository that moved frommastertomainkeeps syncing measures from an analysis that stopped running. When/api/project_branches/listshows the expected branch and it is not the main branch, the finding fails and the fixPOSTs/api/project_branches/set_main. - The main branch is missing (
main-branch-missing) — when SonarQube has no such branch at all, the finding fails with no fix offered: SonarQube only records a branch once an analysis has run on it, so nothing this plugin can call will create one. Either CI needs to analyze that branch, or the project genuinely uses a different one andmain_branchshould say so.
The expected branch is the capability's main_branch option, defaulting to
main. Set it on the Integration's Project doctor capability for the
org-wide convention; because the host layers capability options
(Integration < project-type USES edge < project USES edge), a project
type or single project whose trunk is named something else can override it
without changing the default.
A typical webhook rule:
Handler: sonarqube#update_project_from_webhook
Filter: payload.branch.isMain == true
Config: [
{"metric": "coverage", "path": "/test_coverage"},
{"metric": "ncloc", "path": "/lines_of_code"}
]
Metadata
Release files for imbi-plugin-sonarqube 2.57.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| imbi_plugin_sonarqube-2.57.0.tar.gz | 26.8 kB | With provenance | Details for imbi_plugin_sonarqube-2.57.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| imbi_plugin_sonarqube-2.57.0-py3-none-any.whl | Python 3 | none | any | Details for imbi_plugin_sonarqube-2.57.0-py3-none-any.whl |
Total release size: 49.0 kB
Release files / imbi_plugin_sonarqube-2.57.0.tar.gz
| Download URL | imbi_plugin_sonarqube-2.57.0.tar.gz |
|---|---|
| Size | 26.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e358df3d2f542d4b0e39258f1113c902f605c259e3292ef7438c6da12e9096d2
|
|
BLAKE2b-256 checksum How to use checksums |
45f82841de12aaee2f84406cb0bec4f0e543d345eb32c91538c076be63a384f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logRelease files / imbi_plugin_sonarqube-2.57.0-py3-none-any.whl
| Download URL | imbi_plugin_sonarqube-2.57.0-py3-none-any.whl |
|---|---|
| Size | 22.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
69543e636b4f9290b9e71075af00a8f652183eced70c945e7001fe80f6134690
|
|
BLAKE2b-256 checksum How to use checksums |
1c975da1564dc14be6172b37898d5d7fbe08986e5de33198e433edd11282ad75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logSecurity for imbi-plugin-sonarqube 2.57.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for imbi_plugin_sonarqube-2.57.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.