forked from SonarSource/sonar-scanner-maven
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
61 lines (58 loc) · 1.37 KB
/
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
pipeline {
agent {
label 'linux'
}
environment {
MAVEN_TOOL = 'Maven 3.5.2'
}
stages {
stage('log'){
steps{
echo "PR: ${env.CHANGE_ID}"
echo "BRANCH: ${env.BRANCH_NAME}"
}
}
stage('Build master') {
agent {
label 'linux'
}
when {
branch 'master'
}
steps {
withSonarQubeEnv('next') {
withMaven(maven: MAVEN_TOOL) {
sh "mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar"
}
}
}
}
stage('Build maintenance branch') {
when {
branch 'branch-*'
}
steps {
withSonarQubeEnv('next') {
withMaven(maven: MAVEN_TOOL) {
sh "mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.branch.name=${env.BRANCH_NAME}"
}
}
}
}
stage('Build PR'){
when {
branch 'PR-*'
}
steps {
withSonarQubeEnv('next') {
withMaven(maven: MAVEN_TOOL) {
sh "mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar \
-Dsonar.pullrequest.branch=${env.BRANCH_NAME} \
-Dsonar.pullrequest.base='master' \
-Dsonar.pullrequest.key=${env.CHANGE_ID}"
}
}
}
}
}
}