Update Jenkinsfile

Signed-off-by: prankumargrid <prankumar@griddynamics.com>
This commit is contained in:
prankumargrid 2025-04-29 13:05:37 +05:30 committed by GitHub
parent 86268d9daf
commit 77c31d5b04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

26
Jenkinsfile vendored
View file

@ -3,7 +3,7 @@ pipeline {
environment { environment {
IMAGE_TAG = '' // Will be set in 'Initialize' IMAGE_TAG = '' // Will be set in 'Initialize'
REGISTRY = "prankumar313" // Replace with actual DockerHub or Nexus repo REGISTRY = "your-dockerhub-username" // Replace with actual DockerHub or Nexus repo
} }
stages { stages {
@ -23,8 +23,28 @@ pipeline {
currentBuild.description = "Main branch build" currentBuild.description = "Main branch build"
// Main branch: Just build and push image // Main branch: Just build and push image
docker.withRegistry(' docker.withRegistry('https://index.docker.io/v1/', 'docker-hub-credentials-id') {
def app = docker.build("${env.REGISTRY}/main:${env.IMAGE_TAG}")
app.push()
}
} else {
currentBuild.description = "Merge request build"
// MR branch: Full build
sh 'gradle checkstyleMain checkstyleTest'
archiveArtifacts artifacts: '**/build/reports/checkstyle/*.xml', allowEmptyArchive: true
sh 'gradle test'
sh 'gradle build -x test'
docker.withRegistry('https://index.docker.io/v1/', 'docker-hub-credentials-id') {
def app = docker.build("${env.REGISTRY}/mr:${env.IMAGE_TAG}")
app.push()
}
}
}
}
}
}
}