@@ -20,16 +20,17 @@ An OpenShift4 cluster with following components:
20
20
[source,bash]
21
21
----
22
22
oc new-project tutorial && \
23
- oc create serviceaccount pipeline && \
23
+ ! oc create serviceaccount pipeline && \
24
24
oc adm policy add-scc-to-user privileged -z pipeline && \
25
25
oc adm policy add-role-to-user edit -z pipeline && \
26
26
oc adm policy add-scc-to-user privileged -z default && \
27
27
oc adm policy add-scc-to-user anyuid -z default && \
28
- oc create -f https://raw.githubusercontent.com/redhat-developer-demos/pipelines-catalog/master/knative-client/pipeline-sa-roles.yaml -n tutorial && \
28
+ oc create -f https://raw.githubusercontent.com/redhat-developer-demos/tutorials-pipelines/pipelines-common/pipeline-role-sa.yaml
29
+ -n tutorial && \
29
30
oc policy add-role-to-user pipeline-roles -z pipeline --role-namespace=tutorial
30
31
----
31
32
32
- == Deploy Nexus
33
+ == Deploy Nexus(Optional)
33
34
34
35
To make maven builds faster, we will deploy Sonatype Nexus
35
36
@@ -44,11 +45,15 @@ Create the following Tekton tasks which will be used in the `Pipelines`
44
45
45
46
[source,bash]
46
47
----
47
- oc create -f https://raw.githubusercontent.com/tektoncd/catalog/master/openshift-client/openshift-client-task.yaml \
48
- -f https://raw.githubusercontent.com/redhat-developer-demos/pipelines-catalog/master/quarkus/s2i-quarkus-task.yaml \
49
- -f https://raw.githubusercontent.com/redhat-developer-demos/pipelines-catalog/master/quarkus/quarkus-native-task.yaml \
50
- -f https://raw.githubusercontent.com/redhat-developer-demos/pipelines-catalog/master/quarkus/quarkus-jvm-task.yaml \
51
- -f https://raw.githubusercontent.com/redhat-developer-demos/pipelines-catalog/master/knative-client/kn-service-create-task.yaml
48
+ oc create -n tutorial \
49
+ -f https://raw.githubusercontent.com/tektoncd/catalog/master/kn/kn.yaml
50
+
51
+ oc create -n tutorial \
52
+ -f https://raw.githubusercontent.com/tektoncd/catalog/master/openshift-client/openshift-client-task.yaml
53
+
54
+ oc create -n tutorial \
55
+ -f https://raw.githubusercontent.com/redhat-developer-demos/knative-tutorial/master/06-pipelines/build-app-task.yaml
56
+
52
57
----
53
58
54
59
Check the tasks created
@@ -60,11 +65,10 @@ tkn task ls
60
65
61
66
```
62
67
NAME AGE
63
- kn-create-service 12 seconds ago
64
- openshift-client 13 seconds ago
65
- quarkus-jvm 12 seconds ago
66
- quarkus-native 12 seconds ago
67
- s2i-quarkus 13 seconds ago
68
+ NAME AGE
69
+ build-app 3 seconds ago
70
+ kn 5 seconds ago
71
+ openshift-client 4 seconds ago
68
72
```
69
73
70
74
== Application Deployment
@@ -93,8 +97,17 @@ oc create -f pipelines-common/resources.yaml \
93
97
94
98
[source,bash]
95
99
----
100
+ # create customer deployment config
96
101
oc create -f customer/app.yaml
97
- oc create -f customer/pipeline-run.yaml
102
+
103
+ # start the customer deploy pipeline
104
+ tkn pipeline start rhd-tutorial-deploy \
105
+ --param="applicationSrcDir=customer" \
106
+ --param="deploymentConfig=customer" \
107
+ --param="mavenMirrorUrl=http://nexus:8081/nexus/content/groups/public" \
108
+ --resource="app-git=git-source" \
109
+ --resource="app-image=customer-openshift-image" \
110
+ --serviceaccount='pipeline'
98
111
----
99
112
100
113
Watch the logs of pipeline run using the command
@@ -110,8 +123,17 @@ tkn pipelinerun logs -a -f <id-from-previous-command>
110
123
111
124
[source,bash]
112
125
----
113
- oc create -f preference/app.yaml \
114
- -f preference/pipeline-run.yaml
126
+ # create preference deployment config
127
+ oc create -f preference/app.yaml
128
+
129
+ # start preference deployment pipeline
130
+ tkn pipeline start rhd-tutorial-deploy \
131
+ --param="applicationSrcDir=preference" \
132
+ --param="deploymentConfig=preference" \
133
+ --param="mavenMirrorUrl=http://nexus:8081/nexus/content/groups/public" \
134
+ --resource="app-git=git-source" \
135
+ --resource="app-image=preference-openshift-image" \
136
+ --serviceaccount='pipeline'
115
137
----
116
138
117
139
Watch the logs of pipeline run using the command
@@ -133,15 +155,27 @@ tkn pipelinerun logs -a -f <id-from-previous-command>
133
155
134
156
[source,bash]
135
157
----
136
- oc create -f recommendation/app-v1.yaml \
137
- -f recommendation/pipeline-run.yaml
158
+ oc create -f recommendation/app-v1.yaml
159
+
160
+ tkn pipeline start rhd-tutorial-deploy \
161
+ --param="applicationSrcDir=recommendation" \
162
+ --param="deploymentConfig=recommendation" \
163
+ --param="mavenMirrorUrl=http://nexus:8081/nexus/content/groups/public" \
164
+ --resource="app-git=git-source" \
165
+ --resource="app-image=recommendation-openshift-image-v1" \
166
+ --serviceaccount='pipeline'
138
167
----
139
168
140
169
==== Knative Service Deployment
141
170
142
171
[source,bash]
143
172
----
144
- oc create -f recommendation/kn-pipeline-run.yaml
173
+ tkn pipeline start rhd-tutorial-kn-deploy \
174
+ --param="applicationSrcDir=recommendation" \
175
+ --param="mavenMirrorUrl=http://nexus:8081/nexus/content/groups/public" \
176
+ --resource="app-git=git-source" \
177
+ --resource="app-image=recommendation-openshift-image-v1" \
178
+ --serviceaccount='pipeline'
145
179
----
146
180
147
181
Watch the logs of pipeline run using the command
@@ -160,15 +194,27 @@ tkn pipelinerun logs -a -f <id-from-previous-command>
160
194
161
195
[source,bash]
162
196
----
163
- oc create -f recommendation/app-v2.yaml \
164
- -f recommendation/pipeline-run-v2.yaml
197
+ oc create -f recommendation/app-v2.yaml
198
+
199
+ tkn pipeline start rhd-tutorial-deploy \
200
+ --param="applicationSrcDir=recommendation" \
201
+ --param="deploymentConfig=recommendation" \
202
+ --param="mavenMirrorUrl=http://nexus:8081/nexus/content/groups/public" \
203
+ --resource="app-git=git-source-v2" \
204
+ --resource="app-image=recommendation-openshift-image-v2" \
205
+ --serviceaccount='pipeline'
165
206
----
166
207
167
208
==== Knative Service Deployment
168
209
169
210
[source,bash]
170
211
----
171
- oc create -f recommendation/kn-pipeline-v2-run.yaml
212
+ tkn pipeline start rhd-tutorial-kn-deploy \
213
+ --param="applicationSrcDir=recommendation" \
214
+ --param="mavenMirrorUrl=http://nexus.rhd-workshop-infra:8081/nexus/content/groups/public" \
215
+ --resource="app-git=git-source-v2" \
216
+ --resource="app-image=recommendation-openshift-image-v2" \
217
+ --serviceaccount='pipeline'
172
218
----
173
219
174
220
Watch the logs of pipeline run using the command
0 commit comments