Update Jenkinsfile

This commit is contained in:
BrahmanapallyNagaraju 2020-04-09 18:07:34 +05:30 committed by GitHub
parent 2ee009a61c
commit eef13b4908
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

18
Jenkinsfile vendored
View file

@ -1,4 +1,4 @@
def targetMail = "bnagaraju96756@gmail.com,jenkinsautomationuser@gmail.com"
def targetMail = "jenkinsautomationuser@gmail.com"
def emailDevOps(targetMail, msg) {
emailext body: "${msg}\nplease look into the build: ${BUILD_URL}", subject: "${currentBuild.result}: ${BUILD_TAG}", to: "${targetMail}"
}
@ -7,6 +7,10 @@ pipeline {
options {
timestamps()
}
parameters {
string(name: 'Docker_image_base_version',defaultValue: '1',description:"docker base image version for pet-clinic application.\nex: 1,2,3 as in 1.0,2.1,3.5")
}
stages {
stage("build") {
steps {
@ -28,6 +32,18 @@ stages {
}
}
}
stage('publish') {
steps {
withCredentials([usernamePassword(credentialsId: 'hub.docker',passwordVariable: 'docker_PSW', usernameVariable: 'docker_USR')]) {
sh """
docker login -u ${docker_USR} -p ${docker_PSW}
docker images
docker tag pet-clinic:1.0 nagarajub123/pet-clinic:${params.Docker_image_base_version}.${BUILD_NUMBER}
docker push nagarajub123/pet-clinic:1.0
"""
}
}
}
}
post {
always{