mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-17 21:35:50 +00:00
Update Jenkinsfile
Signed-off-by: prankumargrid <prankumar@griddynamics.com>
This commit is contained in:
parent
8d18fa01dd
commit
00e590de05
1 changed files with 19 additions and 31 deletions
50
Jenkinsfile
vendored
50
Jenkinsfile
vendored
|
@ -8,15 +8,13 @@ pipeline {
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Check Branch') {
|
stage('Check Branch') {
|
||||||
steps {
|
script {
|
||||||
script {
|
if (env.BRANCH_NAME == 'main') {
|
||||||
if (env.BRANCH_NAME == 'main') {
|
currentBuild.description = "Main branch build"
|
||||||
currentBuild.description = "Main branch build"
|
buildMainPipeline()
|
||||||
buildMainPipeline()
|
} else {
|
||||||
} else {
|
currentBuild.description = "Merge request build"
|
||||||
currentBuild.description = "Merge request build"
|
buildMRPipeline()
|
||||||
buildMRPipeline()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,12 +23,10 @@ pipeline {
|
||||||
|
|
||||||
def buildMainPipeline() {
|
def buildMainPipeline() {
|
||||||
stage('Docker Build and Push') {
|
stage('Docker Build and Push') {
|
||||||
steps {
|
script {
|
||||||
script {
|
docker.withRegistry('https://index.docker.io/v1/', 'docker-hub-credentials-id') {
|
||||||
docker.withRegistry('https://index.docker.io/v1/', 'docker-hub-credentials-id') {
|
def app = docker.build("${env.REGISTRY}/main:${env.IMAGE_TAG}")
|
||||||
def app = docker.build("${env.REGISTRY}/main:${env.IMAGE_TAG}")
|
app.push()
|
||||||
app.push()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,31 +34,23 @@ def buildMainPipeline() {
|
||||||
|
|
||||||
def buildMRPipeline() {
|
def buildMRPipeline() {
|
||||||
stage('Checkstyle') {
|
stage('Checkstyle') {
|
||||||
steps {
|
sh 'gradle checkstyleMain checkstyleTest'
|
||||||
sh 'gradle checkstyleMain checkstyleTest'
|
archiveArtifacts artifacts: '**/build/reports/checkstyle/*.xml', allowEmptyArchive: true
|
||||||
archiveArtifacts artifacts: '**/build/reports/checkstyle/*.xml', allowEmptyArchive: true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Test') {
|
stage('Test') {
|
||||||
steps {
|
sh 'gradle test'
|
||||||
sh 'gradle test'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Build (No Tests)') {
|
stage('Build (No Tests)') {
|
||||||
steps {
|
sh 'gradle build -x test'
|
||||||
sh 'gradle build -x test'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Docker Build and Push') {
|
stage('Docker Build and Push') {
|
||||||
steps {
|
script {
|
||||||
script {
|
docker.withRegistry('https://index.docker.io/v1/', 'docker-hub-credentials-id') {
|
||||||
docker.withRegistry('https://index.docker.io/v1/', 'docker-hub-credentials-id') {
|
def app = docker.build("${env.REGISTRY}/mr:${env.IMAGE_TAG}")
|
||||||
def app = docker.build("${env.REGISTRY}/mr:${env.IMAGE_TAG}")
|
app.push()
|
||||||
app.push()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue