-
Notifications
You must be signed in to change notification settings - Fork 4
/
Jenkinsfile
54 lines (45 loc) · 1.82 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
#!/usr/bin/env groovy
openshift.withCluster() {
podTemplate(
inheritFrom: 'maven',
cloud: 'openshift', //cloud must be openshift
envVars: [ //This fixes the error with en_US.utf8 not being found
envVar(key:"LC_ALL", value:"C.utf8")
],
volumes: [ //mount the settings.xml
secretVolume(mountPath: '/etc/m2', secretName: 'maven-settings')
]) {
try {
//GO to a node with maven and settings.xml
node(POD_LABEL) {
//Do not use concurrent builds
properties([disableConcurrentBuilds()])
def mvnCmd = "mvn -s /etc/m2/settings.xml --batch-mode"
stage('checkout') {
checkout scm
}
stage('Mvn clean package') {
sh "${mvnCmd} -PallTests clean package"
}
stage('Analyze build results') {
recordIssues aggregatingResults: true,
tools: [java(),
javaDoc(),
mavenConsole(),
taskScanner(highTags:'FIXME', normalTags:'TODO', includePattern: '**/*.java', excludePattern: 'target/**/*')]
}
stage('Push to Nexus (if Master)') {
echo "Branch name ${env.BRANCH_NAME}"
if (env.BRANCH_NAME == 'master') {
sh "${mvnCmd} clean deploy -DskipTests=true"
} else {
echo "Branch ${env.BRANCH_NAME} is not master, so no mvn deploy"
}
}
}
} catch (e) {
currentBuild.result = 'FAILURE'
throw e
}
}
}