From 7bd636c7d499345ead5b2c529ff1110b643d6461 Mon Sep 17 00:00:00 2001 From: Saadullah Khan Warsi Date: Sat, 7 Oct 2023 18:40:21 +0500 Subject: [PATCH] Update Jenkinsfile --- Jenkinsfile | 80 ++++++++++++----------------------------------------- 1 file changed, 17 insertions(+), 63 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index cb4ea3a..8ddd505 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,73 +1,27 @@ pipeline{ - + agent any - - stages { - - stage('Git Checkout'){ - - steps{ - - script{ - - git branch: 'main', url: 'https://github.com/saad946/Jenkins-SonarQube-FluxCD-CICD.git' - } - } - } - stage('UNIT testing'){ - - steps{ - - script{ - - sh 'mvn test' - } - } - } - stage('Integration testing'){ - - steps{ - - script{ - - sh 'mvn verify -DskipUnitTests' - } - } - } - stage('Maven build'){ - - steps{ - - script{ - - sh 'mvn clean install' + + stages{ + + stage('sonar quality check'){ + + agent{ + + docker { + image 'maven' } } - } - stage('Static code analysis'){ - steps{ - + script{ - - withSonarQubeEnv(credentialsId: 'sonar-api') { - - sh 'mvn clean package sonar:sonar' - } - } - - } - } - stage('Quality Gate Status'){ - - steps{ - - script{ - - waitForQualityGate abortPipeline: false, credentialsId: 'sonar-api' - } + + withSonarQubeEnv(credentialsId: 'sonar-token') { + + sh 'mvn clean package sonar:sonar' + } } } } - + } }