-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
61 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,73 @@ | ||
pipeline{ | ||
|
||
agent any | ||
|
||
stages{ | ||
|
||
stage('sonar quality check'){ | ||
|
||
agent{ | ||
|
||
docker { | ||
image 'maven' | ||
|
||
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 'pwd' | ||
sh 'ls -la' // List files in the current directory for debugging | ||
sh 'echo $MAVEN_HOME' // Print Maven home for debugging | ||
|
||
sh 'mvn clean package sonar:sonar -X' | ||
|
||
sh 'mvn test' | ||
} | ||
} | ||
} | ||
stage('Integration testing'){ | ||
|
||
steps{ | ||
|
||
script{ | ||
|
||
sh 'mvn verify -DskipUnitTests' | ||
} | ||
} | ||
} | ||
stage('Maven build'){ | ||
|
||
steps{ | ||
|
||
script{ | ||
|
||
sh 'mvn clean install' | ||
} | ||
} | ||
} | ||
stage('Static code analysis'){ | ||
|
||
steps{ | ||
|
||
script{ | ||
|
||
withSonarQubeEnv(credentialsId: 'sonars-tokens') { | ||
|
||
sh 'mvn clean package sonar:sonar' | ||
} | ||
} | ||
|
||
} | ||
} | ||
stage('Quality Gate Status'){ | ||
|
||
steps{ | ||
|
||
|
||
script{ | ||
|
||
waitForQualityGate abortPipeline: false, credentialsId: 'sonars-tokens' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |