-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
openshift-home-yaml.groovy
45 lines (45 loc) · 1.47 KB
/
openshift-home-yaml.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
/**
* OpenShift runs containers with a custom UID, overridding the UID defined in docker images.
* This is an example of how to run docker images from DockerHub in OpenShift. It comes with no warranty.
*
* Define HOME for containers running in OpenShift
* Define user.home system property for maven as it relies on /etc/passwd to infer its value
*/
podTemplate(yaml:'''
spec:
containers:
- name: jnlp
image: jenkins/inbound-agent
volumeMounts:
- name: home-volume
mountPath: /home/jenkins
env:
- name: HOME
value: /home/jenkins
- name: maven
image: maven:3.8.1-jdk-8
command:
- sleep
args:
- 99d
volumeMounts:
- name: home-volume
mountPath: /home/jenkins
env:
- name: HOME
value: /home/jenkins
- name: MAVEN_OPTS
value: -Duser.home=/home/jenkins
volumes:
- name: home-volume
emptyDir: {}
''') {
node(POD_LABEL) {
stage('Build a Maven project') {
container('maven') {
git 'https://github.com/jenkinsci/kubernetes-plugin.git'
sh 'mvn -B -ntp clean package -DskipTests'
}
}
}
}