Skip to content

Commit

Permalink
Enable CI tests (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitryax authored Sep 26, 2023
1 parent 1ed31da commit 31f616a
Show file tree
Hide file tree
Showing 14 changed files with 97 additions and 104 deletions.
67 changes: 24 additions & 43 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,39 @@
name: "Continuous Integration"
on:
push:
# run on pushes to master or release/*
# run on pushes to main
branches:
- master
- release/*
- main
pull_request:
# run on pull requests targeting master
# run on pull requests targeting main
branches:
- master
- main
jobs:
run-tests:
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Cluster
run: |
set -x
kind delete cluster || true
kind create cluster
kubectl get nodes

- name: Create kind cluster
uses: helm/[email protected]

- name: Deploy From Source
run: |
skaffold config set --global local-cluster true
skaffold run --default-repo local
uses: hiberbee/[email protected]
with:
command: run

- name: Wait For Pods
timeout-minutes: 20
run: |
set -x
kubectl wait --for=condition=available --timeout=500s deployment/adservice
kubectl wait --for=condition=available --timeout=500s deployment/cartservice
kubectl wait --for=condition=available --timeout=500s deployment/checkoutservice
kubectl wait --for=condition=available --timeout=500s deployment/currencyservice
kubectl wait --for=condition=available --timeout=500s deployment/emailservice
kubectl wait --for=condition=available --timeout=500s deployment/frontend
kubectl wait --for=condition=available --timeout=500s deployment/loadgenerator
kubectl wait --for=condition=available --timeout=500s deployment/paymentservice
kubectl wait --for=condition=available --timeout=500s deployment/productcatalogservice
kubectl wait --for=condition=available --timeout=500s deployment/recommendationservice
kubectl wait --for=condition=available --timeout=500s deployment/shippingservice
- name: Smoke Test
timeout-minutes: 5
run: |
set -x
# start fresh loadgenerator pod
kubectl delete pod -l app=loadgenerator
# wait for requests to come in
REQUEST_COUNT="0"
while [[ "$REQUEST_COUNT" -lt "50" ]]; do
sleep 5
REQUEST_COUNT=$(kubectl logs -l app=loadgenerator | grep Aggregated | awk '{print $2}')
done
# ensure there are no errors hitting endpoints
ERROR_COUNT=$(kubectl logs -l app=loadgenerator | grep Aggregated | awk '{print $3}' | sed "s/[(][^)]*[)]//g")
if [[ "$ERROR_COUNT" -gt "0" ]]; then
exit 1
fi
kubectl wait --for=condition=available --timeout=10m deployment/adservice
kubectl wait --for=condition=available --timeout=10m deployment/cartservice
kubectl wait --for=condition=available --timeout=10m deployment/checkoutservice
kubectl wait --for=condition=available --timeout=10m deployment/currencyservice
kubectl wait --for=condition=available --timeout=10m deployment/emailservice
kubectl wait --for=condition=available --timeout=10m deployment/frontend
kubectl wait --for=condition=available --timeout=10m deployment/loadgenerator
kubectl wait --for=condition=available --timeout=10m deployment/paymentservice
kubectl wait --for=condition=available --timeout=10m deployment/productcatalogservice
kubectl wait --for=condition=available --timeout=10m deployment/recommendationservice
kubectl wait --for=condition=available --timeout=10m deployment/shippingservice
6 changes: 3 additions & 3 deletions kubernetes-manifests/adservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
containers:
- name: server
image: adservice
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9555
env:
Expand All @@ -52,9 +52,9 @@ spec:
resources:
requests:
cpu: 200m
memory: 180Mi
memory: 300Mi
limits:
cpu: 300m
cpu: 200m
memory: 300Mi
readinessProbe:
initialDelaySeconds: 60
Expand Down
6 changes: 3 additions & 3 deletions kubernetes-manifests/cartservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
containers:
- name: server
image: cartservice
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
ports:
- containerPort: 7070
env:
Expand Down Expand Up @@ -71,10 +71,10 @@ spec:
value: "true"
resources:
requests:
cpu: 200m
cpu: 70m
memory: 64Mi
limits:
cpu: 300m
cpu: 70m
memory: 128Mi
readinessProbe:
initialDelaySeconds: 15
Expand Down
6 changes: 3 additions & 3 deletions kubernetes-manifests/checkoutservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
containers:
- name: server
image: checkoutservice
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
ports:
- containerPort: 5050
readinessProbe:
Expand Down Expand Up @@ -67,10 +67,10 @@ spec:
value: "25"
resources:
requests:
cpu: 100m
cpu: 70m
memory: 64Mi
limits:
cpu: 200m
cpu: 70m
memory: 128Mi
---
apiVersion: v1
Expand Down
6 changes: 3 additions & 3 deletions kubernetes-manifests/currencyservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
containers:
- name: server
image: currencyservice
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
ports:
- name: grpc
containerPort: 7000
Expand All @@ -53,10 +53,10 @@ spec:
command: ["/bin/grpc_health_probe", "-addr=:7000"]
resources:
requests:
cpu: 100m
cpu: 70m
memory: 64Mi
limits:
cpu: 200m
cpu: 70m
memory: 128Mi
---
apiVersion: v1
Expand Down
6 changes: 3 additions & 3 deletions kubernetes-manifests/emailservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
containers:
- name: server
image: emailservice
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
env:
Expand All @@ -54,10 +54,10 @@ spec:
command: ["/bin/grpc_health_probe", "-addr=:8080"]
resources:
requests:
cpu: 100m
cpu: 70m
memory: 64Mi
limits:
cpu: 200m
cpu: 70m
memory: 128Mi
---
apiVersion: v1
Expand Down
6 changes: 3 additions & 3 deletions kubernetes-manifests/frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
containers:
- name: server
image: frontend
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
readinessProbe:
Expand Down Expand Up @@ -86,10 +86,10 @@ spec:
value: "true"
resources:
requests:
cpu: 100m
cpu: 70m
memory: 64Mi
limits:
cpu: 200m
cpu: 70m
memory: 128Mi
---
apiVersion: v1
Expand Down
10 changes: 5 additions & 5 deletions kubernetes-manifests/loadgenerator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ spec:
ports:
- containerPort: 8089
image: loadgenerator
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
env:
- name: FRONTEND_ADDR
value: "frontend:80"
- name: USERS
value: "10"
resources:
requests:
cpu: 300m
memory: 256Mi
cpu: 70m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
cpu: 70m
memory: 128Mi
---
apiVersion: v1
kind: Service
Expand Down
6 changes: 3 additions & 3 deletions kubernetes-manifests/paymentservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
containers:
- name: server
image: paymentservice
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
ports:
- containerPort: 50051
env:
Expand Down Expand Up @@ -60,10 +60,10 @@ spec:
command: ["/bin/grpc_health_probe", "-addr=:50051"]
resources:
requests:
cpu: 100m
cpu: 80m
memory: 64Mi
limits:
cpu: 200m
cpu: 80m
memory: 128Mi
---
apiVersion: v1
Expand Down
6 changes: 3 additions & 3 deletions kubernetes-manifests/productcatalogservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
containers:
- name: server
image: productcatalogservice
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
ports:
- containerPort: 3550
env:
Expand All @@ -52,10 +52,10 @@ spec:
command: ["/bin/grpc_health_probe", "-addr=:3550"]
resources:
requests:
cpu: 100m
cpu: 50m
memory: 64Mi
limits:
cpu: 200m
cpu: 50m
memory: 128Mi
---
apiVersion: v1
Expand Down
10 changes: 5 additions & 5 deletions kubernetes-manifests/recommendationservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
containers:
- name: server
image: recommendationservice
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
readinessProbe:
Expand All @@ -56,11 +56,11 @@ spec:
# value: "http://zipkin.default:9411/api/v2/spans"
resources:
requests:
cpu: 100m
memory: 220Mi
cpu: 70m
memory: 128Mi
limits:
cpu: 200m
memory: 450Mi
cpu: 70m
memory: 256Mi
---
apiVersion: v1
kind: Service
Expand Down
4 changes: 2 additions & 2 deletions kubernetes-manifests/redis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
containers:
- name: redis
image: redis:alpine
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
ports:
- containerPort: 6379
readinessProbe:
Expand All @@ -47,7 +47,7 @@ spec:
resources:
limits:
memory: 256Mi
cpu: 125m
cpu: 70m
requests:
cpu: 70m
memory: 200Mi
Expand Down
6 changes: 3 additions & 3 deletions kubernetes-manifests/shippingservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
containers:
- name: server
image: shippingservice
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
ports:
- containerPort: 50051
env:
Expand All @@ -52,10 +52,10 @@ spec:
command: ["/bin/grpc_health_probe", "-addr=:50051"]
resources:
requests:
cpu: 100m
cpu: 50m
memory: 64Mi
limits:
cpu: 200m
cpu: 50m
memory: 128Mi
---
apiVersion: v1
Expand Down
Loading

0 comments on commit 31f616a

Please sign in to comment.