forked from apache/incubator-kie-kogito-runtimes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.sonarcloud
74 lines (70 loc) · 2.12 KB
/
Jenkinsfile.sonarcloud
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
@Library('jenkins-pipeline-shared-libraries')_
import org.kie.jenkins.MavenCommand
pipeline {
agent {
label 'kie-rhel7 && kie-mem16g'
}
tools {
maven 'kie-maven-3.6.2'
jdk 'kie-jdk11'
}
options {
timeout(time: 360, unit: 'MINUTES')
}
environment {
// Some generated env is also defined into .jenkins/dsl/jobs.groovy file
KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}")
SONARCLOUD_TOKEN = credentials('SONARCLOUD_TOKEN')
MAVEN_OPTS = '-Xms1024m -Xmx4g'
}
stages {
stage('Checkout') {
steps {
script {
checkout(githubscm.resolveRepository('kogito-runtimes', params.GIT_AUTHOR, params.BUILD_BRANCH_NAME, false))
}
}
}
stage('Build') {
steps {
script {
getMavenCommand()
.withProfiles(['run-code-coverage'])
.run('clean install')
}
}
}
stage('Analyze') {
steps {
script {
getMavenCommand()
.withOptions(['-e', '-nsu'])
.withProfiles(['sonarcloud-analysis'])
.run('validate')
}
}
}
}
post {
unsuccessful {
emailext body: 'Kogito Runtimes daily Sonar #${BUILD_NUMBER} was: ' + "${currentBuild.currentResult}" + '\n' +
'Please look here: ${BUILD_URL} ',
subject: "[${params.BUILD_BRANCH_NAME}][d] Runtimes Sonar",
to: env.KOGITO_CI_EMAIL_TO
}
always {
script {
junit '**/target/surefire-reports/**/*.xml, **/target/failsafe-reports/**/*.xml'
}
}
cleanup {
script {
util.cleanNode('docker')
}
}
}
}
MavenCommand getMavenCommand() {
return new MavenCommand(this, ['-fae'])
.withSettingsXmlId('kogito_release_settings')
}