Compare commits

...
6 Commits
Author SHA1 Message Date
arnaud.dartois 93cf99b523 Merge remote-tracking branch 'origin/main' into skills-centralize-bifrost
Build Bifrost / build (push) Successful in 2m25s
Build Bifrost / build (pull_request) Successful in 1m46s
# Conflicts:
#	.claude/skills/gitea-actions-ci/SKILL.md
#	.claude/skills/release-versioning-changelog/SKILL.md
#	README.md
2026-11-17 09:52:18 +01:00
arnaud.dartois ba47246a03 docs(changelog): record shared skill migration (#4) 2026-11-17 09:13:25 +01:00
arnaud.dartois 890c939b80 docs: remove project-local skills 2026-11-16 21:01:47 +01:00
arnaud.dartois c9bb94bbc0 docs: add MIT license and rewrite README (#3)
Build Bifrost / build (push) Failing after 1m50s
## Summary
- Add the MIT license and public repository, source, and issue tracker metadata.
- Rewrite the README as a user and contributor guide covering installation, configuration, builds, end-to-end testing, CI, releases, and known limitations.
- Clarify that Bifrost creates linked SonarQube projects but does not clone or analyze source code.

SonarQube Cloud analysis is intentionally not included yet.

## Validation
- `./mvnw -B verify` passed (8 tests).
- `make build`, changelog validation, shell syntax check, manifest metadata check, and `git diff --check` passed.

Reviewed-on: #3
Co-authored-by: Arnaud Dartois <admin@tordais.cc>
2026-11-06 11:59:21 +01:00
arnaud.dartois 5e3a73ea42 fix(ci): publish releases from main pushes (#2)
Build Bifrost / build (push) Failing after 28s
Co-authored-by: Arnaud Dartois <admin@tordais.cc>
2026-11-06 09:08:31 +01:00
arnaud.dartois 88a344efcb ci: publish release on merged pull requests (#1)
Build Bifrost / build (push) Successful in 33s
## Summary
- Publish a versioned Gitea release with the plugin JAR whenever a PR is merged into main.
- Derive Gitea API and repository URLs from the Actions context, so no reserved GITEA_* repository variables are required.

## Validation
- `./mvnw -B verify` passed locally (8 tests).
- `git diff --check` passed.

Reviewed-on: #1
Co-authored-by: Arnaud Dartois <admin@tordais.cc>
2026-11-06 08:43:14 +01:00
19 changed files with 145 additions and 507 deletions

No files matched your search

@@ -1,35 +0,0 @@
---
name: docker-test-environment
description: Use when changing Bifrost's local Docker build, disposable SonarQube/Gitea/PostgreSQL stack, or plugin mounting.
---
# Docker test environment
- Follow common `disposable-test-environment` and `devops-engineering` for isolation, synthetic data, secret handling, and exact cleanup verification. This skill defines Bifrost's service graph and plugin-specific acceptance recipe.
- Pin SonarQube Community Build to `25.9.0.112764-community`; pin PostgreSQL and Gitea image tags. Provide health checks, start dependencies before SonarQube, and persist database data in named volumes.
- Mount the built plugin JAR read-only into `/opt/sonarqube/extensions/plugins/` and restart SonarQube after packaging. Keep the Compose test stack isolated from production volumes and endpoints.
- Use test-only credentials from environment variables; never commit live tokens. Document Linux Docker host kernel prerequisites, including `vm.max_map_count` when required by the bundled search engine.
- Run full import tests under dedicated Compose project `bifrost-e2e` and its named volumes. A reset may remove only that project's volumes. On Windows use `./scripts/e2e.ps1`, which invokes the native Windows Docker CLI rather than WSL Docker.
- Pin the browser runner image and Playwright npm dependency to the same release; retain `package-lock.json` and install with `npm ci`.
- Bootstrap Gitea through its CLI and documented API; configure SonarQube through documented Web APIs, then run a real Chromium page test.
- The successful isolated stack is intentionally left available for inspection after a pass; document the exact dedicated-project command that removes it. On failure retain the stack and Playwright diagnostics as specified in `local-e2e-validation`.
## Checklist
- [ ] All service image tags pinned.
- [ ] Health checks and durable named DB volumes present.
- [ ] Test plugin mount path correct.
- [ ] Setup and credentials documented safely.
- [x] Zero-to-import runner resets only its isolated project, checks readiness, and asserts created projects and links.
- [ ] Browser version and npm package are pinned together with a lockfile.
## Sources
- SonarQube Docker setup: https://docs.sonarsource.com/sonarqube-community-build/server-update-and-maintenance/update/update (consulted 2026-10-28)
- SonarQube Docker image tags: https://hub.docker.com/_/sonarqube (consulted 2026-10-28)
- Docker Compose specification: https://docs.docker.com/compose/compose-file/ (consulted 2026-10-28)
- Playwright Docker: https://playwright.dev/docs/docker (consulted 2026-10-29)
- Gitea administration CLI: https://docs.gitea.com/administration/command-line/ (consulted 2026-10-29)
- Gitea 1.23 token creation: https://docs.gitea.com/api/1.23/operations/user-create-token/ (consulted 2026-10-29)
- Gitea 1.23 organization repository creation: https://docs.gitea.com/api/1.23/operations/create-org-repo/ (consulted 2026-10-29)
- SonarQube page extension: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/developing-a-plugin/adding-pages-to-the-webapp (consulted 2026-10-29)
## Not verified
- Windows Docker image startup and local cross-container import passed via `./scripts/e2e.ps1` on 2026-10-29. Linux Docker execution of `scripts/e2e.sh` has not been run on this host.
-28
View File
@@ -1,28 +0,0 @@
---
name: gitea-actions-ci
description: Use when changing Bifrost's Gitea Actions workflow, Maven artifact upload, release commits, tags, or Gitea release publishing.
---
# Gitea Actions CI
- Follow common `devops-engineering` and `gitea-delivery-workflow` for general CI security, runner, permissions, PR validation, and delivery policy. This skill defines only Bifrost's workflow behavior and Maven graph.
- Store workflows in `.gitea/workflows/*.yml`; configure push, pull request, and manual dispatch as needed. The current build graph checks out complete history and tags before running `scripts/version.sh`, sets up Java 17, validates changelog formatting on pull requests, runs Maven verification, and uploads `sonar-bifrost-plugin-${revision}.jar`.
- Preserve Maven's version injection through `-Drevision` and its pinned wrapper/toolchain. Cache only Maven dependencies; never cache secrets or print tokens.
- The release job is restricted to a push to the configured main branch, a release-needed result from the version script, and a workflow-generated-commit guard. Do not rely only on `[skip ci]`.
- Release publication follows `release-versioning-changelog`: update changelog, commit, tag that commit, push commit/tag, and create a Gitea release from the exact changelog section. Use repository secrets only for authenticated push/release, and document the branch protection permissions required for that identity.
- Prevent release loops by checking the release actor/commit marker and tag state. Never force-move a published tag.
- Verify actual Gitea and act_runner versions, supported actions/images, mirrors, and branch protection before claiming workflow compatibility. Current action sources are GitHub-hosted (`actions/checkout`, `actions/setup-java`, `actions/upload-artifact`); an isolated runner may require mirrors or outbound GitHub access.
## Checklist
- [ ] Full history and tags available before version calculation.
- [ ] PR validates changelog without mutation and builds the Maven artifact.
- [ ] Release job guarded against loops and branch scope.
- [ ] Release secret is only used for authenticated publication.
- [ ] Actions are act_runner compatible or mirror requirements documented.
## Sources
- Gitea Actions documentation: https://docs.gitea.com/usage/actions/overview (consulted 2026-10-28)
- Gitea Actions migration guide: https://docs.gitea.com/usage/actions/comparison (consulted 2026-10-28)
- Gitea Actions API documentation: https://docs.gitea.com/api/ (consulted 2026-10-28)
## Not verified
- Runner version, main branch name, protected-branch policy, and release workflow against a live Gitea runner are not confirmed by repository configuration.
-28
View File
@@ -1,28 +0,0 @@
---
name: gitea-api-client
description: Use when implementing or modifying Gitea API requests, pagination, authentication, DTOs, errors, or HTTP retry behavior.
---
# Gitea API client
- Assume Gitea REST API v1 (OpenAPI documented by Gitea); use documented paths: `/user/orgs`, `/orgs/{org}/repos`, and `/user/repos` when personal repositories are enabled.
- Send the token only in the server-side `Authorization: token …` header; never echo it or include it in exceptions.
- Paginate with bounded `page` and `limit` parameters and stop only when a page is shorter than the requested limit.
- Use `java.net.http.HttpClient` with explicit connect and request timeouts.
- Do not automatically retry non-idempotent operations. If retries are added for GET, cap attempts and honor `Retry-After` when valid.
- Map 401 to invalid token, 403 to insufficient Gitea access, 404 to missing organization/resource, 429 to rate limit, and 5xx/network failures to temporary service errors.
- Parse only fields needed by the UI; handle absent optional branch fields safely.
- Validate configured base URL and disable redirects to prevent token forwarding to another host.
## Checklist
- [ ] Token remains server side and is redacted.
- [ ] Pagination bounded and tested.
- [ ] Timeouts and status mappings are explicit.
- [ ] Redirects disabled; base URL validated.
## Sources
- Gitea API documentation: https://docs.gitea.com/api/ (API 28.2.0 consulted 2026-10-28)
- Gitea user/org operations: https://docs.gitea.com/api/1.26/operations/tags/organization/ (consulted 2026-10-28)
- Java HttpClient: https://docs.oracle.com/en/java/javase/17/docs/api/java.net.http/java/net/http/HttpClient.html (consulted 2026-10-28)
## Not verified
- Deployment-specific Gitea version is unspecified; current endpoint compatibility across older Gitea versions must be checked against the test instance.
@@ -1,27 +0,0 @@
---
name: java-best-practices
description: Use when writing or reviewing Java production code in this plugin, especially HTTP, validation, lifecycle, concurrency, or error handling.
---
# Java best practices
- Compile with Java 17 (`maven.compiler.release=17`), the baseline supported by the target plugin API.
- Prefer immutable records for internal DTOs where compatible with JSON parsing; keep collections defensively copied.
- Validate null, length, and format at service boundaries. Use named constants for bounds and timeouts.
- Use try-with-resources for closeable resources; `java.net.http.HttpClient` is reusable and immutable.
- Do not create static mutable state, swallow exceptions, catch `Throwable`, or catch broad `Exception` without translating a known boundary failure.
- Keep errors actionable but never include authorization headers, tokens, or full secret-bearing URLs.
- Use SLF4J host-provided logging; log operation context without credentials.
- Keep packages under `cc.tordais.sonar.bifrost`; name types and methods in ASCII English.
## Checklist
- [ ] Java 17 compilation; immutable data and bounded inputs.
- [ ] Exceptions translated at boundaries, not hidden.
- [ ] No static mutable state or secret-bearing logs.
- [ ] Resources and HTTP timeouts handled.
## Sources
- SonarQube API JDK baseline: https://github.com/SonarSource/sonar-plugin-api (consulted 2026-10-28)
- Java 17 API documentation: https://docs.oracle.com/en/java/javase/17/docs/api/ (consulted 2026-10-28)
## Not verified
- No project-specific Sonar quality profile has been run yet.
-27
View File
@@ -1,27 +0,0 @@
---
name: java-testing
description: Use when adding or changing unit or integration tests for Java services, validation, project keys, or HTTP interactions.
---
# Java testing
- Use pinned JUnit Jupiter and AssertJ; use Mockito only for narrow collaborator seams.
- Mock HTTP at the transport boundary with a local in-process `HttpServer`; tests must not need a real Gitea instance or network.
- Test pagination, authentication failures, 404, 5xx, malformed payloads, timeout behavior, and secret redaction.
- Test project-key sanitization, invalid/empty inputs, and collisions across distinct source names.
- Test organization allowlist behavior in both fixed and all-accessible modes.
- Use deterministic fixtures, no sleeps, no dependence on wall-clock except injected clock behavior.
- Run `./mvnw test` (Windows: `mvnw.cmd test`) and report only results actually run.
## Checklist
- [ ] Gitea HTTP paths and failure mapping covered.
- [ ] Key and organization boundary cases covered.
- [ ] Tests are offline and deterministic.
- [ ] Test suite passes with Maven Wrapper.
## Sources
- JUnit 5 User Guide: https://junit.org/junit5/docs/current/user-guide/ (consulted 2026-10-28)
- AssertJ documentation: https://assertj.github.io/doc/ (consulted 2026-10-28)
- Java HttpServer API: https://docs.oracle.com/en/java/javase/17/docs/api/jdk.httpserver/com/sun/net/httpserver/HttpServer.html (consulted 2026-10-28)
## Not verified
- Plugin lifecycle integration tests against a running server are outside unit test scope.
@@ -1,50 +0,0 @@
---
name: local-e2e-validation
description: Use when building, changing, or running the reproducible Bifrost local stack validation that provisions Gitea fixtures and imports them through the SonarQube page.
---
# Local end-to-end validation
- Build the JAR from the repository tag-derived version before starting the stack; mount that exact file read-only into SonarQube.
- Use only Compose project `bifrost-e2e` for automated state. Reset its named volumes with `down --volumes --remove-orphans`; never delete the user's default `bifrost` project or other volumes.
- Wait for PostgreSQL, Gitea, and SonarQube health checks before provisioning. Require exact SonarQube version `25.9.0.112764` and verify plugin runtime before browser actions.
- Create a test-only Gitea administrator with the pinned Gitea CLI. Generate a disposable token through the documented Gitea API and keep credentials and tokens in process memory or test-only environment variables.
- Seed two organizations (`alpha-lab`, `beta-lab`) and two repositories in each (`api`, `web`) through the Gitea API. Repeated repository names across organizations are expected.
- Configure `sonar.bifrost.*` with SonarQube Web APIs. In the disposable 25.9 instance, accept `sonar.plugins.risk.consent` through the public settings API, then create a UI session through `api/authentication/login`.
- Dismiss SonarQube first-run welcome and Joyride overlays before checking controls. Wait for repository rows to reflect the selected organization before selecting all.
- Assert organization switching retains selection, all four projects are created with organization-prefixed keys, every project receives a Gitea link, imported rows are disabled, and the page emits no JavaScript errors. The fixture deliberately repeats `api` and `web` across the organizations.
- Keep the stack after a successful test for inspection. On failure retain the stack and Playwright trace/screenshots. Cleanup only with the dedicated project command.
- Do not report full validation unless the script exits successfully and the independent API assertions pass.
## Checklist
- [x] Exact plugin JAR version and manifest are used by Compose.
- [x] Fresh Gitea and SonarQube state is provisioned with test-only credentials.
- [x] Both organizations and all four repositories are verified in Gitea.
- [x] Chromium exercises the real plugin page and its selection/import controls.
- [x] SonarQube API confirms each project and its Gitea link.
- [x] Imported project state and browser errors are checked.
- [x] Only the `bifrost-e2e` project can be reset by the runner.
## Commands
```sh
./scripts/e2e.ps1
docker compose --project-name bifrost-e2e ps
docker compose --project-name bifrost-e2e down --volumes --remove-orphans
```
## Sources
- SonarQube page extensions: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/developing-a-plugin/adding-pages-to-the-webapp (consulted 2026-10-29)
- SonarQube project creation API: https://docs.sonarsource.com/sonarqube-community-build/project-administration/creating-project/automating-creation (consulted 2026-10-29)
- SonarQube settings Web API: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/web-api (consulted 2026-10-29)
- Gitea 1.23 token API: https://docs.gitea.com/api/1.23/operations/user-create-token/ (consulted 2026-10-29)
- Gitea 1.23 organization repository API: https://docs.gitea.com/api/1.23/operations/create-org-repo/ (consulted 2026-10-29)
- Gitea command line: https://docs.gitea.com/administration/command-line/ (consulted 2026-10-29)
- Playwright Docker: https://playwright.dev/docs/docker (consulted 2026-10-29)
- Playwright test configuration: https://playwright.dev/docs/test-configuration (consulted 2026-10-29)
- Docker Compose specification: https://docs.docker.com/compose/compose-file/ (consulted 2026-10-29)
## Not verified
- The full local flow passed on 2026-10-29 with SonarQube Community Build 25.9.0.112764, Gitea 1.23.8, PostgreSQL 17.2, and Playwright 1.64.1. External Gitea versions and Linux Docker hosts have not been exercised here.
@@ -1,32 +0,0 @@
---
name: maven-build-packaging
description: Use when changing Maven coordinates, compiler or plugin versions, wrapper, packaging, JavaScript resources, or Docker build integration.
---
# Maven build and packaging
- Use Maven and commit the Maven Wrapper; pin Maven distribution, compiler, Surefire, packaging, and flatten plugin versions.
- Inject `${revision}` through `-Drevision=...`; use `flatten-maven-plugin` so published metadata resolves the version.
- Set compiler release 17. Declare `org.sonarsource.api.plugin:sonar-plugin-api:13.0.0.3026` as `provided` for Community Build 25.9.
- Configure `sonar-packaging-maven-plugin` with plugin key `bifrost`, ASCII display fallback `Bifrost (Gitea Import)` until manifest UTF-8 is verified, and plugin API minimum `13.0.0.3026`.
- Do not confuse manifest `Sonar-Version` with a SonarQube product version: it records the minimum plugin API version. Track the minimum tested SonarQube release separately.
- Keep JavaScript dependency-free and package it as a static resource; no Node build step is needed.
- Produce `sonar-bifrost-plugin-${revision}.jar`; inspect manifest and contents after packaging.
- Build reproducibly where plugin versions permit; avoid timestamps and unpinned image tags.
- Docker build stages must use pinned JDK/Maven images and provide a clear host extraction command.
## Checklist
- [ ] Wrapper and all plugin versions pinned.
- [ ] Public API dependency provided, not packaged.
- [ ] JAR filename and manifest correct.
- [ ] Static page resource included.
- [ ] Container build can export the JAR.
## Sources
- SonarQube plugin packaging: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/developing-a-plugin/plugin-basics (consulted 2026-10-28)
- Maven Wrapper: https://maven.apache.org/wrapper/ (consulted 2026-10-28)
- Maven CI-friendly versions: https://maven.apache.org/maven-ci-friendly.html (consulted 2026-10-28)
- SonarSource packaging plugin: https://github.com/SonarSource/sonar-packaging-maven-plugin (consulted 2026-10-28)
- Manifest metadata reference: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/developing-a-plugin/plugin-basics (consulted 2026-10-28)
## Not verified
- Exact minimum-version manifest syntax must be checked against the pinned packaging plugin release during build implementation.
-27
View File
@@ -1,27 +0,0 @@
---
name: project-workflow
description: Use for every task in this repository to enforce Bifrost-specific implementation order, evidence, and definition of done.
---
# Project workflow
- Keep source, docs, UI, logs, comments, workflows, and commit messages in English. Use ASCII identifiers; display text may use `Bifrost` unless UTF-8 manifest encoding is verified.
- Before implementation, read repository instructions and applicable project and common skills. Verify version-sensitive SonarQube claims against the listed primary sources.
- For Gitea issue intake, Orca task coordination, PR lifecycle, release assessment, CI/DevOps, secret handling, disposable infrastructure, and worktree cleanup, follow the installed common skills `gitea-delivery-workflow`, `orca-parallel-work`, `pr-lifecycle`, `release-assessment`, `devops-engineering`, `gitea-auth`, `infisical-cli`, `disposable-test-environment`, and `worktree-cleanup`. This skill defines no alternate delivery lifecycle.
- Bifrost-specific implementation order: compatibility research, project-skill updates when needed, design, Java/JavaScript implementation, Maven verification, JAR packaging inspection, and SonarQube compatibility/security review. For skills-only or Markdown-only changes, perform relevant documentation checks; do not run product builds or application recipes unless the changed instructions require them.
- If actual behavior conflicts with a project skill, confirm against primary documentation or the pinned artifact, update the skill in the same change, and explain the correction.
- Keep security boundaries server-side; never trust UI visibility or client-provided organization names. Follow `secure-coding-plugin` for SonarQube authorization, Gitea credentials, outbound requests, and token handling.
- Do not claim build, runtime, browser, integration, CI, or independent review evidence unless actually observed. Keep local checks, CI, disposable recipe, and external deployment evidence distinct.
- When the user requests local integration proof, follow `local-e2e-validation`: isolated zero-to-import stack and browser-based end-to-end test, with exact cleanup/evidence rules.
## Checklist
- [ ] Relevant project and common skills loaded and followed.
- [ ] English-only content and ASCII identifiers.
- [ ] SonarQube/API compatibility checked where relevant.
- [ ] Verification evidence and limits accurately reported.
- [ ] Relevant skill checklists reviewed.
## Sources
- SonarQube Community Build plugin basics: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/developing-a-plugin/plugin-basics (consulted 2026-10-28)
## Not verified
- SonarQube target compatibility and runtime evidence are recorded in the relevant SonarQube skills; they must be refreshed when the target changes.
@@ -1,27 +0,0 @@
---
name: release-versioning-changelog
description: Use when changing Bifrost version calculation, release automation, Conventional Commit parsing, or CHANGELOG.md generation and validation.
---
# Release versioning and changelog
- Follow the common `release-assessment` skill for PR impact and `gitea-delivery-workflow` for delivery. This skill records only Bifrost's version source and release format.
- Treat reachable Git tags `vMAJOR.MINOR.PATCH` as the sole release version source. Calculate from commits since the latest reachable version tag: breaking change or `!` bumps major; `feat` bumps minor; `fix`, `perf`, and `refactor` bump patch; other types do not request release.
- Use a version format accepted by the SonarQube plugin manifest; keep snapshot metadata out of release tags. The built JAR is `sonar-bifrost-plugin-${revision}.jar`.
- Keep `CHANGELOG.md` in Keep a Changelog 1.1.0 structure, newest first, using only Added, Changed, Deprecated, Removed, Fixed, and Security categories.
- Never invent a user-facing changelog detail from an unclear commit. Allow maintainers to edit generated entries before release.
- Validate headings, dates, allowed categories, order, and comparison links with the repository validator. Extract the release body directly from the matching version section in `CHANGELOG.md`.
- The Gitea release flow updates the changelog, commits it, tags that commit, pushes the commit and tag, then creates a Gitea release from that exact changelog section and attaches the versioned plugin JAR. Never force-update a published tag.
## Checklist
- [ ] Tag parsing is deterministic and handles no-tag repositories.
- [ ] Bump mapping matches repository policy.
- [ ] Changelog validator catches malformed sections and links.
- [ ] Release tag points to the changelog update commit and release asset matches the tag.
## Sources
- Keep a Changelog 1.1.0: https://keepachangelog.com/en/1.1.0/ (consulted 2026-10-28)
- Semantic Versioning 2.0.0: https://semver.org/spec/v2.0.0.html (consulted 2026-10-28)
- Conventional Commits 1.0.0: https://www.conventionalcommits.org/en/v1.0.0/ (consulted 2026-10-28)
## Not verified
- SonarQube's accepted plugin manifest version grammar must be confirmed against the pinned packaging plugin and target when changed.
@@ -1,30 +0,0 @@
---
name: secure-coding-plugin
description: Use when adding or reviewing configuration, web-service inputs, authorization, outbound HTTP, secrets, or dependencies in the plugin.
---
# Secure coding for this plugin
- Require authenticated SonarQube users and check `Create Projects` on every action that enumerates or imports repositories.
- Fail closed when the current-user permission response is absent or malformed. Verify local connector authorization behavior on the target instance before deployment.
- Treat all browser input as untrusted. Bound batch size and string lengths; validate organization and repository identifiers before API calls.
- Validate configured Gitea URL as absolute HTTP(S) with host and no userinfo, query, or fragment. The URL is trusted administrator configuration and may target a private Gitea host; never accept a request-specific outbound URL.
- Disable redirects to avoid forwarding the Gitea token; do not expose outbound arbitrary URL input.
- Store the token in a `.secured` PASSWORD property. Never return it from web services, JS, logs, errors, or generated files.
- Use same-origin authenticated SonarQube requests for mutations; do not build custom cookie bypasses. Preserve SonarQube's normal CSRF/session protections by sending `X-XSRF-TOKEN` from the `XSRF-TOKEN` cookie on POST requests.
- Reject duplicate or colliding project keys before making any project mutations.
- Pin dependencies, inspect transitive dependency changes, and keep the Sonar API provided.
## Checklist
- [ ] Every endpoint checks Create Projects.
- [ ] URL, identifiers, and batch sizes validated.
- [ ] Secret handling and redirects safe.
- [ ] Project-key collisions fail closed.
- [ ] Dependency versions pinned.
## Sources
- OWASP SSRF Prevention Cheat Sheet: https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html (consulted 2026-10-28)
- SonarQube Community Build Web API security: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/web-api (consulted 2026-10-28)
- SonarQube plugin configuration: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/developing-a-plugin/plugin-basics (consulted 2026-10-28)
## Not verified
- Community Build 25.9.0.112764 returned HTTP 401 when the POST omitted `X-XSRF-TOKEN`; the local browser flow passed after including it. The external Gitea endpoint and token policy remain administrator-controlled and were not evaluated.
@@ -1,29 +0,0 @@
---
name: sonarqube-frontend-extension
description: Use when implementing or changing a SonarQube 25.9 page extension, its JavaScript bundle, navigation placement, API calls, or browser permissions.
---
# SonarQube frontend extension
- Register a global page with `PageDefinition`; its key is `bifrost/import`.
- Put the matching unbundled JavaScript at `src/main/resources/static/import.js`; call `window.registerExtension("bifrost/import", start)`.
- Use only `options.el` as the page mount point; return a cleanup callback.
- Do not assume global libraries except React. Plain browser JavaScript avoids an unnecessary build step.
- Use same-origin `fetch` for `api/bifrost/*`; rely on the active SonarQube session and never send the Gitea token to the browser. For non-GET requests, copy the readable `XSRF-TOKEN` cookie into the `X-XSRF-TOKEN` header; SonarQube 25.9 rejects cookie-authenticated POSTs without it.
- Render API errors as accessible text; use labels for controls, semantic table headers, keyboard-accessible controls, and text status in addition to color.
- Validate repository links as HTTP or HTTPS before assigning them to an anchor.
- Grey out imported rows and disable their checkboxes. Keep selection in page state across organization changes.
- Page visibility is not authorization. The server must enforce Create Projects permission on every endpoint.
- Do not embed inline scripts or use `eval`.
## Checklist
- [ ] `PageDefinition` key matches JS registration key and resource filename.
- [ ] Bundle packaged under `/static/bifrost/import.js`.
- [x] Accessible labels, feedback and keyboard controls.
- [ ] No token in browser or authorization based only on menu visibility.
## Sources
- Adding pages to the webapp: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/developing-a-plugin/adding-pages-to-the-webapp (consulted 2026-10-28)
- SonarQube Web API: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/web-api (consulted 2026-10-28)
## Not verified
- Live page routing, bundle loading, accessible controls, selection retention, and POST CSRF behavior were verified on Community Build 25.9.0.112764. Conditional menu hiding based on Create Projects permission is not supported by the selected public page API.
@@ -1,34 +0,0 @@
---
name: sonarqube-plugin-development
description: Use when adding or changing Java plugin entry points, extension registration, properties, web services, manifest metadata, or packaging compatibility for SonarQube Community Build 25.9.0.112764.
---
# SonarQube plugin development
- Target SonarQube Community Build `25.9.0.112764`; use Java 17 bytecode and plugin API `13.0.0.3026`, inferred from target server dependency metadata and confirmed by a successful plugin load on the exact target image.
- Declare all server extensions through `Plugin.Context.addExtensions`; keep constructors free of service work.
- Use only `org.sonar.api.*` public API. Never import `org.sonar.server.*`, DAO classes, or implementation packages.
- Define settings through `PropertyDefinition`; secured values must use a `.secured` key and PASSWORD type.
- Add web services using `WebService` and `@ServerSide`; authorize each action explicitly.
- Inspect the pinned API JAR before importing any auth type. `org.sonar.api.user.UserSession` and `org.sonar.api.permissions.GlobalPermission` are absent from API 13.0.0.3026. The current implementation reads current-user permissions through the public `Request.localConnector()` interface and must be checked against the target server's response.
- Set key, display name, version and minimum plugin API version in packaging metadata. The manifest `Sonar-Version` is an API version, not a SonarQube product release. Keep the minimum tested server release separately.
- Use SLF4J supplied by the host; never package logging implementations or log credentials.
- Verify extension APIs against the exact API artifact/Javadoc when changing the target release.
- For project creation within a web service, use `Request.localConnector()` to call public SonarQube Web APIs in the current request context; never invoke internal project creation services.
## Checklist
- [ ] Entry point and only public API types.
- [ ] Extensions registered and server side scoped correctly.
- [ ] Secure configuration and explicit authorization.
- [ ] Manifest key/name/version/minimum version inspected in final JAR.
- [ ] `mvnw verify` succeeds.
## Sources
- SonarQube Community Build Plugin basics: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/developing-a-plugin/plugin-basics (consulted 2026-10-28)
- SonarSource API compatibility matrix: https://github.com/SonarSource/sonar-plugin-api (consulted 2026-10-28)
- SonarQube target dependency metadata: https://central.sonatype.com/artifact/org.sonarsource.sonarqube/sonar-core/25.9.0.112764 (consulted 2026-10-28)
- Pinned API source artifact: https://repo.maven.apache.org/maven2/org/sonarsource/api/plugin/sonar-plugin-api/13.0.0.3026/sonar-plugin-api-13.0.0.3026-sources.jar (consulted 2026-10-28)
- SonarQube project creation REST API: https://docs.sonarsource.com/sonarqube-community-build/project-administration/creating-project/automating-creation (consulted 2026-10-28)
## Not verified
- Full target-tag SonarQube source checkout was not available; the plugin build and startup were verified against the exact target image.
- The target server's `api/users/current` permissions response and local connector caller context were not tested live.
+9 -12
View File
@@ -5,6 +5,7 @@ on:
branches: ["**"]
tags: ["v*.*.*"]
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
inputs:
revision:
@@ -31,7 +32,6 @@ jobs:
revision=$(sh scripts/version.sh)
if [ -n "$REVISION_OVERRIDE" ]; then revision="$REVISION_OVERRIDE"; fi
echo "revision=$revision" >> "$GITHUB_OUTPUT"
echo "release_needed=$(sh scripts/version.sh --release-needed)" >> "$GITHUB_OUTPUT"
echo "release_version=$(sh scripts/version.sh --next-release)" >> "$GITHUB_OUTPUT"
env:
REVISION_OVERRIDE: ${{ github.event.inputs.revision }}
@@ -47,26 +47,23 @@ jobs:
run: |
sh scripts/render-readme.sh "$BUILD_REVISION"
sh ./mvnw -B -Drevision="$BUILD_REVISION" verify
- name: Upload plugin JAR
uses: actions/upload-artifact@v4.6.2
with:
name: sonar-bifrost-plugin-${{ steps.version.outputs.revision }}
path: target/sonar-bifrost-plugin-${{ steps.version.outputs.revision }}.jar
if-no-files-found: error
- name: Build release version
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.version.outputs.release_needed == 'true' && !contains(github.event.head_commit.message, 'chore(release):')
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore(release):')
env:
RELEASE_VERSION: ${{ steps.version.outputs.release_version }}
run: |
sh scripts/render-readme.sh "$RELEASE_VERSION"
sh ./mvnw -B -Drevision="$RELEASE_VERSION" verify
- name: Create release commit, tag, and Gitea release
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.version.outputs.release_needed == 'true' && !contains(github.event.head_commit.message, 'chore(release):')
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore(release):')
env:
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
GITEA_API_URL: ${{ vars.GITEA_API_URL }}
GITEA_REPOSITORY: ${{ github.repository }}
GITEA_REPOSITORY_URL: ${{ vars.GITEA_REPOSITORY_URL }}
GITEA_SERVER_URL: ${{ github.server_url }}
GITEA_MAIN_BRANCH: main
RELEASE_VERSION: ${{ steps.version.outputs.release_version }}
run: sh scripts/release.sh "$RELEASE_VERSION"
run: |
export GITEA_API_URL="${GITEA_SERVER_URL%/}/api/v1"
export GITEA_REPOSITORY_URL="${GITEA_SERVER_URL%/}/${GITEA_REPOSITORY}"
git remote set-url origin "${GITEA_REPOSITORY_URL}.git"
sh scripts/release.sh "$RELEASE_VERSION"
+5 -1
View File
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Removed
- Remove repository-local agent skills in favor of the shared skills catalog.
### Added
- Add Gitea organization and repository browsing, selection, server-side validation, project creation, and repository links.
@@ -18,4 +22,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Check Create Projects permission and report existing-project status through SonarQube's public Web APIs.
- Send SonarQube's XSRF token on browser POSTs and verify the complete repository import flow.
[Unreleased]: http://localhost:3000/owner/bifrost/compare/v0.1.0...HEAD
[Unreleased]: https://sources.tordais.cc/arnaud.dartois/Bifrost/compare/v0.1.0...HEAD
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 Arnaud Dartois
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+87 -118
View File
@@ -1,160 +1,129 @@
# Bifrost
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)
- **Issue tracker:** [Gitea issues](https://sources.tordais.cc/arnaud.dartois/Bifrost/issues)
- **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
├── src/main/java/cc/tordais/sonar/bifrost/
│ ├── BifrostPlugin.java
│ ├── config/BifrostProperties.java
│ ├── gitea/GiteaClient.java
│ ├── gitea/GiteaRepository.java
│ ├── page/ImportPage.java
│ ├── service/OrganizationPolicy.java
│ ├── service/ProjectKey.java
│ └── ws/BifrostWebService.java
├── src/main/resources/static/import.js
├── src/test/java/cc/tordais/sonar/bifrost/
│ ├── gitea/GiteaClientTest.java
│ └── service/{OrganizationPolicyTest,ProjectKeyTest}.java
├── tests/e2e/ # Pinned Playwright browser validation
├── scripts/e2e.sh # Fresh-stack end-to-end runner
├── CHANGELOG.md
├── Dockerfile
├── docker-compose.yml
├── Makefile
├── mvnw, mvnw.cmd
└── pom.xml
```
From the **Import from Gitea** page, a user can:
## Local build
- 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:
```sh
docker build --build-arg REVISION="$(sh scripts/version.sh)" --target export --output type=local,dest=dist .
```
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-&#60;version&#62;.jar</code>. To calculate the Git-based development version and render the README version marker before packaging, use:
```powershell
docker compose --project-name bifrost-e2e down --volumes --remove-orphans
```
make build
## Versioning
Run only the unit tests with:
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`.
docker build --build-arg REVISION="$(sh scripts/version.sh)" --target export --output type=local,dest=dist .
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, runs Maven verification, and uploads the JAR. On a main-branch push, a release commit/tag and Gitea release are created when Conventional Commits request a bump.
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 repository variable `GITEA_API_URL` (for example, `https://gitea.example/api/v1`), repository variable `GITEA_REPOSITORY_URL` (the repository web URL), and secret `RELEASE_TOKEN`. 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 action sources (`actions/checkout`, `actions/setup-java`, `actions/upload-artifact`); 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`.
## 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](https://sources.tordais.cc/arnaud.dartois/Bifrost/issues).
+19 -1
View File
@@ -6,6 +6,24 @@
<version>${revision}</version>
<packaging>sonar-plugin</packaging>
<name>Bifrost</name>
<description>Browse Gitea repositories and create linked SonarQube Community Build projects.</description>
<url>https://sources.tordais.cc/arnaud.dartois/Bifrost</url>
<licenses>
<license>
<name>MIT License</name>
<url>https://opensource.org/license/mit/</url>
<distribution>repo</distribution>
</license>
</licenses>
<issueManagement>
<system>Gitea</system>
<url>https://sources.tordais.cc/arnaud.dartois/Bifrost/issues</url>
</issueManagement>
<scm>
<connection>scm:git:https://sources.tordais.cc/arnaud.dartois/Bifrost.git</connection>
<developerConnection>scm:git:https://sources.tordais.cc/arnaud.dartois/Bifrost.git</developerConnection>
<url>https://sources.tordais.cc/arnaud.dartois/Bifrost</url>
</scm>
<properties>
<revision>0.1.0-SNAPSHOT</revision>
<maven.compiler.release>17</maven.compiler.release>
@@ -28,7 +46,7 @@
<finalName>sonar-bifrost-plugin-${revision}</finalName>
<plugins>
<plugin><groupId>org.sonarsource.sonar-packaging-maven-plugin</groupId><artifactId>sonar-packaging-maven-plugin</artifactId><version>1.23.0.740</version><extensions>true</extensions>
<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>
</plugin>
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.13.0</version></plugin>
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-surefire-plugin</artifactId><version>3.5.2</version></plugin>
+1 -1
View File
@@ -4,7 +4,7 @@ set -eu
version=${1:?Usage: scripts/changelog.sh X.Y.Z}
printf '%s\n' "$version" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$' || { echo 'Version must be X.Y.Z.' >&2; exit 2; }
export CHANGELOG_VERSION="$version"
export GITEA_REPOSITORY_URL="${GITEA_REPOSITORY_URL:-http://localhost:3000/owner/bifrost}"
export GITEA_REPOSITORY_URL="${GITEA_REPOSITORY_URL:-https://sources.tordais.cc/arnaud.dartois/Bifrost}"
python_bin=${PYTHON:-python3}
"$python_bin" - <<'PY'
import datetime
+3
View File
@@ -45,6 +45,9 @@ case "$bump" in
2) minor=$((minor + 1)); patch=0 ;;
1) patch=$((patch + 1)) ;;
esac
if [ "${1:-}" = "--next-release" ] && [ "$bump" -eq 0 ]; then
patch=$((patch + 1))
fi
next="$major.$minor.$patch"
case "${1:-}" in