diff --git a/Jenkinsfile b/Jenkinsfile index fc88dafd..09ea210b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,20 +10,17 @@ pipeline { echo "build app" sh 'mvn clean package' echo "Build is successful for ${env.BUILD_ID}" - } - post { - success { - archiveArtifacts artifacts: 'target/*.war', fingerprint: true - } - } + } } - stage('Test') { - steps { - sh 'mvn test' - echo "Test is successful for ${env.BUILD_ID}" - - } - } + stage('Static Code Analysis') { + environment { + SONAR_URL = "http://172.18.0.4:9000" + } + steps { + withCredentials([string(credentialsId: 'sonarqube', variable: 'SONAR_AUTH_TOKEN')]) { + sh 'cd java-maven-sonar-argocd-helm-k8s/spring-boot-app && mvn sonar:sonar -Dsonar.login=$SONAR_AUTH_TOKEN -Dsonar.host.url=${SONAR_URL}' + } + } } }