mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-20 14:55:50 +00:00
Latest Jenkinsfile
This commit is contained in:
parent
c744a71a5f
commit
812ec78b69
1 changed files with 10 additions and 5 deletions
13
Jenkinsfile
vendored
13
Jenkinsfile
vendored
|
@ -4,12 +4,13 @@ pipeline {
|
||||||
environment {
|
environment {
|
||||||
SONARQUBE_URL = 'http://sonarqube:9000'
|
SONARQUBE_URL = 'http://sonarqube:9000'
|
||||||
SONARQUBE_CREDENTIALS_ID = 'admin'
|
SONARQUBE_CREDENTIALS_ID = 'admin'
|
||||||
|
GITHUB_TOKEN = credentials('github-token')
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Checkout') {
|
stage('Checkout') {
|
||||||
steps {
|
steps {
|
||||||
checkout scm
|
git url: 'https://github.com/CChariot/spring-petclinic.git', branch: 'FinalProject_main', credentialsId: 'github-token'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +47,9 @@ pipeline {
|
||||||
stage('Run Application') {
|
stage('Run Application') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
dockerImage.run("-p 8080:8080 --name spring-petclinic")
|
dockerImage.inside("-u root") {
|
||||||
|
sh 'java -jar target/*.jar'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,8 +80,10 @@ pipeline {
|
||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
script {
|
script {
|
||||||
dockerImage.stop()
|
if (dockerImage != null) {
|
||||||
dockerImage.remove()
|
dockerImage.stop()
|
||||||
|
dockerImage.remove()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
success {
|
success {
|
||||||
|
|
Loading…
Reference in a new issue