added corrected jenkins file with sonar

This commit is contained in:
bhanu 2024-07-12 19:26:50 +05:30
parent 590a6bb6a1
commit d2c0c827fe

10
Jenkinsfile vendored
View file

@ -1,5 +1,9 @@
pipeline { pipeline {
agent { label 'hello' } agent { docker {
image 'bhanu3333/test:4'
args '--user root -v /var/run/docker.sock:/var/run/docker.sock' // mount Docker socket to access the host's Docker daemon
}
}
stages { stages {
stage('Checkout') { stage('Checkout') {
steps { steps {
@ -14,9 +18,9 @@ pipeline {
sh 'mvn clean package' sh 'mvn clean package'
} }
} }
stage('StaticCode Analysis') { stage('Static Code Analysis') {
environment { environment {
SONAR_URL = "http://20.197.43.119:32768" SONAR_URL = "https://20.197.43.119:32768"
} }
steps { steps {
withCredentials([string(credentialsId: 'sonarqube', variable: 'SONAR_AUTH_TOKEN')]) { withCredentials([string(credentialsId: 'sonarqube', variable: 'SONAR_AUTH_TOKEN')]) {