-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
65 lines (63 loc) · 2.03 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
def gv
pipeline {
agent {
docker { image 'docker:latest' }
}
stages {
stage("Init") {
steps {
script {
gv = load "script.groovy"
}
}
}
stage("Increment Version") {
steps {
script {
gv.incrementVersion()
}
}
}
stage("Build docker image") {
steps {
script {
gv.buildImage()
}
}
}
stage("Pushing Artifact to Dockerhub") {
steps {
script {
gv.deployApp()
}
}
}
stage("Checkout k8s manifest SCM") {
steps {
script {
gv.k8sManifest()
}
}
}
stage("Update k8s manifest Repo") {
steps {
script {
gv.update_k8s_manifest()
}
}
}
}
post { // manually need to configure smtp gmail using ssl
always {
echo 'This will always run'
}
success {
echo 'Sending email about Build Success '
mail bcc: '', body: "<b>Example</b><br>Project: ${env.JOB_NAME} <br>Build Number: ${env.BUILD_NUMBER} <br> Build URL: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "Build Successful: Project name -> ${env.JOB_NAME}", to: "saurabhkr952@gmail.com";
}
failure {
echo 'Sending email about Build Unsuccessful '
mail bcc: '', body: "<b>Example</b><br>Project: ${env.JOB_NAME} <br>Build Number: ${env.BUILD_NUMBER} <br> Build URL: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "Build Unsuccessful: Project name -> ${env.JOB_NAME}", to: "saurabhkr952@gmail.com";
}
}
}