-
Notifications
You must be signed in to change notification settings - Fork 2
/
tracecompass-sonar.Jenkinsfile
76 lines (76 loc) · 3.27 KB
/
tracecompass-sonar.Jenkinsfile
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
75
76
/*******************************************************************************
* Copyright (c) 2019, 2024 Ericsson.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
pipeline {
agent {
kubernetes {
label 'tracecompass-sonar-build'
yamlFile 'jenkins/pod-templates/tracecompass-sonar-pod.yaml'
defaultContainer 'tracecompass'
}
}
options {
timestamps()
timeout(time: 4, unit: 'HOURS')
disableConcurrentBuilds()
}
tools {
maven 'apache-maven-3.9.5'
jdk 'openjdk-jdk17-latest'
}
environment {
MAVEN_OPTS="-Xms768m -Xmx4096m -XX:+UseSerialGC"
}
stages {
stage('Checkout') {
steps {
checkout([$class: 'GitSCM', branches: [[name: '$GERRIT_BRANCH_NAME']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'BuildChooserSetting', buildChooser: [$class: 'GerritTriggerBuildChooser']]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'github-bot', refspec: '$GERRIT_REFSPEC', url: '$GERRIT_REPOSITORY_URL']]])
}
}
stage('Build') {
steps {
container('tracecompass') {
sh 'mvn clean install -B -Pctf-grammar -Pbuild-rcp -Dmaven.test.error.ignore=true -Dmaven.test.failure.ignore=true -Dmaven.repo.local=/home/jenkins/.m2/repository --settings /home/jenkins/.m2/settings.xml ${MAVEN_ARGS}'
}
}
}
stage('Sonar') {
steps {
container('tracecompass') {
withCredentials([string(credentialsId: 'sonarcloud-token', variable: 'SONARCLOUD_TOKEN')]) {
withSonarQubeEnv('SonarCloud.io') {
sh 'mvn install -B jacoco:report sonar:sonar -Djacoco.dataFile=../../target/jacoco.exec -Dsonar.projectKey=${SONAR_PROJECT_KEY} -Dsonar.organization=eclipse -Dsonar.host.url=${SONAR_HOST_URL} -Dsonar.login=${SONARCLOUD_TOKEN} -Dmaven.test.error.ignore=true -Dmaven.test.failure.ignore=true -Dmaven.repo.local=/home/jenkins/.m2/repository --settings /home/jenkins/.m2/settings.xml'
}
}
}
}
}
}
post {
failure {
container('tracecompass') {
emailext subject: 'Build $BUILD_STATUS: $PROJECT_NAME #$BUILD_NUMBER!',
body: '''$CHANGES \n
------------------------------------------\n
Check console output at $BUILD_URL to view the results.''',
recipientProviders: [culprits(), requestor()],
to: '${EMAIL_RECIPIENT}'
}
}
fixed {
container('tracecompass') {
emailext subject: 'Build is back to normal: $PROJECT_NAME #$BUILD_NUMBER!',
body: '''Check console output at $BUILD_URL to view the results.''',
recipientProviders: [culprits(), requestor()],
to: '${EMAIL_RECIPIENT}'
}
}
}
}