forked from akannan1087/myFeb2023WeekendRepo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
98 lines (84 loc) · 3.22 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
pipeline {
agent {
label "slave1"
}
tools {
maven "Maven3"
}
stages {
stage ("Build") {
steps {
sh "mvn clean install -f MyWebApp/pom.xml"
}
}
stage ("code scan") {
steps {
withSonarQubeEnv("SonarQube") {
sh "mvn sonar:sonar -f MyWebApp/pom.xml"
}
}
}
stage ("Coverage") {
steps {
jacoco()
}
}
stage ("WAR upload") {
steps {
nexusArtifactUploader artifacts: [[artifactId: 'MyWebApp', classifier: '', file: 'MyWebApp/target/MyWebApp.war', type: 'war']], credentialsId: 'c6227520-12cc-4954-a7b3-a6186c6a1e89', groupId: 'com.dept.app', nexusUrl: 'ec2-54-173-218-219.compute-1.amazonaws.com:8081/', nexusVersion: 'nexus3', protocol: 'http', repository: 'maven-snapshots', version: '1.0-SNAPSHOT'
}
}
stage ("DEV deploy") {
steps {
deploy adapters: [tomcat9(credentialsId: '78412160-a977-40fb-97ed-01b0f02221c5', path: '', url: 'http://ec2-3-80-58-182.compute-1.amazonaws.com:8080/')], contextPath: null, war: '**/*.war'
}
}
stage ("Slack") {
steps {
slackSend channel: 'feb-2023-weekend-batch', message: 'DEV Deployment was success, please start sanity testing in DEV env..'
}
}
//Implement CD
stage ('QA Approve') {
steps {
echo "Taking approval from DEV Manager for QA Deployment"
timeout(time: 2, unit: 'DAYS') {
input message: 'Do you approve QA Deployment?', submitter: 'admin,[email protected]'
}
}
}
stage ("QA Deploy") {
steps {
deploy adapters: [tomcat9(credentialsId: '78412160-a977-40fb-97ed-01b0f02221c5', path: '', url: 'http://ec2-3-80-58-182.compute-1.amazonaws.com:8080/')], contextPath: null, war: '**/*.war'
}
}
stage ("QA notify") {
steps {
slackSend channel: 'feb-2023-weekend-batch,qa-testing-team', message: 'QA Deployment was success, please start regression testing in QA env..'
}
}
stage ('PROD Approve') {
steps {
echo "Taking approval from DEV Manager for PROD Deployment"
timeout(time: 2, unit: 'DAYS') {
input message: 'Do you approve PROD Deployment?', submitter: 'admin,[email protected]'
}
}
}
stage ("PROD Deploy") {
steps{
deploy adapters: [tomcat9(credentialsId: '78412160-a977-40fb-97ed-01b0f02221c5', path: '', url: 'http://ec2-3-80-58-182.compute-1.amazonaws.com:8080/')], contextPath: null, war: '**/*.war'
}
}
stage ("Final notify") {
steps {
slackSend channel: 'feb-2023-weekend-batch,qa-testing-team', message: 'PROD Deployment was success, please start final testing in PROD env..before informing end customers..'
}
}
}
post {
always {
echo "This code is always executed.when build is success."
}
}
}