-
Notifications
You must be signed in to change notification settings - Fork 23
/
jenkins-pipeline
56 lines (54 loc) · 2.29 KB
/
jenkins-pipeline
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
podTemplate(
activeDeadlineSeconds: 600, // 10m limit is more than enough for samples
idleMinutes: 1,
// Secret volume with maven settings.xml for deploy, see also sim-link in "build" stage.
volumes: [secretVolume(secretName: "jenkins-nexus", mountPath: "/root/jenkins-nexus")],
workspaceVolume: dynamicPVC(requestsSize: "5Gi"),
containers: [
containerTemplate(name: 'jnlp',
image: 'jenkins/inbound-agent:4.13-2-alpine',
runAsUser: '0',
resourceRequestCpu: '1',
resourceLimitCpu: '1',
resourceRequestMemory: '1Gi',
resourceLimitMemory: '1Gi'),
containerTemplate(name: 'maven',
image: params.BUILDER_IMAGE ?: 'maven:3.8.5-openjdk-17',
runAsUser: '0',
ttyEnabled: true,
command: 'cat',
resourceRequestCpu: '2',
resourceLimitCpu: '2',
resourceRequestMemory: '1Gi',
resourceLimitMemory: '1Gi'),
]
) {
node(POD_LABEL) {
stage("checkout") {
git branch: params.BRANCH ?: 'master',
url: 'https://github.com/Evolveum/midpoint-samples.git'
}
stage("build") {
container('maven') {
sh """#!/bin/bash -ex
# .m2 is mutable and short-term, we just sym-link the settings.xml there.
mkdir -p /root/.m2
ln -s ../jenkins-nexus/settings.xml /root/.m2/settings.xml
mvn -B -ntp -DskipTests clean ${params.SKIP_DEPLOY ? 'install' : 'deploy'}
"""
}
}
stage("tests") {
if (!params.SKIP_TEST) {
container('maven') {
sh """#!/bin/bash -ex
mvn -B -ntp -Dmaven.test.failure.ignore -f samples-test/pom.xml clean package
"""
step([$class: 'Publisher', reportFilenamePattern: '**/testng-results.xml'])
}
} else {
println 'Skipping the tests as requested.'
}
}
}
}