Skip to content

Load Test for fluent-bit on PR-3407 #291

Load Test for fluent-bit on PR-3407

Load Test for fluent-bit on PR-3407 #291

Workflow file for this run

name: PR Load Test
permissions:
contents: read
# Trigger the test Manually additionally provide PR number.
on:
workflow_dispatch:
inputs:
pr_number:
description: 'Pull Request Number without "PR-" prefix'
required: true
image:
type: choice
options:
- otel-collector
- fluent-bit
- prometheus
- logs-otel
description: "Image to test"
required: true
duration:
type: string
description: "Duration of the test in seconds"
required: true
default: "1200"
selfmonitor_pr_image:
type: boolean
description: "Use self-monitor image built from the PR"
default: false
skip_deletion:
type: boolean
description: "Skip deletion of test resources and cluster after test execution"
default: false
run-name: "Load Test for ${{ inputs.image }} on PR-${{ inputs.pr_number }}"
env:
MANAGER_IMAGE: europe-docker.pkg.dev/kyma-project/dev/telemetry-manager:PR-${{ github.event.inputs.pr_number }}
jobs:
prepare-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: "refs/pull/${{ github.event.inputs.pr_number }}/head"
repository: ${{ github.repository }}
- id: set-matrix
run: |
image=${{ github.event.inputs.image }}
matrix=$(jq --arg image "$image" 'map( . | select (.image==$image) )' hack/load-tests/matrix_includes.json)
echo "matrix={\"include\":$(echo $matrix)}" >> $GITHUB_OUTPUT
load-test:
needs: prepare-matrix
strategy:
fail-fast: false
max-parallel: 4
matrix: ${{ fromJson(needs.prepare-matrix.outputs.matrix) }}
runs-on: ubuntu-latest
steps:
- name: Test matrix configuration
run: echo "input = ${{ github.event.inputs.image }}, matrix = ${{ matrix.image }}"
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: "refs/pull/${{ github.event.inputs.pr_number }}/head"
repository: ${{ github.repository }}
- name: Setup Golang
uses: "./.github/template/setup-golang"
- name: Setup gardener cluster name
run: |
ID=$(echo ${{ github.run_id }}${{ github.run_attempt }} | rev )
SHORT_NAME=$(echo ${{ matrix.name }} | awk -F- '{for(i=1;i<=NF;i++) printf "%s",substr($i,1,1);print "";}')
GARDENER_CLUSTER_NAME=$(echo lt-${SHORT_NAME}-${ID} | cut -c 1-14)
echo "GARDENER_CLUSTER_NAME=$GARDENER_CLUSTER_NAME" >> $GITHUB_ENV
- name: Save service account to file
shell: bash
run: 'echo "$GARDENER_SA" > /tmp/gardener-sa.yaml'
env:
GARDENER_SA: ${{ secrets.GARDENER_SA }}
- name: Provision gardener cluster
run: make provision-gardener
env:
GARDENER_SECRET_NAME: ${{ secrets.GARDENER_SECRET_NAME }}
GARDENER_PROJECT: ${{ secrets.GARDENER_PROJECT }}
GARDENER_SA_PATH: /tmp/gardener-sa.yaml
GARDENER_MIN_NODES: 2
GARDENER_MAX_NODES: 2
- name: Deploy telemetry
run: |
if [ "${{ github.event.inputs.selfmonitor_pr_image }}" = "true" ]; then
export SELF_MONITOR_IMAGE="europe-docker.pkg.dev/kyma-project/dev/tpi/telemetry-self-monitor:PR-${{ github.event.inputs.pr_number }}"
fi
hack/deploy-telemetry.sh
- name: Deploy Istio module
run: hack/deploy-istio.sh
- name: Run load test
run: |
SKIP_DELETION_FLAG=""
if [ "${{ github.event.inputs.skip_deletion }}" = "true" ]; then
SKIP_DELETION_FLAG="-k"
fi
hack/load-tests/run-load-test.sh -n ${{ matrix.name }} -t ${{ matrix.type }} -m ${{ matrix.multi }} -b ${{ matrix.backpressure }} -d ${{ github.event.inputs.duration }} -o "${{ matrix.overlay }}" $SKIP_DELETION_FLAG
- name: Upload results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: always()
with:
name: Results-${{ matrix.name }}
path: tests/*.json
- name: Deprovision gardener cluster
run: make deprovision-gardener
# always run the deprovision step, even if the previous steps failed, unless skip_deletion is enabled
if: ${{ always() && github.event.inputs.skip_deletion != 'true' }}
env:
GARDENER_SA_PATH: /tmp/gardener-sa.yaml
print-results:
needs: load-test
runs-on: ubuntu-latest
if: always()
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: "refs/pull/${{ github.event.inputs.pr_number }}/head"
repository: ${{ github.repository }}
- name: Download results
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: perf-results
merge-multiple: true
- name: Print results
run: |
ls -la perf-results
python3 hack/load-tests/convert-results.py perf-results
- name: Send results to GitHub summary
run: python3 hack/load-tests/convert-results.py -m perf-results >> $GITHUB_STEP_SUMMARY