diff --git a/Jenkinsfile b/Jenkinsfile index 395e854e7..5f4455840 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,7 +3,7 @@ pipeline { environment { 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 { @@ -23,8 +23,28 @@ pipeline { currentBuild.description = "Main branch build" // 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() + } + } + } + } + } + } +}