forked from mcouliba/cloud-native-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
devfile.yaml
128 lines (127 loc) · 5.25 KB
/
devfile.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
apiVersion: 1.0.0
metadata:
name: wksp-cloud-native
projects:
- name: workshop
source:
location: 'https://github.com/mcouliba/cloud-native-workshop.git'
type: git
branch: master
components:
- type: dockerimage
alias: maven
image: 'quay.io/eclipse/che-java11-maven:7.4.0'
memoryLimit: 256Mi
mountSources: true
endpoints:
- name: localhost-8080
port: 8080
- name: localhost-9000
port: 9000
- id: redhat/workshop-tools/3.0
type: chePlugin
alias: workshop-tools
commands:
- name: 'OpenShift - Login'
actions:
- type: exec
command: >-
oc login --server=$(oc whoami --show-server) -u
${CHE_WORKSPACE_NAMESPACE} -p 'openshift' --insecure-skip-tls-verify
&& oc project cn-project${CHE_WORKSPACE_NAMESPACE#user}
component: workshop-tools
- name: 'Inventory - Compile (Dev Mode)'
actions:
- workdir: /projects/workshop/labs/inventory-quarkus
type: exec
command: 'mvn compile quarkus:dev'
component: workshop-tools
- name: 'Inventory - Build on OpenShift'
actions:
- workdir: /projects/workshop/labs/inventory-quarkus
type: exec
command: >-
mvn clean package -DskipTests &&
oc start-build inventory --from-file=target/inventory-quarkus-1.0.0-SNAPSHOT-runner.jar --follow
component: workshop-tools
- name: 'Inventory - Deploy on OpenShift'
actions:
- workdir: /projects/workshop/labs/inventory-quarkus
type: exec
command: >-
mvn clean package -DskipTests &&
oc new-build --name=inventory java --binary=true --labels=app.kubernetes.io/instance=inventory &&
oc start-build inventory --from-file=target/inventory-quarkus-1.0.0-SNAPSHOT-runner.jar --follow &&
oc new-app inventory &&
oc label dc/inventory app.kubernetes.io/part-of=coolstore app.kubernetes.io/name=java app.kubernetes.io/instance=inventory &&
oc expose svc inventory
component: workshop-tools
- name: 'Catalog - Build'
actions:
- workdir: /projects/workshop/labs/catalog-spring-boot
type: exec
command: mvn clean package -DskipTests
component: workshop-tools
- name: 'Catalog - Run'
actions:
- workdir: /projects/workshop/labs/catalog-spring-boot
type: exec
command: mvn spring-boot:run
component: workshop-tools
- name: 'Catalog - Deploy on OpenShift'
actions:
- workdir: /projects/workshop/labs/catalog-spring-boot
type: exec
command: >-
mvn clean fabric8:deploy &&
oc label bc/catalog-s2i app.kubernetes.io/instance=catalog
component: workshop-tools
- name: 'Gateway - Build'
actions:
- workdir: /projects/workshop/labs/gateway-vertx
type: exec
command: 'mvn clean package -DskipTests'
component: workshop-tools
- name: 'Gateway - Deploy on OpenShift'
actions:
- workdir: /projects/workshop/labs/gateway-vertx
type: exec
command: >-
mvn clean fabric8:deploy &&
oc label bc/gateway-s2i app.kubernetes.io/instance=gateway &&
oc annotate dc/gateway "app.openshift.io/connects-to"="inventory,catalog"
component: workshop-tools
- name: 'Gateway - Generate Traffic'
actions:
- workdir: /projects/workshop/labs/scripts
type: exec
command: ./runGatewayService.sh cn-project${CHE_WORKSPACE_NAMESPACE#user}
component: workshop-tools
- name: 'Pipeline - Start Mine'
actions:
- type: exec
command: >-
echo "------ START ------" &&
tkn pipeline start my-pipeline --resource app-git=inventory-git --param appName=inventory --serviceaccount pipeline &&
echo "------ END ------"
component: workshop-tools
- name: 'Pipeline - Start Full'
actions:
- type: exec
command: >-
echo "------ START ------" &&
tkn pipeline start application-pipeline --resource app-git=inventory-git --param appName=inventory --serviceaccount pipeline &&
echo "------ END ------"
component: workshop-tools
- name: 'Service Mesh - Deploy'
actions:
- type: exec
command: >-
oc patch dc/inventory --patch '{"spec": {"template": {"metadata": {"annotations": {"sidecar.istio.io/inject": "true"}}}}}' &&
oc patch dc/inventory --patch '{"spec": {"template": {"spec": {"containers": [{"name": "inventory", "command" : ["/bin/bash"], "args": ["-c", "until $(curl -o /dev/null -s -I -f http://127.0.0.1:15000); do echo \"Waiting for Istio Sidecar...\"; sleep 1; done; sleep 10; /usr/local/s2i/run"]}]}}}}' &&
oc rollout latest dc/inventory &&
oc rollout pause dc/gateway &&
oc patch dc/gateway --patch '{"spec": {"template": {"metadata": {"annotations": {"sidecar.istio.io/inject": "true"}}}}}' &&
oc patch dc/gateway --patch '{"spec": {"template": {"spec": {"containers": [{"name": "vertx", "command" : ["/bin/bash"], "args": ["-c", "until $(curl -o /dev/null -s -I -f http://127.0.0.1:15000); do echo \"Waiting for Istio Sidecar...\"; sleep 1; done; sleep 10; /usr/local/s2i/run"]}]}}}}' &&
oc rollout resume dc/gateway
component: workshop-tools