mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-20 06:45:50 +00:00
Edit Jenkinsfile
This commit is contained in:
parent
93d23095c3
commit
b63e92337f
1 changed files with 7 additions and 13 deletions
12
Jenkinsfile
vendored
12
Jenkinsfile
vendored
|
@ -8,38 +8,32 @@ pipeline {
|
|||
|
||||
stages {
|
||||
stage ('Checkstyle') {
|
||||
when { not { branch 'main' } }
|
||||
steps {
|
||||
sh 'mvn checkstyle:checkstyle'
|
||||
archiveArtifacts artifacts: 'target/checkstyle-report.xml', allowEmptyArchive: true
|
||||
}
|
||||
}
|
||||
stage ('Test') {
|
||||
when { not { branch 'main' } }
|
||||
steps {
|
||||
sh 'mvn test'
|
||||
}
|
||||
}
|
||||
stage ('Build') {
|
||||
when { not { branch 'main' } }
|
||||
steps {
|
||||
sh 'mvn clean package -DskipTests'
|
||||
archiveArtifacts artifacts: 'target/*.jar', allowEmptyArchive: false
|
||||
}
|
||||
}
|
||||
stage ('Creating Docker Image') {
|
||||
stage ('Creating Docker image') {
|
||||
steps {
|
||||
script {
|
||||
def dockerRepo = branch == 'main' ? 'main' : 'mr'
|
||||
sh "docker build -t vkarpenko02/${dockerRepo}:${GIT_COMMIT} ."
|
||||
sh 'docker build -t vkarpenko02/mr:${GIT_COMMIT} .'
|
||||
withCredentials([usernamePassword(credentialsId: 'docker_key', usernameVariable: 'DOCKER_HUB_USER', passwordVariable: 'DOCKER_HUB_PASS')]) {
|
||||
sh """
|
||||
echo ${DOCKER_HUB_PASS} | docker login -u ${DOCKER_HUB_USER} --password-stdin
|
||||
docker push vkarpenko02/${dockerRepo}:${GIT_COMMIT}
|
||||
docker push vkarpenko02/mr:${GIT_COMMIT}
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue