-
Notifications
You must be signed in to change notification settings - Fork 98
/
Copy pathJenkinsfile
83 lines (71 loc) · 2.78 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
pipeline {
agent any
stages {
stage ("Build") {
steps {
sh "mvn clean install -f MyWebApp/pom.xml"
}
}
stage ("Code scan") {
steps {
withSonarQubeEnv("My_SonarQube") {
sh "mvn sonar:sonar -f MyWebApp/pom.xml"
}
}
}
stage ("code coverage") {
steps {
jacoco()
}
}
stage ("Binary Upload") {
steps {
nexusArtifactUploader artifacts: [[artifactId: 'MyWebApp', classifier: '', file: 'MyWebApp/target/MyWebApp.war', type: 'war']], credentialsId: 'c63a1a05-a222-46fe-963f-7c3795beef41', groupId: 'com.dept.app', nexusUrl: 'ec2-18-212-254-182.compute-1.amazonaws.com:8081/', nexusVersion: 'nexus3', protocol: 'http', repository: 'maven-snapshots', version: '1.0-SNAPSHOT'
}
}
stage ("DEV Deploy") {
steps {
deploy adapters: [tomcat9(credentialsId: 'e8ecbf78-f160-4fb9-8ec6-ab021f5440ed', path: '', url: 'http://ec2-3-91-190-139.compute-1.amazonaws.com:8080/')], contextPath: null, war: '**/*.war'
}
}
stage ("Slack") {
steps {
slackSend channel: 'mar-2023-weekday-batch', message: 'DEV Deployment was success, please start your smoke testing..'
}
}
//CD starts here
stage ("DEV approve") {
steps {
echo "Taking approval from DEV Manager for QA Deployment"
timeout(time: 1, unit: 'HOURS') {
input message: 'Do you approve QA Deployment?', submitter: 'admin,[email protected],mysecon'
}
}
}
stage ("QA deploy") {
steps {
deploy adapters: [tomcat9(credentialsId: 'e8ecbf78-f160-4fb9-8ec6-ab021f5440ed', path: '', url: 'http://ec2-3-91-190-139.compute-1.amazonaws.com:8080/')], contextPath: null, war: '**/*.war'
}
}
stage ("QA notify") {
steps {
slackSend channel: 'mar-2023-weekday-batch', message: 'QA Deployment is done, please start testing..'
}
}
stage ("QA Approve") {
steps {
echo "Taking approval from QA Manager for PROD Deployment"
}
}
stage ("PROD deploy") {
steps {
deploy adapters: [tomcat9(credentialsId: 'e8ecbf78-f160-4fb9-8ec6-ab021f5440ed', path: '', url: 'http://ec2-3-91-190-139.compute-1.amazonaws.com:8080/')], contextPath: null, war: '**/*.war'
}
}
stage ("Final notify") {
steps {
slackSend channel: 'mar-2023-weekday-batch, my-devops-team-channel, product-owners-teams', message: 'PROD Deployment is done, please start testing..'
}
}
}
}