Run CTS #326
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-License-Identifier: Apache-2.0 | |
# Copyright Contributors to the ODPi Egeria project. | |
name: "Run CTS" | |
on: | |
# Only manually for now | |
workflow_dispatch: | |
inputs: | |
egeria_version: | |
description: "Egeria Container image version (ie 3.15-SNAPSHOT)" | |
required: true | |
default: latest | |
records: | |
description: "records (scale of tests)" | |
required: true | |
default: 5 | |
runner: | |
description: "runner (ie custom external cluster)" | |
required: true | |
default: ubuntu-latest | |
debug: | |
description: "Pause for SSH access?" | |
type: boolean | |
required: true | |
default: false | |
# Also run every day of the week (will use defaults above) | |
schedule: | |
- cron: '30 2 * * *' | |
jobs: | |
kind: | |
name: Run CTS | |
strategy: | |
fail-fast: false | |
matrix: | |
connector: ['inmemory','graph','xtdb'] | |
runs-on: ${{ github.event.inputs.runner || 'ubuntu-latest' }} | |
steps: | |
- name: Report version | |
run: | | |
echo "Starting test run for: ${{ github.event.inputs.egeria_version || 'latest' }} with ${{ matrix.connector }}" | |
- name: setup Helm | |
uses: azure/setup-helm@v3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v3 | |
name: checkout code | |
- uses: helm/kind-action@v1 | |
name: setup kind | |
with: | |
cluster_name: cts | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check k8s cluster | |
run: | | |
kubectl cluster-info | |
kubectl get pods -n kube-system | |
echo "current-context:" $(kubectl config current-context) | |
echo "environment-kubeconfig:" ${KUBECONFIG} | |
- name: Setup Egeria Repo & install CTS chart | |
run: | | |
helm repo add egeria https://odpi.github.io/egeria-charts | |
helm install cts egeria/egeria-cts --set-string imageDefaults.tag=${{ github.event.inputs.egeria_version || 'latest' }} --set-string resources.requests.memory=4Gi --set-string resources.limits.memory=7Gi --set resources.requests.cpu=0m --set records=${{ github.event.inputs.records || 5 }} --set strimzi-kafka-operator.resources.requests.cpu=0m -f etc/${{ matrix.connector }}.yaml --timeout=5m --devel | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup upterm session for debug via ssh | |
if: ${{ github.event.inputs.debug == 'true' }} | |
uses: lhotari/action-upterm@v1 | |
with: | |
## limits ssh access and adds the ssh public key for the user which triggered the workflow | |
limit-access-to-actor: true | |
- name: Check Chart installed & running | |
run: | | |
helm list | |
kubectl get pods | |
- name: Wait for Strimzi Operator to be ready | |
run: | | |
until kubectl get pod -l strimzi.io/kind=cluster-operator -o go-template='{{.items | len}}' | grep -qxF 1; do | |
echo "Waiting for pod" | |
sleep 1 | |
done | |
kubectl wait pods --selector=strimzi.io/kind=cluster-operator --for condition=Ready --timeout=5m | |
- name: Wait for Zookeeper to be ready | |
run: | | |
until kubectl get pod -l app.kubernetes.io/name=zookeeper -o go-template='{{.items | len}}' | grep -qxF 1; do | |
echo "Waiting for pod" | |
sleep 1 | |
done | |
kubectl wait pods --selector=app.kubernetes.io/name=zookeeper --for condition=Ready --timeout=5m | |
- name: Wait for Kafka to be ready | |
run: | | |
until kubectl get pod -l app.kubernetes.io/name=kafka -o go-template='{{.items | len}}' | grep -qxF 1; do | |
echo "Waiting for pod" | |
sleep 1 | |
done | |
kubectl wait pods --selector=app.kubernetes.io/name=kafka --for condition=Ready --timeout=5m | |
- name: Wait for CTS platform to be ready | |
run: | | |
until kubectl get pod -l app.kubernetes.io/component=platform -o go-template='{{.items | len}}' | grep -qxF 1; do | |
echo "Waiting for pod" | |
sleep 1 | |
done | |
kubectl wait pods --selector=app.kubernetes.io/component=platform --for condition=Ready --timeout=5m | |
- name: Wait for init/config to complete | |
run: | | |
until kubectl get pod -l app.kubernetes.io/component=init -o go-template='{{.items | len}}' | grep -qxF 1; do | |
echo "Waiting for pod" | |
sleep 1 | |
done | |
kubectl wait jobs --selector=app.kubernetes.io/component=init --for condition=complete --timeout=5m | |
- name: Wait for CTS results to be available (this takes a long time - HOURS) | |
# This waits for the report pod to go ready - this means results are ready | |
run: | | |
until kubectl get pod -l app.kubernetes.io/component=report -o go-template='{{.items | len}}' | grep -qxF 1; do | |
echo "Waiting for pod" | |
sleep 1 | |
done | |
# -- note on timeouts -- | |
# Above we've used 30 mins. Allow 5 mins for logging retrieval, + some for attachments so allow 5:20 hours here to be safe | |
# But note that kubectl exec timeouts are tricky - combo of finding running pod, connecting to pod, and running command, so are omitted below | |
# TODO: Could be calculated based on start time of job to maximise available job run time | |
# -- end -- | |
kubectl wait pods --selector=app.kubernetes.io/component=report --for condition=Ready --timeout=320m | |
# When the job is ready it needs to retrieve all the cts results. no status is report, so it's tail/parse | |
# the log, or add a random sleep. Errr on the long side = 3.5 minutes | |
- name: Wait for report retrieval by job | |
run: | | |
sleep 210 | |
- name: Gather CTS report | |
run: | | |
kubectl exec $(kubectl get pod -l app.kubernetes.io/component=report --no-headers -o custom-columns=":metadata.name") -- sh -c 'cat /export/pipe' | tar -xvf - | |
- name: capture k8s logs from init job | |
if: always() | |
run : | | |
kubectl logs -l app.kubernetes.io/component=init --since=6h > init.log | |
- name: capture k8s logs from platform | |
if: always() | |
run : | | |
kubectl logs -l app.kubernetes.io/component=platform --since=6h > platform.log | |
- name: Upload CTS report & other useful content | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: CTS report ${{ matrix.connector }} | |
path: | | |
export/cts.tar.gz | |
platform.log | |
init.log | |
- name: Analyze Results | |
run: | | |
python3 scripts/cts-analyze.py > analysis.txt 2>&1 | |
- name: Add results to summary | |
if: always() | |
run: | | |
echo "**Egeria ${{ github.event.inputs.egeria_version || 'latest' }} with ${{ matrix.connector }} repository**" >> ${GITHUB_STEP_SUMMARY} | |
echo "\`\`\`" >> ${GITHUB_STEP_SUMMARY} | |
cat analysis.txt >> ${GITHUB_STEP_SUMMARY} | |
echo "\`\`\`" >> ${GITHUB_STEP_SUMMARY} | |