Skip to content

Commit 3cd3da1

Browse files
authored
Create JenkinsDeclarativePipelineScript
1 parent 8703696 commit 3cd3da1

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

JenkinsDeclarativePipelineScript

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
//declarative pipeline
2+
pipeline{
3+
agent any
4+
tools {
5+
maven "maven3.8.4"
6+
}
7+
stages {
8+
stage('1.CodeClone'){
9+
steps{
10+
git branch: 'stage', credentialsId: 'GitHubCredentials', url: 'https://github.com/LandmakTechnology/web-app'
11+
}
12+
}
13+
stage('2.mavenBuild'){
14+
steps{
15+
sh "mvn clean package"
16+
}
17+
}
18+
stage('3.CodeQuality') {
19+
steps{
20+
sh "echo reports done"
21+
//sh "mvn sonar:sonar"
22+
}
23+
}
24+
stage('4.uploadToNexus'){
25+
steps{
26+
sh "echo artifacts uploaded"
27+
//sh "mvn deploy"
28+
}
29+
}
30+
stage('5.Deploy2Tomcat'){
31+
steps{
32+
sshagent(['32d5fb4f-d92f-4a10-9f12-2738eab55fcc']) {
33+
sh "scp -o StrictHostKeyChecking=no target/*war ec2-user@172.31.15.31:/opt/tomcat9/webapps/app"
34+
}
35+
36+
}
37+
}
38+
}
39+
post{
40+
always {
41+
mail bcc: 'td-app@gmail.com', body: '''Build complete
42+
43+
Landmark Technologies''', cc: 'td-app@gmail.com', from: '', replyTo: '', subject: 'Build done', to: 'td-app@gmail.com'
44+
}
45+
failure {
46+
mail bcc: 'td-app@gmail.com', body: '''Build complete
47+
48+
Landmark Technologies''', cc: 'td-app@gmail.com', from: '', replyTo: '', subject: 'Build failed', to: 'td-app@gmail.com'
49+
}
50+
success {
51+
mail bcc: 'td-app@gmail.com', body: '''Build complete
52+
53+
Landmark Technologies''', cc: 'td-app@gmail.com', from: '', replyTo: '', subject: 'Build succeed', to: 'td-app@gmail.com'
54+
}
55+
}
56+
}

0 commit comments

Comments
 (0)