2020-07-15 18:56:37 +00:00
|
|
|
# Copyright 2020 Google LLC
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
2020-02-21 23:26:03 +00:00
|
|
|
name: "Continuous Integration"
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
# run on pushes to master or release/*
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
- release/*
|
|
|
|
pull_request:
|
|
|
|
# run on pull requests targeting master
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
jobs:
|
|
|
|
run-tests:
|
|
|
|
runs-on: self-hosted
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2020-07-15 18:56:37 +00:00
|
|
|
- name: License Check
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
git init
|
|
|
|
git add --all
|
2020-10-13 19:40:31 +00:00
|
|
|
git -c user.name="CI Bot" -c user.email="<>" commit -m "initial state" --allow-empty
|
2020-07-15 18:56:37 +00:00
|
|
|
addlicense ./
|
|
|
|
test -z $(git diff --name-only | tee /dev/stderr)
|
2020-02-21 23:26:03 +00:00
|
|
|
- name: Setup Cluster
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
kind delete cluster || true
|
|
|
|
kind create cluster
|
|
|
|
kubectl get nodes
|
|
|
|
- name: Deploy From Source
|
|
|
|
run: |
|
2020-04-10 00:21:37 +00:00
|
|
|
skaffold config set --global local-cluster true
|
|
|
|
skaffold run --default-repo local
|
2020-02-21 23:26:03 +00:00
|
|
|
- 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
|
2020-04-10 00:21:37 +00:00
|
|
|
# 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}')
|
2020-02-21 23:26:03 +00:00
|
|
|
done
|
2020-04-10 00:21:37 +00:00
|
|
|
# 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
|
2020-02-21 23:26:03 +00:00
|
|
|
exit 1
|
|
|
|
fi
|