mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-20 06:45:50 +00:00
Modified Jenkinsfile for testing.
This commit is contained in:
parent
6b0a0777f4
commit
c744a71a5f
1 changed files with 34 additions and 4 deletions
38
Jenkinsfile
vendored
38
Jenkinsfile
vendored
|
@ -13,16 +13,40 @@ pipeline {
|
|||
}
|
||||
}
|
||||
|
||||
stage('Build') {
|
||||
stage('Build Docker Image') {
|
||||
steps {
|
||||
sh './mvnw clean install'
|
||||
script {
|
||||
dockerImage = docker.build("spring-petclinic")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('SonarQube Analysis') {
|
||||
steps {
|
||||
withSonarQubeEnv('SonarQube') {
|
||||
sh './mvnw sonar:sonar -Dsonar.projectKey=spring-petclinic'
|
||||
script {
|
||||
dockerImage.inside("-u root") {
|
||||
sh './mvnw sonar:sonar -Dsonar.projectKey=spring-petclinic'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build Application') {
|
||||
steps {
|
||||
script {
|
||||
dockerImage.inside("-u root") {
|
||||
sh './mvnw clean package -DskipTests'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Run Application') {
|
||||
steps {
|
||||
script {
|
||||
dockerImage.run("-p 8080:8080 --name spring-petclinic")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +55,7 @@ pipeline {
|
|||
steps {
|
||||
sh '''
|
||||
docker run --rm -v $(pwd)/zap-report:/zap/wrk:rw \
|
||||
-t owasp/zap2docker-stable zap-baseline.py -t http://petclinic:8080 \
|
||||
owasp/zap2docker-stable zap-baseline.py -t http://localhost:8080 \
|
||||
-g gen.conf -r zap-report.html
|
||||
'''
|
||||
}
|
||||
|
@ -51,6 +75,12 @@ pipeline {
|
|||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
script {
|
||||
dockerImage.stop()
|
||||
dockerImage.remove()
|
||||
}
|
||||
}
|
||||
success {
|
||||
echo 'Pipeline completed successfully!'
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue