Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

README.md

docker run -d --name sonar -p 9000:9000 sonarqube:lts-community

comminty branch - https://hub.docker.com/r/mc1arke/sonarqube-with-community-branch-plugin

image

Configuration - configuration of sq Security - user management Projects - Project management System - to check the status Marketplace - to install plugins and all

Quality profile

we can add and modify the rules anfter taking a copy

jacoco is using for java

url and usr/password required for access any

install sonaqube scanner plugin in jenkins

go to tools in jenkins jenkins tools

system-sonar server

image

Administration --> security --> user --> token -->

Manage Jenkins --> Credentials --> System --> Global credentials (unrestricted) --> New credentials

kind : secret text Scope : Global (Jenkins, nodes, items, all child items, etc) Secret : Token ID: sonar-token Description : sonar-token

pipeline {
    agent any
    tools {
        maven 'M3'   
    }
    environment {
        SCANNER_HOME = tool 'sonar-scanner' 
    }
    stages {
        stage('git') {
            steps {
                echo 'git checkout'
                git branch: 'main', url: 'https://github.com/pythonkid2/Boardgame.git'
            }
        }
        stage('unit test') {
            steps {
                echo 'mvn test'
                sh 'mvn test'
            }
        }
        stage('sonar analysis') {
            steps {
                withSonarQubeEnv('sonar-server') {
                    sh '''$SCANNER_HOME/bin/sonar-scanner -Dsonar.projectName=BoardGame -Dsonar.projectKey=BoardGame \
                    -Dsonar.java.binaries=target'''
                }
            }
        }
        stage('package') {
            steps {
                echo 'mvn package'
                sh 'mvn package'
            }
        }       
    }
}

+++

community branch pluggin -

add -

-Dsonar.branch.name=branch-name

mc1arke/sonarqube-community-branch-plugin https://github.com/mc1arke/sonarqube-community-branch-plugin

https://hub.docker.com/r/mc1arke/sonarqube-with-community-branch-plugin

instal jar manually

  1. Access the SonarQube container:
   docker exec -it 2710 /bin/bash
  1. Navigate to the extensions/plugins directory:

    cd /opt/sonarqube/extensions/plugins
    
  2. Download the SonarQube Community Branch Plugin:

    wget https://github.com/mc1arke/sonarqube-community-branch-plugin/releases/download/1.16.0/sonarqube-community-branch-plugin-1.16.0.jar
    

exit and restart the container docker restart

Sonar trouble shoot

image

Branch change

image

plugin version matrix - to check the supported versions

Quality gate check

if quality gate is passed then only it will proceed with pipeline`

Administration --> Configuration --> Webhooks --> Create

create webhook

http://18.220.71.120:8080/sonarqube-webhook/

go to jenkins

stage('Quality gate') {
            steps {
                script {
                    waitForQualityGate abortPipeline: false, credentialsId: 'sonar-cred'
                }
            }