forked from poliscasfino/web-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
JenkinsDeclarativePipelineScript
59 lines (55 loc) · 1.43 KB
/
JenkinsDeclarativePipelineScript
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
//declarative pipeline
pipeline{
agent any
tools {
maven "maven3.8.4"
}
triggers {
pollSCM '* * * * * '
}
stages {
stage('1.CodeClone'){
steps{
git branch: 'stage', credentialsId: 'GitHubCredentials', url: 'https://github.com/LandmakTechnology/web-app'
}
}
stage('2.mavenBuild'){
steps{
sh "mvn clean package"
}
}
stage('3.CodeQuality') {
steps{
sh "echo reports done"
//sh "mvn sonar:sonar"
}
}
stage('4.uploadToNexus'){
steps{
sh "echo artifacts uploaded"
//sh "mvn deploy"
}
}
stage('5.Deploy2Tomcat'){
steps{
sshagent(['32d5fb4f-d92f-4a10-9f12-2738eab55fcc']) {
sh "scp -o StrictHostKeyChecking=no target/*war [email protected]:/opt/tomcat9/webapps/app"
}
}
}
}
post{
always {
mail bcc: '[email protected]', body: '''Build complete
Landmark Technologies''', cc: '[email protected]', from: '', replyTo: '', subject: 'Build done', to: '[email protected]'
}
failure {
mail bcc: '[email protected]', body: '''Build complete
Landmark Technologies''', cc: '[email protected]', from: '', replyTo: '', subject: 'Build failed', to: '[email protected]'
}
success {
mail bcc: '[email protected]', body: '''Build complete
Landmark Technologies''', cc: '[email protected]', from: '', replyTo: '', subject: 'Build succeed', to: '[email protected]'
}
}
}