Update .github/workflows/benchmark-pipeline.yaml #3
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
name: Benchmark Pipeline | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
cncf_project: | ||
description: Project to be deployed e.g. falco | ||
required: true | ||
config: | ||
description: Configuration if project has multiple variants they wish to test | ||
required: false | ||
version: | ||
description: Version of project to be tested e.g. 0.37.0 | ||
required: true | ||
benchmark_path: | ||
description: Path to the benchmark action | ||
required: false # TODO: change to `true` when `"benchmark_path"` is specified in `projects/projects.json` | ||
concurrency: | ||
group: benchmark | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: azure/setup-kubectl@v4 | ||
with: | ||
version: v1.30.2 | ||
id: install | ||
- run: mkdir ~/.kube && echo "${{ secrets.KUBECONFIG }}" > ~/.kube/config | ||
- name: Select the manifest | ||
run: | | ||
MANIFEST=projects/${{ inputs.cncf_project }} | ||
CONFIG=${{ inputs.config }} | ||
if [[ -n $CONFIG ]]; then | ||
echo "Configuration provided" | ||
MANIFEST=$MANIFEST/$CONFIG.yaml | ||
else | ||
MANIFEST=$MANIFEST/${{ inputs.cncf_project }}.yaml | ||
fi | ||
if ! test -f "$MANIFEST"; then | ||
echo "The provided inputs are invalid." | ||
exit 1 | ||
fi | ||
export VERSION=${{ inputs.version }} | ||
envsubst < $MANIFEST > manifest.yaml | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: manifest | ||
path: manifest.yaml | ||
- name: Apply the manifest | ||
run: | | ||
kubectl apply -f manifest.yaml | ||
sleep 10 | ||
kubectl wait pod \ | ||
--all \ | ||
--for=condition=Ready \ | ||
--namespace=benchmark | ||
benchmark-job: | ||
uses: ${{ inputs.benchmark_path }} | ||
delete: | ||
runs-on: ubuntu-22.04 | ||
needs: deploy | ||
if: ${{ always() }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: azure/setup-kubectl@v4 | ||
with: | ||
version: v1.30.2 | ||
id: install | ||
- run: mkdir ~/.kube && echo "${{ secrets.KUBECONFIG }}" > ~/.kube/config | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: manifest | ||
- run: kubectl delete -f manifest.yaml --wait |