Skip to content

Commit

Permalink
Create function-demo
Browse files Browse the repository at this point in the history
  • Loading branch information
javahometech authored Apr 18, 2018
1 parent 363d33e commit 9fed35f
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions function-demo
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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'
}

}

0 comments on commit 9fed35f

Please sign in to comment.