mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-19 06:15:50 +00:00
Initial jenkisfile changes
This commit is contained in:
parent
9081b0a6ff
commit
b9af08c703
1 changed files with 56 additions and 2 deletions
58
Jenkinsfile
vendored
58
Jenkinsfile
vendored
|
@ -1,9 +1,63 @@
|
|||
pipeline {
|
||||
agent { label 'pipeline-agent' }
|
||||
stages {
|
||||
stage ('Build') {
|
||||
stage ('Checkstyle') {
|
||||
when {
|
||||
changeRequest()
|
||||
}
|
||||
steps {
|
||||
sh 'mvn checkstyle:check'
|
||||
sh './mvnw checkstyle:checkstyle'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
archiveArtifacts artifacts: 'target/checkstyle-result.xml', fingerprint: true
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ('Test') {
|
||||
when {
|
||||
changeRequest()
|
||||
}
|
||||
steps {
|
||||
sh './mvnw test -B'
|
||||
}
|
||||
}
|
||||
stage ('Build') {
|
||||
when {
|
||||
changeRequest()
|
||||
}
|
||||
steps {
|
||||
sh './mvnw clean package -DskipTests'
|
||||
}
|
||||
}
|
||||
stage ('Docker Push to MR') {
|
||||
when {
|
||||
changeRequest()
|
||||
}
|
||||
environment {
|
||||
IMAGE = credentials('docker_image_name')
|
||||
REGISTRY = credentials('nexus_url_main')
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
def GIT_COMMIT_SHORT = env.GIT_COMMIT.take(7)
|
||||
echo "Git commit short is ${GIT_COMMIT_SHORT}"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ('Docker Push to Main') {
|
||||
when {
|
||||
branch 'main'
|
||||
}
|
||||
environment {
|
||||
IMAGE = credentials('docker_image_name')
|
||||
REGISTRY = credentials('nexus_url_main')
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
def GIT_COMMIT_SHORT = env.GIT_COMMIT.take(7)
|
||||
echo "Git commit short is ${GIT_COMMIT_SHORT}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue