-
Notifications
You must be signed in to change notification settings - Fork 20
/
Jenkinsfile
138 lines (118 loc) · 4.3 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
* Copyright 2020 Datalogics, Inc.
*/
pipeline {
agent {
label 'pdfjt-linux'
}
tools {
// Install the Maven version configured as "M3" and add it to the path.
maven "M3"
jdk 'AdoptOpenJDK 8'
}
stages {
stage('Build and Deploy') {
when {
anyOf {
branch 'develop'
}
}
steps {
withMaven(jdk: 'AdoptOpenJDK 8', maven: 'M3') {
// Run Maven on a Unix agent.
sh "./mvnw -B -V -U clean dependency:tree deploy -P integration-tests,distributed-samples"
}
// To run Maven on a Windows agent, use
// bat "mvn -Dmaven.test.failure.ignore=true clean package"
}
}
stage('Build and Deploy Lite') {
when {
anyOf {
branch 'develop'
}
}
steps {
withMaven(jdk: 'AdoptOpenJDK 8', maven: 'M3') {
// Run Maven on a Unix agent.
sh "./mvnw -B -V -U -f lite/pom.xml clean dependency:tree deploy -P integration-tests,generate-distribution"
}
// To run Maven on a Windows agent, use
// bat "mvn -Dmaven.test.failure.ignore=true clean package"
}
}
stage('Test Pull Request') {
when {
changeRequest()
}
steps {
withMaven(jdk: 'AdoptOpenJDK 8', maven: 'M3') {
// Run Maven on a Unix agent.
sh "./mvnw -V -B -U clean dependency:tree install -P integration-tests,distributed-samples"
}
// To run Maven on a Windows agent, use
// bat "mvn -Dmaven.test.failure.ignore=true clean package"
}
}
stage('Test Pull Request Lite') {
when {
changeRequest()
}
steps {
withMaven(jdk: 'AdoptOpenJDK 8', maven: 'M3') {
// Run Maven on a Unix agent.
sh "./mvnw -f lite/pom.xml -V -B -U clean dependency:tree install -P integration-tests,generate-distribution"
}
// To run Maven on a Windows agent, use
// bat "mvn -Dmaven.test.failure.ignore=true clean package"
}
}
stage('Check dependencies for CVEs') {
when {
anyOf {
branch 'develop'
changeRequest()
}
}
steps {
withMaven(jdk: 'AdoptOpenJDK 8', maven: 'M3') {
// Run Maven on a Unix agent.
sh "./mvnw org.owasp:dependency-check-maven:check -DskipTestScope=false -Pintegration-tests,distributed-samples"
}
}
}
stage('Run OWASP Dependenency checker') {
when {
not {
changeRequest()
}
}
steps {
withMaven(jdk: 'AdoptOpenJDK 8', maven: 'M3') {
// Run Maven on a Unix agent.
sh "./mvnw -B -V -U org.owasp:dependency-check-maven:check -DskipTestScope=false -DskipDependencyManagement=true -Dformat=JSON"
sh "./mvnw -B -V -U -f lite org.owasp:dependency-check-maven:check -DskipTestScope=false -DskipDependencyManagement=true -Dformat=JSON"
}
}
}
stage('Analysis') {
steps {
recordIssues ignoreFailedBuilds: false, qualityGates: [[threshold: 1, type: 'TOTAL', unstable: false]],
enabledForFailure: true,
tools: [checkStyle(), findBugs(useRankAsPriority: true), pmdParser(), cpd(), javaDoc(), java(),
owaspDependencyCheck()]
}
}
stage('Changed files check') {
when {
anyOf {
branch 'develop'
changeRequest()
}
}
steps {
sh "git diff --stat --exit-code || (echo '[ERROR] Build changed some Git files' 1>&2; exit 1)"
}
}
}
}