-
Notifications
You must be signed in to change notification settings - Fork 9
/
devfile.yaml
180 lines (180 loc) · 9.55 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
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
schemaVersion: 2.2.0
metadata:
name: wksp-end-to-end-dev
projects:
- attributes:
source-origin: branch
git:
checkoutFrom:
revision: '6.8'
remotes:
origin: 'https://github.com/RedHat-EMEA-SSA-Team/end-to-end-developer-workshop.git'
name: workshop
components:
- container:
cpuLimit: 1000m
cpuRequest: 50m
endpoints:
- attributes:
protocol: http
exposure: public
name: 8080-port
protocol: http
targetPort: 8080
- attributes:
protocol: http
exposure: public
name: 9000-port
protocol: http
targetPort: 9000
- attributes:
protocol: http
public: 'false'
exposure: internal
name: 5005-port
protocol: http
targetPort: 5005
env:
- name: MAVEN_OPTS
value: '-Xmx2048m -Duser.home=/home/developer'
- name: MAVEN_MIRROR_URL
value: 'http://nexus.opentlc-shared.svc:8081/repository/maven-all-public'
image: 'quay.io/redhat-emea-ssa-team/workshop-tools:6.8'
memoryLimit: 2048Mi
memoryRequest: 256Mi
mountSources: true
sourceMapping: /projects
volumeMounts:
- name: m2
path: /home/developer/.m2
name: workshop-tools
- name: m2
volume:
size: 10G
commands:
- exec:
commandLine: 'oc login $(oc whoami --show-server) --username=${DEVWORKSPACE_NAMESPACE%-devspaces} --password=openshift --insecure-skip-tls-verify && oc project my-project${DEVWORKSPACE_NAMESPACE:4:${#DEVWORKSPACE_NAMESPACE}-14} 2> /dev/null'
component: workshop-tools
label: OpenShift - Login
workingDir: /projects/workshop
id: openshift---login
- exec:
commandLine: 'oc new-project my-project${DEVWORKSPACE_NAMESPACE:4:${#DEVWORKSPACE_NAMESPACE}-14}'
component: workshop-tools
label: OpenShift - Create Development Project
workingDir: /projects/workshop
id: openshift---create-development-project
- exec:
commandLine: '[[ ! -z "$(ps aux | grep -v grep | grep "compile quarkus:dev" | awk ''{print $2}'')" ]] && echo ''!! Application already running in Dev Mode !!'' || mvn compile quarkus:dev -Ddebug=false'
component: workshop-tools
label: Inventory - Compile (Dev Mode)
workingDir: /projects/workshop/labs/inventory-quarkus
id: inventory---compile-dev-mode
- exec:
commandLine: mvn clean package -DskipTests
component: workshop-tools
label: Inventory - Build
workingDir: /projects/workshop/labs/inventory-quarkus
id: inventory---build
- exec:
commandLine: mvn package -Dquarkus.container-image.build=true -DskipTests -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes-client.trust-certs=true
component: workshop-tools
label: Inventory - Push Component
workingDir: /projects/workshop/labs/inventory-quarkus
id: inventory---push-component
- exec:
commandLine: mvn install -Dquarkus.kubernetes.deploy=true -DskipTests -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes-client.trust-certs=true
component: workshop-tools
label: Inventory - Deploy Component
workingDir: /projects/workshop/labs/inventory-quarkus
id: inventory---deploy-component
- exec:
commandLine: mvn clean package -DskipTests
component: workshop-tools
label: Catalog - Build
workingDir: /projects/workshop/labs/catalog-spring-boot
id: catalog---build
- exec:
commandLine: 'mvn spring-boot:run'
component: workshop-tools
label: Catalog - Run
workingDir: /projects/workshop/labs/catalog-spring-boot
id: catalog---run
- exec:
commandLine: mvn package -DskipTests oc:build oc:resource oc:apply
component: workshop-tools
label: Catalog - Deploy Component
workingDir: /projects/workshop/labs/catalog-spring-boot
id: catalog---deploy-component
- exec:
commandLine: 'oc new-build dotnet:6.0 --name gateway-coolstore --labels=component=gateway --env DOTNET_STARTUP_PROJECT=app.csproj --binary=true && oc start-build gateway-coolstore --from-dir=. -w -n my-project${DEVWORKSPACE_NAMESPACE:4:${#DEVWORKSPACE_NAMESPACE}-14} && oc new-app gateway-coolstore:latest --name gateway-coolstore --labels=app=coolstore,app.kubernetes.io/instance=gateway,app.kubernetes.io/part-of=coolstore,app.kubernetes.io/name=gateway,app.openshift.io/runtime=dotnet,component=gateway -n my-project${DEVWORKSPACE_NAMESPACE:4:${#DEVWORKSPACE_NAMESPACE}-14} && oc expose svc gateway-coolstore -n my-project${DEVWORKSPACE_NAMESPACE:4:${#DEVWORKSPACE_NAMESPACE}-14}'
component: workshop-tools
label: Gateway - Build and Deploy Component
workingDir: /projects/workshop/labs/gateway-dotnet
id: gateway---build-and-deploy
- exec:
commandLine: 'for i in {1..60}; do if [ $(curl -s -w "%{http_code}" -o /dev/null http://inventory-coolstore.my-project${DEVWORKSPACE_NAMESPACE:4:${#DEVWORKSPACE_NAMESPACE}-14}.svc:8080/api/inventory/329299) == "200" ]; then MSG="\\033[0;32mThe request to Inventory Service has succeeded\\033[0m"; else MSG="\\033[0;31mERROR - The request to Inventory Service has failed\\033[0m"; fi;echo -e $MSG;sleep 1s; done'
component: workshop-tools
label: Inventory - Generate Traffic
workingDir: /projects/workshop/labs/inventory-quarkus
id: inventory---generate-traffic
- exec:
commandLine: 'oc project my-project${DEVWORKSPACE_NAMESPACE:4:${#DEVWORKSPACE_NAMESPACE}-14}; oc set probe deployment/gateway-coolstore --liveness --readiness --period-seconds=5 --get-url=http://:8080/health;oc set probe deployment/web-coolstore --liveness --readiness --period-seconds=5 --get-url=http://:8080/;echo "Health Probes Done"'
component: workshop-tools
label: Probes - Configure Gateway & Web
workingDir: /projects/workshop
id: probes---configure-gateway--web
- exec:
commandLine: './gateway_generate_traffic.sh cn-project${DEVWORKSPACE_NAMESPACE:4:${#DEVWORKSPACE_NAMESPACE}-14}'
component: workshop-tools
label: Gateway - Generate Traffic
workingDir: /projects/workshop/.tasks
id: gateway---generate-traffic
- exec:
commandLine: './inner_loop_deploy_coolstore.sh my-project${DEVWORKSPACE_NAMESPACE:4:${#DEVWORKSPACE_NAMESPACE}-14}'
component: workshop-tools
label: Inner Loop - Deploy Coolstore
workingDir: /projects/workshop/.tasks
id: inner-loop---deploy-coolstore
- exec:
commandLine: 'git init; git remote add origin http://gitea-server.gitea.svc:3000/${DEVWORKSPACE_NAMESPACE%-devspaces}/inventory-quarkus.git; git add *; git commit -m "Initial"; git push http://${DEVWORKSPACE_NAMESPACE%-devspaces}:[email protected]:3000/${DEVWORKSPACE_NAMESPACE%-devspaces}/inventory-quarkus.git'
component: workshop-tools
label: Inventory - Commit
workingDir: /projects/workshop/labs/inventory-quarkus
id: inventory---commit
- exec:
commandLine: './gitops_export_coolstore.sh my-project${DEVWORKSPACE_NAMESPACE:4:${#DEVWORKSPACE_NAMESPACE}-14} cn-project${DEVWORKSPACE_NAMESPACE:4:${#DEVWORKSPACE_NAMESPACE}-14}'
component: workshop-tools
label: GitOps - Export Coolstore
workingDir: /projects/workshop/.tasks
id: gitops---export-coolstore
- exec:
commandLine: 'oc project cn-project${DEVWORKSPACE_NAMESPACE:4:${#DEVWORKSPACE_NAMESPACE}-14} && ./pipeline_deploy_coolstore.sh cn-project${DEVWORKSPACE_NAMESPACE:4:${#DEVWORKSPACE_NAMESPACE}-14}'
component: workshop-tools
label: Pipeline - Deploy Coolstore
workingDir: /projects/workshop/.tasks
id: pipeline---deploy-coolstore
- exec:
commandLine: 'git init; git remote add origin http://gitea-server.gitea.svc:3000/${DEVWORKSPACE_NAMESPACE%-devspaces}/inventory-gitops.git 2> /dev/null; git add *; git commit -m "Initial Inventory GitOps"; git push http://${DEVWORKSPACE_NAMESPACE%-devspaces}:[email protected]:3000/${DEVWORKSPACE_NAMESPACE%-devspaces}/inventory-gitops.git'
component: workshop-tools
label: GitOps - Commit Inventory
workingDir: /projects/workshop/labs/gitops/inventory-coolstore
id: gitops---commit-inventory
- exec:
commandLine: './gitops_commit_configure_coolstore.sh ${DEVWORKSPACE_NAMESPACE:4:${#DEVWORKSPACE_NAMESPACE}-14}'
component: workshop-tools
label: GitOps - Commit & Configure Coolstore
workingDir: /projects/workshop/.tasks
id: gitops---commit--configure-coolstore
- exec:
commandLine: 'oc patch deployment/catalog-coolstore --patch ''{"spec": {"template": {"metadata": {"annotations": {"sidecar.istio.io/inject": "true"}}}'' -n cn-project${DEVWORKSPACE_NAMESPACE:4:${#DEVWORKSPACE_NAMESPACE}-14} && oc patch deployment/gateway-coolstore --patch ''{"spec": {"template": {"metadata": {"annotations": {"sidecar.istio.io/inject": "true"}}}'' -n cn-project${DEVWORKSPACE_NAMESPACE:4:${#DEVWORKSPACE_NAMESPACE}-14} '
component: workshop-tools
label: Service Mesh - Deploy Catalog and Gateway
workingDir: /projects/workshop/labs
id: service-mesh---deploy-catalog-and-gateway
- exec:
commandLine: 'git checkout .; git clean -fd; git clean -f; oc delete project my-project${DEVWORKSPACE_NAMESPACE:4:${#DEVWORKSPACE_NAMESPACE}-14}; oc delete deployment,deploymentconfig,buildconfig,imagestream,route,secret,configmap,pvc,service,pipeline,pipelinerun --all --namespace cn-project${DEVWORKSPACE_NAMESPACE:4:${#DEVWORKSPACE_NAMESPACE}-14}'
component: workshop-tools
label: OpenShift - Cleanup
workingDir: /projects/workshop
id: openshift---cleanup