forked from damodaranj/my-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
function-demo
37 lines (33 loc) · 1.08 KB
/
function-demo
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
// Added for demo
node{
stage('SCM Checkout'){
git 'https://github.com/javahometech/my-app'
}
stage('Compile-Package'){
// Get maven home path
def mvnHome = tool name: 'maven-3', type: 'maven'
sh "${mvnHome}/bin/mvn package"
}
stage('SonarQube Analysis') {
def mvnHome = tool name: 'maven-3', type: 'maven'
withSonarQubeEnv('sonar-6') {
sh "${mvnHome}/bin/mvn sonar:sonar"
}
}
stage('Email Notification'){
mail bcc: '', body: '''Hi Welcome to jenkins email alerts
Thanks
Hari''', cc: '', from: '', replyTo: '', subject: 'Jenkins Job', to: '[email protected]'
}
stage('Slack Notification'){
sendSlackNotifications(message='Welcome to Jenkins, Slack!',msgColor='good')
}
def sendSlackNotifications(String message, String msgColor){
slackSend baseUrl: 'https://hooks.slack.com/services/',
channel: '#jenkins-pipeline-demo',
color: msgColor,
message: message,
teamDomain: 'javahomecloud',
tokenCredentialId: 'slack-demo'
}
}