-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathose-build-template.yaml
187 lines (185 loc) · 4.7 KB
/
ose-build-template.yaml
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
---
kind: Template
apiVersion: v1
metadata:
name: automated-build
creationTimestamp:
annotations:
description: |
An OpenShift v3 template that sets up an automated build pipeline
to build, test and promote docker images from a Dockerfile.
provider: aweiteka@redhat.com
parameters:
- name: BUILD_SOURCE_REPO
description: Git source URI of Dockerfile repository, e.g. https://github.com/myname/myrepo.git
- name: BUILD_CONTEXT_DIR
description: Optional relative path to Dockerfile in source repository. If Dockerfile in base of repo, leave empty.
value: ""
- name: BUILD_REF
description: Optional git branch or tag of build source repo
value: master
- name: BASE_DOCKER_IMAGE
description: Base docker image from the Dockerfile FROM line.
value: centos
- name: BASE_DOCKER_IMAGE_TAG
description: Base docker image tag from the Dockerfile FROM line.
value: latest
- name: BUILD_IMAGE_NAME
description: The name of the image after it is built, not including :<tag>
- name: BUILD_IMAGE_TAG
description: The tag of the image after it is built
value: latest
- name: PULL_REGISTRY
description: When promoting, the internal openshift registry. If not known this can be updated later with 'oc edit bc promote-image-custom-build'
value: ""
- name: PUSH_REGISTRY
description: When promoting, the URL of the registry to push toa
value: "docker.io"
- name: GIT_SECRET
description: Git repo callback token
generate: expression
from: "[a-zA-Z0-9]{12}"
- name: GENERIC_SECRET
description: Generic callback token
generate: expression
from: "[a-zA-Z0-9]{12}"
labels:
template: automated-build
objects:
- kind: ImageStream
apiVersion: v1
metadata:
name: "${BUILD_IMAGE_NAME}"
spec:
- kind: BuildConfig
apiVersion: v1
metadata:
name: "${BUILD_IMAGE_NAME}"
creationTimestamp:
labels:
name: "${BUILD_IMAGE_NAME}"
spec:
triggers:
- type: generic
generic:
secret: "${GENERIC_SECRET}"
source:
type: Git
git:
uri: "${BUILD_SOURCE_REPO}"
ref: "${BUILD_REF}"
contextDir: "${BUILD_CONTEXT_DIR}"
strategy:
type: Docker
dockerStrategy:
from:
kind: ImageStreamTag
name: "${BASE_DOCKER_IMAGE}:${BASE_DOCKER_IMAGE_TAG}"
output:
to:
kind: ImageStreamTag
name: "${BUILD_IMAGE_NAME}:${BUILD_IMAGE_TAG}"
resources: {}
- kind: BuildConfig
apiVersion: v1
metadata:
creationTimestamp: null
labels:
name: "${BUILD_IMAGE_NAME}"
name: promote-image-custom-build
spec:
output:
to:
kind: ImageStreamTag
name: "${BUILD_IMAGE_NAME}:${BUILD_IMAGE_TAG}"
resources: {}
source:
git:
uri: "${BUILD_SOURCE_REPO}"
type: Git
strategy:
customStrategy:
from:
kind: DockerImage
name: aweiteka/ose-custom-push
env:
- name: PULL_REGISTRY
value: ${PULL_REGISTRY}
- name: PULL_IMAGE
value: ${BUILD_IMAGE_NAME}
- name: PUSH_REGISTRY
value: ${PUSH_REGISTRY}
exposeDockerSocket: true
type: Custom
triggers:
- imageChange: {}
type: ImageChange
- kind: DeploymentConfig
apiVersion: v1
metadata:
name: "${BUILD_IMAGE_NAME}"
creationTimestamp: null
spec:
strategy:
type: Recreate
resources: {}
triggers:
- type: imageChange
imageChangeParams:
automatic: true
containerNames:
- ${BUILD_IMAGE_NAME}
from:
kind: ImageStreamTag
name: "${BUILD_IMAGE_NAME}:${BUILD_IMAGE_TAG}"
lastTriggeredImage: ""
- type: generic
generic:
secret: "${GENERIC_SECRET}"
- type: ConfigChange
replicas: 1
selector:
name: "${BUILD_IMAGE_NAME}"
template:
metadata:
labels:
name: "${BUILD_IMAGE_NAME}"
spec:
containers:
- name: "${BUILD_IMAGE_NAME}"
image: "${BUILD_IMAGE_NAME}"
terminationMessagePath: /dev/termination-log
imagePullPolicy: IfNotPresent
securityContext:
capabilities: {}
privileged: false
restartPolicy: Always
dnsPolicy: ClusterFirst
- kind: "Service"
apiVersion: "v1"
metadata:
name: ${BUILD_IMAGE_NAME}
creationTimestamp: null
spec:
ports:
- name: ${BUILD_IMAGE_NAME}
protocol: TCP
port: 8080
targetPort: 8080
nodePort: 0
selector:
name: ${BUILD_IMAGE_NAME}
portalIP: ""
type: ClusterIP
sessionAffinity: None
status:
loadBalancer: {}
kind: Route
apiVersion: v1
metadata:
name: ${BUILD_IMAGE_NAME}
creationTimestamp: null
spec:
to:
kind: Service
name: ${BUILD_IMAGE_NAME}