Skip to main content
Plugins / SonarQube

SonarQube

by Joan Flotats
Website
sonarqubecode-qualityanalysistesting

A Docker-based plugin for Woodpecker CI that integrates with SonarQube for code quality analysis


woodpecker-sonar-plugin

A Docker-based plugin for Woodpecker CI that integrates with SonarQube for code quality analysis. This plugin supports multiple programming languages including Node.js, Go, and Flutter/Dart.

Basic Usage

Add this step to your .woodpecker.yml pipeline:

steps:
  - name: code-analysis
    image: ghcr.io/j04n-f/sonar-plugin
    settings:
      sonar_token:
        from_secret: sonar_token
      sonar_url: https://sonarcloud.io
      sonar_project_key: your-project-key
      sonar_project_name: "Your Project Name"

Debug Mode

For troubleshooting and verbose logging:

steps:
  - name: code-analysis
    image: ghcr.io/j04n-f/sonar-plugin
    settings:
      sonar_token:
        from_secret: sonar_token
      sonar_url: https://sonarcloud.io
      sonar_project_key: your-project-key
      sonar_debug: true

Language-Specific Variants

Node.js Projects

steps:
  - name: code-analysis
    image: ghcr.io/j04n-f/sonar-plugin:node
    settings:
      sonar_token:
        from_secret: sonar_token
      sonar_url: https://sonarcloud.io
      sonar_project_key: your-node-project

Go Projects

steps:
  - name: code-analysis
    image: ghcr.io/j04n-f/sonar-plugin:go
    settings:
      sonar_token:
        from_secret: sonar_token
      sonar_url: https://sonarcloud.io
      sonar_project_key: your-go-project

Flutter Projects

steps:
  - name: code-analysis
    image: ghcr.io/j04n-f/sonar-plugin:flutter
    settings:
      sonar_token:
        from_secret: sonar_token
      sonar_url: https://sonarcloud.io
      sonar_project_key: your-flutter-project

Settings

Settings Name Default Description
sonar_token none Required. SonarQube authentication token
sonar_url none SonarQube server URL (can be set in sonar-project.properties)
sonar_project_key none Project key (can be set in sonar-project.properties)
sonar_project_name none Project display name (can be set in sonar-project.properties)
sonar_debug false Enable verbose logging for debugging (set to true)

Configuration with sonar-project.properties

Alternatively, you can configure your project using a sonar-project.properties file in your repository root:

sonar.host.url=https://sonarcloud.io
sonar.projectKey=your-project-key
sonar.projectName=Your Project Name
sonar.projectVersion=1.0.0

# Source configuration
sonar.sources=src/
sonar.tests=test/
sonar.sourceEncoding=UTF-8

Available Docker Images

  • sonar-plugin - Base image with SonarScanner CLI
  • sonar-plugin:node - Includes Node.js runtime
  • sonar-plugin:go - Includes Go runtime
  • sonar-plugin:flutter - Includes Flutter/Dart SDK