-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathci-pipeline.groovy
70 lines (58 loc) · 2.17 KB
/
ci-pipeline.groovy
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
pipeline {
agent { node { label 'my1stSlave' } }
tools {
maven 'maven3.6'
jdk 'OpenJDK 11'
}
environment {
branch = 'master'
scmUrl = 'https://code.dev.sbb.berlin/HSP/indexupdateservice.git'
}
stages {
stage('Git checkout') {
steps {
git branch: branch, credentialsId: 'Jenkins-Gitlab', url: scmUrl
}
}
stage('Maven build') {
steps {
sh 'mvn clean package'
jacoco(
execPattern: 'target/*.exec',
classPattern: 'target/classes',
sourcePattern: 'src/main/java',
exclusionPattern: 'src/test*')
}
}
stage('SonarQube Analysis') {
steps {
withSonarQubeEnv('Code-Quality') {
// Optionally use a Maven environment you've configured already
sh 'mvn clean package sonar:sonar'
}
}
}
stage('Dependency Check') {
steps {
dependencyCheckAnalyzer datadir: 'dependency-check-data', includeVulnReports: true, hintsFile: '', includeCsvReports: false, includeHtmlReports: true, includeJsonReports: false, isAutoupdateDisabled: true, outdir: '', scanpath: '**/WEB-INF/lib/*.jar', skipOnScmChange: false, skipOnUpstreamChange: false, suppressionFile: '', zipExtensions: ''
dependencyCheckPublisher canComputeNew: false, defaultEncoding: '', healthy: '', pattern: '', unHealthy: ''
archiveArtifacts allowEmptyArchive: true, artifacts: '**/dependency-check-report.html', onlyIfSuccessful: true
}
}
stage('Maven Deploy') {
when {
expression {
currentBuild.result == null || currentBuild.result == 'SUCCESS'
}
}
steps {
sh 'mvn clean deploy'
}
}
}
post {
failure {
mail to: 'konrad.eichstaedt@sbb.spk-berlin.de', subject: 'SRU-Client Pipeline failed', body: "${env.BUILD_URL}"
}
}
}