-
Notifications
You must be signed in to change notification settings - Fork 23
231 lines (196 loc) · 6.11 KB
/
e2e-hotel.yml
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
name: Hotel-App End-to-End Tests
on:
workflow_dispatch:
schedule:
- cron: "0 9 * * 1"
push:
branches: [main]
paths:
- "benchmarks/hotel-app/**"
- "utils/**"
- "tools/**"
- "runner/**"
pull_request:
branches: [main]
paths:
- "benchmarks/hotel-app/**"
- "utils/**"
- "tools/**"
- "runner/**"
env:
GOOS: linux
GO111MODULE: on
PORT: 50051
PLATFORMS: linux/amd64,linux/arm64
jobs:
build-and-push:
name: Build and push all images
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
service:
[
geo, profile, rate, recommendation, reservation, user, search,
]
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
lfs: "true"
- uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
env:
GOPRIVATE_KEY: ${{ secrets.XDT_REPO_ACCESS_KEY }}
uses: docker/build-push-action@v6
with:
push: true
file: benchmarks/hotel-app/Dockerfile
platforms: ${{ env.PLATFORMS }}
target: ${{ matrix.target }}
tags: vhiveease/hotel-app-${{ matrix.service }}:latest
build-args: SERVICE=${{ matrix.service }}
context: .
test-compose:
name: Test Docker Compose
needs: build-and-push
env:
YAML_DIR: benchmarks/hotel-app/yamls/docker-compose/
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
service:
[
geo,
geo-tracing,
profile,
rate,
recommendation,
reservation,
user,
search,
search-tracing,
]
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
lfs: "true"
- name: start docker-compose benchmark
run: |
docker compose -f ${{ env.YAML_DIR }}/dc-${{ matrix.service }}.yaml pull
docker compose -f ${{ env.YAML_DIR }}/dc-${{ matrix.service }}.yaml up &> log_file &
sleep 60s
cat log_file
- name: invoke the chain
run: |
./tools/bin/grpcurl -plaintext localhost:50000 helloworld.Greeter.SayHello
- name: show docker-compose log
run: cat log_file
test-knative:
name: Test Knative Deployment
needs: build-and-push
env:
KIND_VERSION: v0.14.0
K8S_VERSION: v1.23
YAML_DIR: benchmarks/hotel-app/yamls/knative/
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- service: hotel-app-geo
file: kn-geo.yaml
- service: hotel-app-geo-tracing
file: kn-geo-tracing.yaml
- service: hotel-app-profile
file: kn-profile.yaml
- service: hotel-app-rate
file: kn-rate.yaml
- service: hotel-app-recommendation
file: kn-recommendation.yaml
- service: hotel-app-reservation
file: kn-reservation.yaml
- service: hotel-app-user
file: kn-user.yaml
- service: hotel-app-search
file: kn-search.yaml
- service: hotel-app-search-tracing
file: kn-search-tracing.yaml
steps:
- uses: actions/checkout@v4
with:
lfs: "true"
- name: Checkout LFS objects
run: git lfs checkout
- uses: actions/setup-go@v5
with:
go-version: '1.21'
## Setup a Knative cluster to test the service
- name: Create k8s Kind Cluster
run: bash ./runner/scripts/01-kind.sh
- name: Install Serving
run: bash ./runner/scripts/02-serving.sh
- name: Install Kourier
run: bash ./runner/scripts/02-kourier.sh
- name: Setup domain
run: |
INGRESS_HOST="127.0.0.1"
KNATIVE_DOMAIN=$INGRESS_HOST.sslip.io
kubectl patch configmap -n knative-serving config-domain -p "{\"data\": {\"$KNATIVE_DOMAIN\": \"\"}}"
## Test the service
- name: Deploy database and memcached
working-directory: benchmarks/hotel-app/yamls/knative/
run: |
kubectl apply -f database.yaml
kubectl apply -f memcached.yaml
- name: Deploy knative
run: |
kubectl apply -f ${{ env.YAML_DIR }}/${{ matrix.file }}
- name: Check if service is ready
run: |
kubectl wait --for=condition=Ready -f ${{ env.YAML_DIR }}/${{ matrix.file }} --timeout 120s
kubectl get service
kubectl get -f ${{ env.YAML_DIR }}/${{ matrix.file }}
- name: Test invoking once
working-directory: tools/test-client
run: |
set -x
go build ./test-client.go
NODEPORT=80
url=$(kubectl get kservice ${{ matrix.service }} | awk '$2 ~ /http/ {sub(/http\:\/\//,""); print $2}')
./test-client --addr $url:$NODEPORT --name "Example text for CI"
- name: Print logs
if: ${{ always() }}
run: |
set -x
pod_list=$(kubectl get pods -n default -o jsonpath="{.items[*].name}")
for pod in $pod_list
do
kubectl logs $pod
done
- name: Print logs from database and mmc
if: ${{ always() }}
run: |
set -x
kubectl logs deployment/hotel-app-database
kubectl logs deployment/hotel-app-mmc
- name: Down
if: ${{ always() }}
run: |
kubectl delete -f ${{ env.YAML_DIR }}/${{ matrix.file }} --namespace default --wait
kubectl delete -f ${{ env.YAML_DIR }}/database.yaml
kubectl delete -f ${{ env.YAML_DIR }}/memcached.yaml