Skip to content

A ready-to-use CI/CD Pipeline for analyzing your code with SonarCloud.

License

Notifications You must be signed in to change notification settings

fluent-ci-templates/sonar-pipeline

Repository files navigation

Sonar Pipeline

fluentci pipeline deno compatibility dagger-min-version ci

A ready-to-use CI/CD Pipeline for analyzing your code with SonarCloud.

🚀 Usage

Run the following command in your project:

fluentci run sonar_pipeline

Or, if you want to use it as a template:

fluentci init -t sonar

This will create a .fluentci folder in your project.

Now you can run the pipeline with:

fluentci run .

🧩 Dagger Module

Use as a Dagger Module:

dagger install github.com/fluent-ci-templates/sonar-pipeline@main

🛠️ Environment variables

Variable Description Required
SONAR_TOKEN SonarCloud token yes
SONAR_ORGANIZATION SonarCloud organization yes
SONAR_PROJECT_KEY SonarCloud project key yes
SONAR_HOST_URL SonarCloud host URL. Default: https://sonarcloud.io no
SONAR_SOURCES SonarCloud sources. Default: . no

✨ Jobs

Job Description
analyze Run SonarScanner and push to SonarCloud.
analyze(
  src: string | Directory,
  token: string | Secret,
  organization?: string,
  projectKey?: string,
  sources?: string
): Promise<string>

👨‍💻 Programmatic usage

You can also use this pipeline programmatically:

import { analyze } from "jsr:@fluentci/sonar";

await analyze();