This commit is contained in:
Anupong Hompan 2025-10-28 18:28:53 +07:00
parent 7d60224421
commit 1e13301dad

6
Jenkinsfile vendored
View File

@ -12,8 +12,6 @@ pipeline {
parameters {
string(name: 'GIT_URL', defaultValue: 'file:///repos/AS400API.git', description: 'Git repository URL to clone')
string(name: 'GIT_BRANCH', defaultValue: 'main', description: 'Branch or ref to build')
string(name: 'SONARQUBE_SERVER', defaultValue: 'SonarQube', description: 'Name of the SonarQube server configured in Jenkins (Manage Jenkins → Configure System)')
string(name: 'SONAR_TOKEN_ID', defaultValue: '', description: 'Jenkins Secret Text credential ID for the Sonar token')
// string(name: 'AGENT_LABEL', defaultValue: '', description: 'Optional Jenkins agent label with Docker CLI access (leave blank for default node)')
}
@ -155,7 +153,7 @@ pipeline {
script {
env.SONAR_PROJECT_VERSION = env.BUILD_NUMBER ?: '0.0.0'
}
withSonarQubeEnv('sonarqube') {
withSonarQubeEnv('SonarQube') {
sh '''#!/bin/bash -e
dotnet sonarscanner begin \
/k:"${SONAR_PROJECT_KEY}" \
@ -181,7 +179,7 @@ pipeline {
stage('SonarQube: End') {
steps {
// Close the Sonar analysis and push data to the server.
withSonarQubeEnv('sonarqube') {
withSonarQubeEnv('SonarQube') {
sh '''#!/bin/bash -e
dotnet sonarscanner end /d:sonar.login="${SONAR_AUTH_TOKEN}"
'''