-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy pathJenkinsfile-k8s-buildah
64 lines (62 loc) · 1.23 KB
/
Jenkinsfile-k8s-buildah
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
def props = [:]
node {
stage('Read parameters from version.properties'){
checkout scm
props = readProperties(file: 'version.properties')
}
}
pipeline {
agent {
kubernetes {
label "buildah"
yaml """
apiVersion: v1
kind: Pod
metadata:
name: buildah
spec:
containers:
- name: buildah
image: quay.io/buildah/stable:v1.11.4
command:
- cat
tty: true
securityContext:
privileged: true
volumeMounts:
- name: varlibcontainers
mountPath: /var/lib/containers
volumes:
- name: varlibcontainers
"""
}
}
options {
buildDiscarder(logRotator(numToKeepStr: '3'))
durabilityHint('PERFORMANCE_OPTIMIZED')
disableConcurrentBuilds()
}
stages {
stage('Build with Buildah') {
steps {
container("buildah") {
sh """
buildah bud -t ${props["image"]}:${props["baseTag"]} .
"""
}
}
}
stage("Extra Tag") {
when {
expression { return null != props["extraTag"] }
}
steps {
container("buildah") {
sh """
buildah tag ${props["image"]}:${props["baseTag"]} ${props["image"]}:${props["extraTag"]}
"""
}
}
}
}
}