Skip to content

Instantly share code, notes, and snippets.

@leolanese
Created October 28, 2019 15:12
Show Gist options
  • Save leolanese/509c13f03c6aab6e76b5caf37ee9ff66 to your computer and use it in GitHub Desktop.
Save leolanese/509c13f03c6aab6e76b5caf37ee9ff66 to your computer and use it in GitHub Desktop.
sonar-jenkins
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'){
slackSend baseUrl: 'https://hooks.slack.com/services/',
channel: '#jenkins-pipeline-demo',
color: 'good',
message: 'Welcome to Jenkins, Slack!',
teamDomain: 'javahomecloud',
tokenCredentialId: 'slack-demo'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment