-
Notifications
You must be signed in to change notification settings - Fork 6
/
jenkins-pipeline
53 lines (50 loc) · 2.25 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
podTemplate(
activeDeadlineSeconds: 600, // 10m limit is more than enough
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-11',
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/polygon.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 clean ${params.SKIP_DEPLOY ? 'install' : 'deploy'}
"""
step([
$class: 'Publisher',
reportFilenamePattern: '**/testng-results.xml'
])
if (currentBuild.result == 'UNSTABLE' || params.ARCHIVE_LOGS) {
sh "find . -wholename '*/target/test.log' -print0 | tar -czf test-logs.tgz --null -T -"
archiveArtifacts allowEmptyArchive: true, artifacts: "test-logs.tgz", followSymlinks: false
}
}
}
}
}