mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-21 07:15:49 +00:00
Update conditions in pipeline - MR pipeline when "changerequest"; Main when "branch main"
This commit is contained in:
parent
4abe02d58a
commit
4310bb0b00
1 changed files with 18 additions and 0 deletions
18
Jenkinsfile
vendored
18
Jenkinsfile
vendored
|
@ -15,6 +15,9 @@ pipeline {
|
||||||
stages {
|
stages {
|
||||||
// Merge request pipeline
|
// Merge request pipeline
|
||||||
stage('Checkstyle') {
|
stage('Checkstyle') {
|
||||||
|
when {
|
||||||
|
changeRequest()
|
||||||
|
}
|
||||||
steps{
|
steps{
|
||||||
echo 'Running gradle checkstyle'
|
echo 'Running gradle checkstyle'
|
||||||
sh './gradlew checkstyleMain --no-daemon'
|
sh './gradlew checkstyleMain --no-daemon'
|
||||||
|
@ -26,24 +29,36 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Test') {
|
stage('Test') {
|
||||||
|
when {
|
||||||
|
changeRequest()
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
echo 'Running gradle test'
|
echo 'Running gradle test'
|
||||||
sh './gradlew test -x test --no-daemon'
|
sh './gradlew test -x test --no-daemon'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
|
when {
|
||||||
|
changeRequest()
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
echo 'Running build automation'
|
echo 'Running build automation'
|
||||||
sh './gradlew build -x test -x check -x checkFormat -x processTestAot --no-daemon'
|
sh './gradlew build -x test -x check -x checkFormat -x processTestAot --no-daemon'
|
||||||
archiveArtifacts artifacts: 'build/libs/*.jar', fingerprint: true }
|
archiveArtifacts artifacts: 'build/libs/*.jar', fingerprint: true }
|
||||||
}
|
}
|
||||||
stage('Docker Build (MR)') {
|
stage('Docker Build (MR)') {
|
||||||
|
when {
|
||||||
|
changeRequest()
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
echo 'Building docker Image'
|
echo 'Building docker Image'
|
||||||
sh 'docker build -t $NEXUS_DOCKER_REPO_MR/spring-petclinic:${GIT_COMMIT} .'
|
sh 'docker build -t $NEXUS_DOCKER_REPO_MR/spring-petclinic:${GIT_COMMIT} .'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Docker Login (MR)') {
|
stage('Docker Login (MR)') {
|
||||||
|
when {
|
||||||
|
changeRequest()
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
echo 'Nexus Docker Repository Login'
|
echo 'Nexus Docker Repository Login'
|
||||||
script{
|
script{
|
||||||
|
@ -55,6 +70,9 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Docker Push (MR)') {
|
stage('Docker Push (MR)') {
|
||||||
|
when {
|
||||||
|
changeRequest()
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
echo 'Pushing Image to docker repo'
|
echo 'Pushing Image to docker repo'
|
||||||
sh 'docker push $NEXUS_DOCKER_REPO_MR/spring-petclinic:${GIT_COMMIT}'
|
sh 'docker push $NEXUS_DOCKER_REPO_MR/spring-petclinic:${GIT_COMMIT}'
|
||||||
|
|
Loading…
Reference in a new issue