mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-27 01:45:49 +00:00
jenkinsfile supports sonar
This commit is contained in:
parent
2afdb382b6
commit
8568a6baac
1 changed files with 38 additions and 14 deletions
46
Jenkinsfile
vendored
46
Jenkinsfile
vendored
|
@ -1,18 +1,42 @@
|
||||||
node {
|
pipeline {
|
||||||
stage("Clone the project") {
|
agent any
|
||||||
|
|
||||||
|
tools {
|
||||||
|
maven "mvn-3.9.1"
|
||||||
|
jdk "jdk-temurin-17"
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
/*
|
||||||
|
stage('Checkout Git') {
|
||||||
|
steps {
|
||||||
git branch: 'main', url: 'https://github.com/sukrucakmak/spring-petclinic.git'
|
git branch: 'main', url: 'https://github.com/sukrucakmak/spring-petclinic.git'
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
stage("Compilation") {
|
stage('Build') {
|
||||||
sh "./mvnw clean install -DskipTests"
|
steps {
|
||||||
|
echo "Java Home: $env.JAVA_HOME"
|
||||||
|
sh "mvn -Dmaven.test.failure.ignore=true clean package"
|
||||||
}
|
}
|
||||||
|
|
||||||
stage("Tests and Deployment") {
|
|
||||||
stage("Runing unit tests") {
|
|
||||||
sh "./mvnw test -Punit"
|
|
||||||
}
|
}
|
||||||
stage("Deployment") {
|
stage('Quality Analysis') {
|
||||||
sh 'nohup ./mvnw spring-boot:run -Dserver.port=8001 &'
|
steps {
|
||||||
|
withSonarQubeEnv('sonar') {
|
||||||
|
sh 'mvn sonar:sonar'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Quality Gate Control') {
|
||||||
|
steps {
|
||||||
|
timeout(time: 1, unit: 'HOURS') {
|
||||||
|
waitForQualityGate abortPipeline: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Deploy to Test') {
|
||||||
|
steps {
|
||||||
|
echo "Java Home: $env.JAVA_HOME"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue