forked from MaheshBangaru/maven-web-application
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile-mt
49 lines (36 loc) · 1.21 KB
/
Jenkinsfile-mt
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
properties([
buildDiscarder(logRotator(numToKeepStr: '3')),
pipelineTriggers([
pollSCM('* * * * *')
])
])
node('master'){
def mavenHome=tool name: "mavenv3.1.1.1", type: "maven"
stage('Checkout the code') {
git branch: 'master', credentialsId: '4d6512c4-c101-4f43-aac5-5860f5d9e20c', url: 'https://github.com/MithunTechnologiesDevOps/maven-web-application.git'
}
stage('Build')
{
sh "${mavenHome}/bin/mvn clean package"
}
stage('SonarQube Report')
{
sh "${mavenHome}/bin/mvn sonar:sonar"
}
stage('Upload Artifacts into Nexus')
{
sh "${mavenHome}/bin/mvn deploy"
}
stage('DeplotoTomcat'){
sh "cp $WORKSPACE/target/*.war /opt/apache-tomcat-9.0.16/webapps/"
}
stage('EmailNotification'){
mail bcc: '', body: '''Build Done
Regards,
Mithun Technologies
9980923226''', cc: '[email protected]', from: '', replyTo: '', subject: 'Build Notification', to: '[email protected]'
}
stage("SlackNotification"){
slackSend baseUrl: 'https://devops-team-bangalore.slack.com/services/hooks/jenkins-ci/', channel: 'build-notification', message: 'Build done through', tokenCredentialId: '12797dc5-eb70-4f19-8e05-8c07bc58d79d'
}
}