Skip to content

Commit

Permalink
Add sonarcloud analysis
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Berezovskyi <andriib@kth.se>
  • Loading branch information
berezovskyi committed Feb 15, 2022
1 parent bb47699 commit 222a71f
Showing 1 changed file with 39 additions and 30 deletions.
69 changes: 39 additions & 30 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,41 @@
pipeline {
agent any
tools {
maven 'apache-maven-latest'
jdk 'temurin-jdk11-latest'
}
stages {
stage('Build') {
steps {
sh '''
java -version
mvn -v
'''
}
}
}
post {
// send a mail on unsuccessful and fixed builds
unsuccessful { // means unstable || failure || aborted
emailext subject: 'Build $BUILD_STATUS $PROJECT_NAME #$BUILD_NUMBER!',
body: '''Check console output at $BUILD_URL to view the results.''',
recipientProviders: [culprits(), requestor()],
to: 'andrew+ham@berezovskyi.me'
}
fixed { // back to normal
emailext subject: 'Build $BUILD_STATUS $PROJECT_NAME #$BUILD_NUMBER!',
body: '''Check console output at $BUILD_URL to view the results.''',
recipientProviders: [culprits(), requestor()],
to: 'andrew+ham@berezovskyi.me'
}
}
agent any
tools {
maven 'apache-maven-latest'
jdk 'temurin-jdk11-latest'
}
stages {
stage('Build') {
steps {
sh '''
java -version
mvn -v
'''
}
}
stage('Sonar') {
withCredentials([string(credentialsId: 'sonarcloud-token', variable: 'SONARCLOUD_TOKEN')]) {
withSonarQubeEnv('SonarCloud.io') {
mvn clean verify -B sonar:sonar
-Dsonar.projectKey=org.eclipse.lyo -Dsonar.organization=eclipse
-Dsonar.host.url=${SONAR_HOST_URL} -Dsonar.login=${SONARCLOUD_TOKEN}
}
}
}
}
post {
// send a mail on unsuccessful and fixed builds
unsuccessful { // means unstable || failure || aborted
emailext subject: 'Build $BUILD_STATUS $PROJECT_NAME #$BUILD_NUMBER!',
body: '''Check console output at $BUILD_URL to view the results.''',
recipientProviders: [culprits(), requestor()],
to: 'andrew+ham@berezovskyi.me'
}
fixed { // back to normal
emailext subject: 'Build $BUILD_STATUS $PROJECT_NAME #$BUILD_NUMBER!',
body: '''Check console output at $BUILD_URL to view the results.''',
recipientProviders: [culprits(), requestor()],
to: 'andrew+ham@berezovskyi.me'
}
}
}

0 comments on commit 222a71f

Please sign in to comment.