diff --git a/.github/workflows/benchmark-pipeline.yaml b/.github/workflows/benchmark-pipeline.yaml index da2cd7f..4edd5d1 100644 --- a/.github/workflows/benchmark-pipeline.yaml +++ b/.github/workflows/benchmark-pipeline.yaml @@ -6,15 +6,23 @@ on: cncf_project: description: Project to be deployed e.g. falco required: true + type: string config: description: Configuration if project has multiple variants they wish to test required: false + type: string 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` + type: string + benchmark_job_url: + description: URL of the benchmark job + required: true + type: string + benchmark_job_duration_mins: + description: Duration of the benchmark job + required: true + type: number concurrency: group: benchmark @@ -31,10 +39,12 @@ jobs: echo "| cncf_project | ${{ github.event.inputs.cncf_project }} |" >> $GITHUB_STEP_SUMMARY echo "| config | ${{ github.event.inputs.config }} |" >> $GITHUB_STEP_SUMMARY echo "| version | ${{ github.event.inputs.version }} |" >> $GITHUB_STEP_SUMMARY - echo "| benchmark_path | ${{ github.event.inputs.benchmark_path }} |" >> $GITHUB_STEP_SUMMARY + echo "| benchmark_job_url | ${{ github.event.inputs.benchmark_job_url }} |" >> $GITHUB_STEP_SUMMARY + echo "| benchmark_job_duration_mins | ${{ github.event.inputs.benchmark_job_duration_mins }} |" >> $GITHUB_STEP_SUMMARY + deploy: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - uses: azure/setup-kubectl@v4 @@ -76,11 +86,34 @@ jobs: --namespace=benchmark benchmark-job: - uses: ${{ inputs.benchmark_path }} + runs-on: ubuntu-24.04 + needs: deploy + 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: Run the benchmark job + run: | + kubectl apply -f ${{ inputs.benchmark_job_url }} + + kubectl wait pod \ + --all \ + --for=condition=Ready + + - name: Wait for the benchmark job to complete + run: | + sleep ${{ inputs.benchmark_job_duration_mins }}m + + - name: Delete the benchmark job + run: | + kubectl delete -f ${{ inputs.benchmark_job_url }} --wait delete: - runs-on: ubuntu-22.04 - needs: deploy + runs-on: ubuntu-24.04 + needs: benchmark-job if: ${{ always() }} steps: - uses: actions/checkout@v4 diff --git a/projects/projects.json b/projects/projects.json index 565e864..52bc3d0 100644 --- a/projects/projects.json +++ b/projects/projects.json @@ -3,7 +3,10 @@ { "name": "falco", "organization": "falcosecurity", - "benchmark_path": "", + "benchmark": { + "k8s_manifest_url": "https://raw.githubusercontent.com/falcosecurity/cncf-green-review-testing/e93136094735c1a52cbbef3d7e362839f26f4944/benchmark-tests/falco-benchmark-tests.yaml", + "duration_mins": 15 + }, "configs": [ "ebpf", "modern-ebpf", diff --git a/scripts/project-trigger.sh b/scripts/project-trigger.sh index 7f74a86..7c7950f 100755 --- a/scripts/project-trigger.sh +++ b/scripts/project-trigger.sh @@ -16,12 +16,14 @@ fi jq -c '.projects[]' "$json_file" | while read -r project; do proj_name=$(echo "$project" | jq -r '.name') proj_organization=$(echo "$project" | jq -r '.organization') - proj_benchmark_path=$(echo "$project" | jq -r '.benchmark_path') + proj_benchmark_manifest_url=$(echo "$project" | jq -r '.benchmark.k8s_manifest_url') + proj_benchmark_duration_mins=$(echo "$project" | jq -r '.benchmark.duration_mins') configs=$(echo "$project" | jq -r '.configs') echo "Project Name: $proj_name" echo "Organization: $proj_organization" - echo "Benchmark Path: $proj_benchmark_path" + echo "Benchmark Manifest URL: $proj_benchmark_manifest_url" + echo "Benchmark Duration (Minutes): $proj_benchmark_duration_mins" echo "Configs: $configs" release_url="https://api.github.com/repos/${proj_organization}/${proj_name}/releases/latest" @@ -50,7 +52,7 @@ jq -c '.projects[]' "$json_file" | while read -r project; do -H "Authorization: Bearer $gh_token" \ -H "X-GitHub-Api-Version: 2022-11-28" \ "https://api.github.com/repos/$workflow_organization_name/$workflow_project_name/actions/workflows/$workflow_dispatcher_file_name/dispatches" \ - -d "{\"ref\":\"${git_ref}\",\"inputs\":{\"cncf_project\":\"${proj_name}\",\"config\":\"\",\"version\":\"${latest_proj_version}\"}}") + -d "{\"ref\":\"${git_ref}\",\"inputs\":{\"cncf_project\":\"${proj_name}\",\"benchmark_job_url\":\"${proj_benchmark_manifest_url}\",\"benchmark_job_duration_mins\":\"${proj_benchmark_duration_mins}\",\"version\":\"${latest_proj_version}\"}}") status_code=$? if [ $status_code -ne 0 ]; then @@ -68,7 +70,7 @@ jq -c '.projects[]' "$json_file" | while read -r project; do -H "Authorization: Bearer $gh_token" \ -H "X-GitHub-Api-Version: 2022-11-28" \ "https://api.github.com/repos/$workflow_organization_name/$workflow_project_name/actions/workflows/$workflow_dispatcher_file_name/dispatches" \ - -d "{\"ref\":\"${git_ref}\",\"inputs\":{\"cncf_project\":\"${proj_name}\",\"config\":\"${config}\",\"version\":\"${latest_proj_version}\"}}") + -d "{\"ref\":\"${git_ref}\",\"inputs\":{\"cncf_project\":\"${proj_name}\",\"benchmark_job_url\":\"${proj_benchmark_manifest_url}\",\"benchmark_job_duration_mins\":\"${proj_benchmark_duration}\",\"config\":\"${config}\",\"version\":\"${latest_proj_version}\"}}") status_code=$? if [ $status_code -ne 0 ]; then