forked from JOMACS-IT/web-app
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
81 lines (68 loc) · 1.95 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
pipeline{
agent any
tools{
maven "maven3.8.8"
}
stages{
stage("1. Git clone from repo"){
steps{
sh "echo start of git clone"
git branch: 'main', url: 'https://github.com/JOMACS-IT/web-app.git'
sh "echo end of git clone"
}
}
stage("2. Build from Maven"){
steps{
sh "echo start building from Maven"
sh "mvn clean package"
sh "echo end of build"
}
}
stage("3. Code Scan"){
steps{
sh "echo start of code scan"
sh "mvn sonar:sonar"
sh "echo end of code scan"
}
}
stage("4. Store Artifacts"){
steps{
sh "echo Deploy Artifact"
sh "mvn deploy"
}
}
stage("5. Deploying to Tomcat in UAT"){
steps{
sh "echo start deploying to server in UAT Env"
deploy adapters: [tomcat9(credentialsId: 'tomcat_cred', path: '', url: 'http://18.117.162.68:9090')], contextPath: null, war: 'target/*.war'
}
}
stage("6. Email Notification"){
steps{
sh "echo Email Notification to DevOps Team"
emailext body: 'The Deployment is Successful', subject: 'Deployment Success', to: '[email protected]'
}
}
}
}
/*
node{
def MHD = tool name: "maven3.8.4"
stage('code'){
git branch: 'development', url: 'https://github.com/team16flight/web-app.git'
}
stage('BUILD'){
sh "${MHD}/bin/mvn clean package"
}
stage('deploy'){
sshagent(['tomcat']) {
sh "scp -o StrictHostKeyChecking=no target/*war [email protected]:/opt/tomcat9/webapps/"
}
}
stage('email'){
emailext body: '''Build is over
JOMACS
437212483''', recipientProviders: [developers(), requestor()], subject: 'Build', to: '[email protected]'
}
}
*/