Files
arnaud.dartois bc4162a6c8
Build Bifrost / build (push) Failing after 58s
Remove local skills and use the shared catalog (#5)
Co-authored-by: Arnaud Dartois <admin@tordais.cc>
2026-11-18 16:27:01 +01:00

8.0 KiB
Raw Permalink Blame History

Bifrost

Bifrost is a SonarQube Community Build plugin for browsing Gitea organizations and creating linked SonarQube projects.

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.

Other SonarQube versions have not been verified. Bifrost is not listed in the SonarQube Marketplace. SonarQube Cloud analysis is not configured.

What it does

From the Import from Gitea page, a user can:

  • 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.

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 organization_repository, 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.

Requirements

  • 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. Build the plugin or download a JAR from a Gitea release, when one is available.
  2. Copy the JAR from target to $SONARQUBE_HOME/extensions/plugins/.
  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.
Property Description
Gitea URL (sonar.bifrost.giteaUrl) Base URL of the Gitea server, for example https://git.example.com. Do not append /api/v1.
Gitea token (sonar.bifrost.giteaToken.secured) Server-side token used to read Gitea organization and repository metadata.
Organization selection mode (sonar.bifrost.organizationMode) fixed lists the configured allowlist; all lists organizations visible to the token. The allowlist still filters organizations in all mode.
Allowed organizations (sonar.bifrost.allowedOrganizations) Organization allowlist. Required in fixed mode; optional in all mode.
Include personal repositories (sonar.bifrost.includePersonalRepositories) Also list repositories owned by the Gitea token account.

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.

Build and test

The Maven Wrapper downloads the pinned Maven 3.9.9 distribution and verifies its checksum. The first build needs network access to Maven Central.

Build the plugin and run its unit tests:

./mvnw -B verify

The JAR is written to target/sonar-bifrost-plugin-<version>.jar. To calculate the Git-based development version and render the README version marker before packaging, use:

make build

Run only the unit tests with:

make test

A Docker build can export the JAR without a local Java or Maven installation:

docker build --build-arg REVISION="$(sh scripts/version.sh)" --target export --output type=local,dest=dist .

Pass --build-arg REVISION=1.2.3 to choose a version explicitly. The Docker context excludes Git metadata, so pass the version from the host.

End-to-end test

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.

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

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.

Version bumps follow Conventional Commits:

  • 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.

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 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.

Changelog

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.

Validate the changelog with:

sh scripts/check-changelog.sh

Agent guidance

This repository has no local agent-skill copies. Shared agent guidance is installed from the user's global catalog; keep this README, workflows, and scripts as the source for Bifrost-specific build and acceptance facts.

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.