-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathopenshift-pipeline.yaml
176 lines (168 loc) · 4.47 KB
/
openshift-pipeline.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
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: postalcode-spawn-demo-shared
annotations:
pv.kubernetes.io/bind-completed: 'yes'
pv.kubernetes.io/bound-by-controller: 'yes'
volume.beta.kubernetes.io/storage-provisioner: nfs-storage
volume.kubernetes.io/storage-provisioner: nfs-storage
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: managed-storage
volumeMode: Filesystem
---
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: lookup-policy-imagestream
spec:
params:
- description: Image stream
name: image_stream
type: string
- description: Local policy
name: local_policy
type: string
steps:
- args:
- >-
echo Updating ImageStream $(inputs.params.image_stream)
oc patch is/$(inputs.params.image_stream) -p '{"spec":
{"lookupPolicy":{"local":$(inputs.params.local_policy)}}}'
echo -----------------------------------
command:
- /bin/bash
- '-c'
image: 'image-registry.openshift-image-registry.svc:5000/openshift/cli:latest'
name: patch
---
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: apply-manifests
spec:
params:
- default: k8s
description: The directory in source that contains yaml manifests
name: manifest_dir
type: string
steps:
- args:
- >-
echo Applying manifests in $(inputs.params.manifest_dir) directory
oc apply -f $(inputs.params.manifest_dir)
echo -----------------------------------
command:
- /bin/bash
- '-c'
image: 'image-registry.openshift-image-registry.svc:5000/openshift/cli:latest'
name: apply
workingDir: /workspace/source
workspaces:
- name: source
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: postalcode-spawn-demo
spec:
params:
- default: postalcode-spawn-demo
description: name of the deployment to be patched
name: deployment-name
type: string
- default: 'https://github.com/h3nrique/postalcode-spawn-demo'
description: url of the git repo for the code of deployment
name: git-url
type: string
- default: master
description: revision to be used from repo of the code for deployment
name: git-revision
type: string
- default: >-
image-registry.openshift-image-registry.svc:5000/spawn/postalcode-spawn-demo
description: image to be build from the code
name: IMAGE
type: string
tasks:
- name: fetch-repository
params:
- name: url
value: $(params.git-url)
- name: subdirectory
value: ''
- name: deleteExisting
value: 'true'
- name: revision
value: $(params.git-revision)
taskRef:
kind: ClusterTask
name: git-clone
workspaces:
- name: output
workspace: shared-workspace
- name: jib-maven
params:
- name: IMAGE
value: $(params.IMAGE)
- name: MAVEN_IMAGE
value: docker.io/library/maven:3-openjdk-17
runAfter:
- fetch-repository
taskRef:
kind: ClusterTask
name: jib-maven
workspaces:
- name: source
workspace: shared-workspace
- name: update-imagestream
params:
- name: image_stream
value: $(params.deployment-name)
- name: local_policy
value: 'true'
runAfter:
- jib-maven
taskRef:
kind: Task
name: lookup-policy-imagestream
- name: apply-manifests
runAfter:
- update-imagestream
taskRef:
kind: Task
name: apply-manifests
workspaces:
- name: source
workspace: shared-workspace
workspaces:
- name: shared-workspace
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: postalcode-spawn-demo-1
labels:
tekton.dev/pipeline: postalcode-spawn-demo
spec:
params:
- name: deployment-name
value: postalcode-spawn-demo
- name: git-url
value: 'https://github.com/h3nrique/postalcode-spawn-demo'
- name: git-revision
value: master
- name: IMAGE
value: >-
image-registry.openshift-image-registry.svc:5000/spawn/postalcode-spawn-demo
pipelineRef:
name: postalcode-spawn-demo
workspaces:
- name: shared-workspace
persistentVolumeClaim:
claimName: postalcode-spawn-demo-shared