forked from cloudogu/sonar-cas-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
58 lines (46 loc) · 1.73 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
#!groovy
@Library(['github.com/cloudogu/ces-build-lib@1.48.0'])
import com.cloudogu.ces.cesbuildlib.*
node() {
Git git = new Git(this, "cesmarvin")
git.committerName = 'cesmarvin'
git.committerEmail = 'cesmarvin@cloudogu.com'
timestamps {
properties([
// Keep only the last 10 build to preserve space
buildDiscarder(logRotator(numToKeepStr: '10')),
// Don't run concurrent builds for a branch, because they use the same workspace directory
disableConcurrentBuilds()
])
catchError {
stage('Checkout') {
checkout scm
git.clean("")
}
Maven mvn = new MavenInDocker(this, "3.5.0-jdk-8")
stage('Build') {
setupMaven(mvn)
mvn 'clean compile -DskipTests'
}
stage('Unit Test') {
mvn 'test'
// Archive Unit and integration test results, if any
junit allowEmptyResults: true, testResults: '**/target/failsafe-reports/TEST-*.xml,**/target/surefire-reports/TEST-*.xml'
}
}
stage('Statical Code Analysis') {
def sonarQube = new SonarQube(this, [sonarQubeEnv: 'ces-sonar'])
sonarQube.analyzeWith(new MavenInDocker(this, "3.5.0-jdk-8"))
sonarQube.timeoutInMinutes = 4
if (!sonarQube.waitForQualityGateWebhookToBeCalled()) {
unstable("Pipeline unstable due to SonarQube quality gate failure")
}
}
}
}
def setupMaven(mvn) {
if ("master".equals(env.BRANCH_NAME)) {
mvn.additionalArgs = "-DperformRelease"
currentBuild.description = mvn.getVersion()
}
}