Proof of concept plugin that lists Gitea repositories and creates SonarQube Community Build projects for selected repositories.
Bifrost is a SonarQube Community Build plugin for browsing Gitea organizations and creating linked SonarQube projects.
## Target and status
It creates project records and Gitea links. It does **not** clone repository contents, configure a scanner, or run an analysis. Users continue to analyze source code with their normal SonarScanner workflow.
-SonarQube Community Build: `25.9.0.112764` (tested by loading the plugin in the exact Community Build image).
-Sonar plugin API: `13.0.0.3026`.
-Java: 17.
-Artifact: `sonar-bifrost-plugin-<version>.jar`.
-Generated build version: `@PLUGIN_VERSION@`.
-Maven is used because SonarSource publishes the supported plugin packaging extension for Maven.
-**License:** MIT ([LICENSE](LICENSE))
-**Project and source:** [sources.tordais.cc/arnaud.dartois/Bifrost](https://sources.tordais.cc/arnaud.dartois/Bifrost)
-**Tested platform:** SonarQube Community Build 25.9.0.112764
-**Plugin API:** 13.0.0.3026
-**Build target:** Java 17
- **Build version:** <code>@PLUGIN_VERSION@</code> (rendered by <code>make build</code>)
The Docker build completed with Java 17, all eight unit tests passed, and the exported JAR manifest contains the expected plugin metadata. The exact 25.9.0.112764 Community Build loaded the plugin, reported `UP`, and served the page bundle with HTTP 200. On 2026-10-29, `./scripts/e2e.ps1` passed from fresh named volumes: Chromium created two Gitea organizations and four repositories, imported all four through the extension, and verified all four SonarQube projects and Gitea links.
Other SonarQube versions have not been verified. Bifrost is not listed in the SonarQube Marketplace. SonarQube Cloud analysis is not configured.
## Tree
## What it does
```text
.
├── .claude/skills/ # Twelve project skills
├── .gitea/workflows/build.yml # Gitea Actions CI and release pipeline
├── .mvn/wrapper/ # Maven distribution pin
├── scripts/ # Version, changelog, and release helpers
- Browse organizations from the configured selection policy: a fixed allowlist or organizations accessible to the Gitea token.
- Optionally include repositories owned by the token account.
- See each repository’s default branch, Gitea URL, and whether a matching SonarQube project already exists.
- Select repositories and create SonarQube projects with links back to Gitea.
The launcher bootstraps the pinned Maven 3.9.9 distribution and verifies its SHA-512 checksum. It requires network access to Maven Central on first use.
Bifrost validates the selected organizations and repositories again on the server before creating projects. Imports are limited to 100 repositories per request. Project keys are derived from <code>organization_repository</code>, lowercased, and sanitized; selections that produce colliding keys are rejected. Each repository gets an individual result, so a project may be created even if adding its Gitea link fails.
```sh
make build
```
## Requirements
On Windows, run `mvnw.cmd -B -Drevision=1.2.3 verify`. To force a version manually, pass `-Drevision=1.2.3` to Maven.
## Docker build
Docker builds the plugin using a pinned Maven/JDK image and exports the JAR without a local JDK or Maven installation:
Pass a version with `--build-arg REVISION=1.2.3`. The Docker context excludes Git metadata, so pass the output of `scripts/version.sh` from the host to preserve tag-based versions. A direct Docker build without `REVISION` uses the no-Git fallback.
- SonarQube Community Build 25.9.0.112764 is the version tested for this plugin.
- The SonarQube server must be able to reach the configured Gitea instance over HTTP or HTTPS.
- The Gitea token must be able to read the organizations and repositories you want to list. Enabling personal repositories also uses the token account’s user and repository endpoints.
- Each SonarQube user importing projects needs the global **Create Projects** permission. Administrators can also use the page.
## Install and configure
1.Copy the JAR to `<sonarqubeHome>/extensions/plugins/` and restart SonarQube. In Docker, mount it at `/opt/sonarqube/extensions/plugins/`.
2.In Administration > Configuration, set Gitea URL and token, selection mode, allowed organizations, and the personal repositories option.
3.Grant the user the global Create Projects permission.
4.Open Import from Gitea, select organizations or All, select repositories, then choose Import.
1.Build the plugin or download a JAR from a Gitea release, when one is available.
2.Copy the JAR from <code>target</code> to <code>$SONARQUBE_HOME/extensions/plugins/</code>.
3.Restart SonarQube.
4.In **Administration → Configuration**, configure the properties below.
5. Grant the importing users the global **Create Projects** permission, then open **Import from Gitea**.
The token is held only by the plugin server. The plugin checks the caller's Create Projects permission, revalidates each selected organization and repository, then calls SonarQube's public project and project-link Web APIs through `Request.localConnector()`.
| Property | Description |
| --- | --- |
| **Gitea URL** (<code>sonar.bifrost.giteaUrl</code>) | Base URL of the Gitea server, for example <code>https://git.example.com</code>. Do not append <code>/api/v1</code>. |
| **Gitea token** (<code>sonar.bifrost.giteaToken.secured</code>) | Server-side token used to read Gitea organization and repository metadata. |
| **Organization selection mode** (<code>sonar.bifrost.organizationMode</code>) | <code>fixed</code> lists the configured allowlist; <code>all</code> lists organizations visible to the token. The allowlist still filters organizations in <code>all</code> mode. |
| **Allowed organizations** (<code>sonar.bifrost.allowedOrganizations</code>) | Organization allowlist. Required in <code>fixed</code> mode; optional in <code>all</code> mode. |
| **Include personal repositories** (<code>sonar.bifrost.includePersonalRepositories</code>) | Also list repositories owned by the Gitea token account. |
## Test scenario
The Gitea token is stored as a secured SonarQube setting and used only by the server. Browser requests go to Bifrost’s SonarQube web-service endpoints; the token is not sent to the browser.
Run the complete fresh-stack validation from PowerShell:
## Build and test
```powershell
./scripts/e2e.ps1
```
The Maven Wrapper downloads the pinned Maven 3.9.9 distribution and verifies its checksum. The first build needs network access to Maven Central.
This builds the current plugin JAR, removes only the dedicated `bifrost-e2e` Compose project's volumes, starts the pinned PostgreSQL, Gitea, and SonarQube images, creates a test Gitea administrator, and runs Chromium through the plugin page. The browser test creates organizations `alpha-lab` and `beta-lab`, with `api` and `web` repositories in each, configures SonarQube through its Web API, verifies selection retention, imports the four repositories, and checks each project key and Gitea link.
Build the plugin and run its unit tests:
Expected project keys are `alpha-lab_api`, `alpha-lab_web`, `beta-lab_api`, and `beta-lab_web`. The test leaves the isolated stack running for inspection at `http://localhost:9000` and `http://localhost:3000`. Credentials are test-only defaults and must never be reused outside this disposable stack. Playwright HTML report, traces, and screenshots are written under `target/e2e-results/`.
./mvnw -B verify
Remove only the E2E project and its volumes when finished:
The JAR is written to <code>target/sonar-bifrost-plugin-<version>.jar</code>. To calculate the Git-based development version and render the README version marker before packaging, use:
Git tags `vMAJOR.MINOR.PATCH` are the release source of truth. Commit subjects follow Conventional Commits. `feat:` requests a minor release, `fix:`, `perf:`, and `refactor:` request a patch, and `!` or a `BREAKING CHANGE:` footer requests a major release. Other types do not request a release.
make test
Examples:
A Docker build can export the JAR without a local Java or Maven installation:
- At tag `v1.2.3`: `scripts/version.sh` returns `1.2.3`.
- After two commits since `v1.2.3`, without a release-triggering change: it returns `1.2.3-SNAPSHOT.2+<short-sha>`.
- With no tags: it returns `0.1.0-SNAPSHOT.<commit-count>+<short-sha>`.
- To force a local version: `sh ./mvnw -Drevision=2.0.0-SNAPSHOT package`.
If the workflow pushes a tag but release publication fails, inspect the tag and changelog commit first. Re-run the release API request for the existing tag after confirming there is no existing release. Do not force-move a published tag. If the tag itself points to the wrong commit, coordinate a deliberate corrective tag/release; do not silently rewrite it.
Pass <code>--build-arg REVISION=1.2.3</code> to choose a version explicitly. The Docker context excludes Git metadata, so pass the version from the host.
## Changelog
## End-to-end test
`CHANGELOG.md` follows Keep a Changelog 1.1.0. The intended mapping is `feat:` to Added; `fix:` to Fixed; `perf:` and `refactor:` to Changed; `deprecate:` to Deprecated; `revert:` to Removed; `security:` to Security. Breaking changes are prefixed with **BREAKING:**. `docs:`, `chore:`, `ci:`, `test:`, and `style:` are excluded.
The end-to-end test starts an isolated Gitea, PostgreSQL, and SonarQube stack, installs the built plugin, then uses Chromium to create test organizations and repositories and import them through the UI.
Edit the `[Unreleased]` entries by hand before release when generated wording needs correction. `sh scripts/changelog.sh X.Y.Z` transfers curated entries or generates entries from Conventional Commits, then updates comparison links using `GITEA_REPOSITORY_URL`. `sh scripts/check-changelog.sh` validates headings, categories, dates, order, and comparison links.
On Linux with Docker:
make e2e
On Windows with Git for Windows Bash and Docker Desktop or Rancher Desktop:
./scripts/e2e.ps1
The test resets only the Compose project named bifrost-e2e and its volumes. It uses disposable local credentials; do not reuse them elsewhere. The stack remains available at http://localhost:3000 (Gitea) and http://localhost:9000 (SonarQube) after a successful run. Playwright reports and traces are written under target/e2e-results/.
Remove the test stack and its data when finished:
docker compose --project-name bifrost-e2e down --volumes --remove-orphans
## CI and releases
The Gitea Actions workflow checks out full history/tags, installs Java 17, calculates a version, validates changelog formatting on pull requests, and runs Maven verification. A push to `main` (normally a merged PR) creates a changelog release commit, version tag, and Gitea release with the built JAR attached. Conventional Commit types select major, minor, or patch bumps; other commit types default to a patch so every merge produces a new release. The release commit is excluded from triggering another release.
Gitea Actions runs Maven verification on pushes and pull requests. Pushes to main also build a release version, update CHANGELOG.md, create a vMAJOR.MINOR.PATCH tag and Gitea release, and attach the plugin JAR. The release commit is excluded from starting another release.
Configure the repository secret `RELEASE_TOKEN`. The workflow derives the Gitea API and repository URLs from `github.server_url` and `github.repository`, so no `GITEA_*` repository variables are needed. The token needs repository write access to push the changelog commit/tag and create a release with an asset. For protected branches, allow this token identity to push the release commit to `main`, or use a dedicated release branch and adjust `GITEA_MAIN_BRANCH`. Actions use GitHub-hosted sources (`actions/checkout`, `actions/setup-java`); an isolated act_runner may need those repositories mirrored or outbound GitHub access.
Version bumps follow Conventional Commits:
## Skills
- Breaking changes (!) or a BREAKING CHANGE: footer request a major bump.
- feat: requests a minor bump.
- fix:, perf:, and refactor: request a patch bump.
- Other commit types default to a patch bump so a push to main still produces a release.
The `.claude/skills/<name>/SKILL.md` files are project instructions:
Configure the repository secret RELEASE_TOKEN. It needs repository write access and user read access because the release script looks up the token owner for Git authentication. If main is protected, allow that account to push the release commit and tag. Without that branch permission the build can pass but release publication will fail. The workflow derives the Gitea API and repository URLs from the Actions context, so no GITEA_* repository variables are needed. The runner also needs outbound access to fetch the pinned Actions and Java distribution.
-`sonarqube-plugin-development`: entry point, extension lifecycle, manifest, and public API constraints.
-`sonarqube-frontend-extension`: page API, UI, bundle, and accessibility.
-`java-best-practices`: Java 17 boundaries, immutability, resource handling, and errors.
-`java-testing`: deterministic unit tests and HTTP mocking.
-`gitea-api-client`: Gitea paths, tokens, pagination, timeouts, and status mapping.
-`secure-coding-plugin`: URL/input validation, permissions, secrets, CSRF, and dependencies.
-`maven-build-packaging`: pinned Maven build and plugin JAR packaging.
-`release-versioning-changelog`: tag bumps, changelog structure, and release flow.
-`gitea-actions-ci`: act_runner constraints and release workflow.
-`docker-test-environment`: pinned SonarQube, PostgreSQL, Gitea, and plugin mount.
-`local-e2e-validation`: fresh-stack provisioning, browser import, project/link assertions, and safe cleanup.
-`project-workflow`: language, evidence, implementation order, and definition of done.
SonarQube Cloud analysis and a green quality gate are not configured yet. The Marketplace submission process also requires a SonarQube Cloud project and a reviewed metadata change in [SonarSource’s update-center repository](https://github.com/SonarSource/sonar-update-center-properties).
When the SonarQube target changes, update version-sensitive skill claims only after checking official SonarSource docs and target source/artifact metadata. Then update API/compiler/manifest pins, rebuild and inspect the JAR, and rerun each checklist. Skills are guidance, not a substitute for version-specific verification.
## Changelog
## Troubleshooting
CHANGELOG.md follows Keep a Changelog. Update the Unreleased section as changes are made. Before a release, review its wording; the release script moves it into the versioned section and updates comparison links.
- **Plugin rejected at startup:** verify the JAR manifest `Plugin-Key`, `Plugin-Version`, and `Sonar-Version` against the target API, then inspect `web.log`.
- **No organizations appear:** check the Gitea URL from the SonarQube container, token permissions, organization allowlist, and Gitea logs.
- **401 or 403 from Gitea:** replace the token or grant read access to the relevant organization repositories.
- **Import denied:** grant the current SonarQube user Create Projects.
- **Project exists:** choose a different source repository or remove the existing project; the plugin does not overwrite projects.
- **Sanitized key collision:** rename one repository or organization so their sanitized combined keys differ.
- **SonarQube does not start in Docker:** check available memory and the host's `vm.max_map_count` requirement for the bundled search engine.
Validate the changelog with:
## Limitations and risks
sh scripts/check-changelog.sh
- The official plugin API compatibility table omits Community Build 25.9. `13.0.0.3026` was inferred from target server dependency metadata and adjacent releases; the plugin has now built and loaded successfully on the exact 25.9.0.112764 image.
- The manifest `Sonar-Version` denotes the minimum plugin API version. The separate `sonar.minimumVersion` property records the target product release because the documented manifest field does not encode a SonarQube product version.
-The UTF-8 plugin display name is set to ASCII `Bifrost` because manifest encoding has not yet been confirmed by inspecting a built JAR.
-The `/api/bifrost/import` action creates projects and their Gitea links through the public `LocalConnector`. The full authenticated project and link creation flow passed on the target local stack. A separate non-admin Create Projects account and role matrix were not included in this proof of concept.
-Existing-project detection uses `api/components/show` through the public `LocalConnector` for each repository. Projects the user cannot browse may return a permission error; the importer stops that organization list rather than guessing that those projects are missing.
- Create Projects permission is checked against `api/users/current` through `LocalConnector`. The test administrator passed the permission check; denial behavior for a user without Create Projects was not tested end to end.
- The global page menu is not conditionally hidden by Create Projects permission because the public page API documents only administrator gating. Every data and import web service checks Create Projects; the project and link Web APIs apply their own permissions. Menu hiding is a UI limitation.
-The Gitea token scope and response fields may vary by Gitea version. The local Compose default is Gitea 1.23.8; no external instance was supplied.
- The Maven launcher is a small pinned-distribution bootstrap, not the upstream Maven Wrapper JAR implementation. It requires network access for initial Maven download; the Docker build used Maven directly.
- Release scripts and workflow are scaffolding and have not been exercised against a real Gitea runner or protected branch.
- The Linux shell runner `scripts/e2e.sh` was not exercised on this Windows host. The verified native runner is `./scripts/e2e.ps1`.
## Known limitations
-Compatibility has been verified on Community Build 25.9.0.112764; other versions are unverified.
-Bifrost provisions SonarQube projects but does not import source code or start analysis.
-The end-to-end scenario uses an administrator account. A separate non-admin permission matrix has not been tested.
- Projects hidden from the current user may affect existing-project detection.
- The Gitea release job requires its token account to be permitted to push to protected main.
-No SonarQube Cloud project or Marketplace listing is configured.
For bugs or feature requests, use the [public issue tracker](https://sources.tordais.cc/arnaud.dartois/Bifrost/issues).
<configuration><pluginKey>bifrost</pluginKey><pluginName>Bifrost (Gitea Import)</pluginName><pluginClass>cc.tordais.sonar.bifrost.BifrostPlugin</pluginClass><pluginDescription>Import Gitea repositories as SonarQube projects.</pluginDescription><pluginUrl>http://localhost:3000/owner/bifrost</pluginUrl></configuration>
<configuration><pluginKey>bifrost</pluginKey><pluginName>Bifrost (Gitea Import)</pluginName><pluginClass>cc.tordais.sonar.bifrost.BifrostPlugin</pluginClass><pluginDescription>Browse Gitea repositories and create linked SonarQube projects. Bifrost does not clone or analyze source code.</pluginDescription><pluginUrl>${project.url}</pluginUrl><pluginIssueTrackerUrl>${project.issueManagement.url}</pluginIssueTrackerUrl><pluginSourcesUrl>${project.scm.url}</pluginSourcesUrl></configuration>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.