Skip to content

Commit

Permalink
Update mavenJarPipeline.groovy
Browse files Browse the repository at this point in the history
  • Loading branch information
Surajkumar98012 authored Dec 28, 2023
1 parent f04e3f1 commit e525f2a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions vars/mavenJarPipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ def call(Map pipelineParams) {
}
stage('Push') {
steps {
withCredentials([usernamePassword(credentialsId: "${pipelineParams.dockerHubCredentials}", usernameVariable: 'DOCKERHUB_USERNAME', passwordVariable: 'DOCKERHUB_PASSWORD')]) {
sh 'echo $DOCKERHUB_PASSWORD | docker login --username $DOCKERHUB_USERNAME --password-stdin'
sh 'docker build -t ${pipelineParams.dockerHubUsername}/${pipelineParams.dockerImageName}:${pipelineParams.tag} .'
sh 'docker push ${pipelineParams.dockerHubUsername}/${pipelineParams.dockerImageName}:${pipelineParams.tag}'
script {
docker.withRegistry('', "${pipelineParams.dockerHubCredentials}") {
sh "docker build -t ${pipelineParams.dockerHubUsername}/${pipelineParams.dockerImageName}:${pipelineParams.tag} ."
sh "docker push ${pipelineParams.dockerHubUsername}/${pipelineParams.dockerImageName}:${pipelineParams.tag}"
}
}
}
}
Expand Down

0 comments on commit e525f2a

Please sign in to comment.