Add sonar branch

This commit is contained in:
adrian.garcia 2025-03-26 10:01:48 +01:00
parent feee952e5e
commit 1adc1e07c5

6
Jenkinsfile vendored
View file

@ -6,12 +6,10 @@ pipeline {
BUILD_IMAGE = "registry.lksnext.com/devsecops/maven-java-17:2.0"
SONAR_HOST_URL = "https://sonarqubeenterprise.devops.lksnext.com/"
SONAR_TOKEN = credentials('sonarenterprise-analysis-token')
SONAR_BRANCH = env.BRANCH_NAME
}
stages {
stage('Sonar') {
when {
environment name: 'JOB_ACTION', value: 'sonar'
}
steps {
script {
sh '''
@ -19,7 +17,7 @@ pipeline {
-v ./:/app \
-v "/home/jenkins/.m2":"/home/jenkins/.m2" \
-e JOB_ACTION="compile" \
-e MAVEN_CMD="clean verify sonar:sonar -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.token=$SONAR_TOKEN" \
-e MAVEN_CMD="clean verify sonar:sonar -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.token=$SONAR_TOKEN -Dsonar.branch.name=$SONAR_BRANCH" \
$BUILD_IMAGE
'''
}