From e32083508802c8d4eb8bedf9657a7b6ef94fc628 Mon Sep 17 00:00:00 2001 From: KirillKurdyukov Date: Wed, 21 Oct 2026 21:35:08 +0300 Subject: [PATCH 1/3] SLO: migrate comparisons and reports to Action v3 --- .github/workflows/slo-report.yml | 61 +++++-------------------- .github/workflows/slo.yml | 76 +++++++++----------------------- slo-workload/README.MD | 6 +++ 3 files changed, 37 insertions(+), 106 deletions(-) diff --git a/.github/workflows/slo-report.yml b/.github/workflows/slo-report.yml index 040c8ed3..90245e9e 100644 --- a/.github/workflows/slo-report.yml +++ b/.github/workflows/slo-report.yml @@ -1,69 +1,28 @@ name: slo-report -# Reporting for pull requests from forks: their `pull_request` token is read-only, -# so the SLO workflow cannot publish the report itself. `workflow_run` runs in the -# base repository and has the permissions to do it. -# -# Everything else is reported by the SLO workflow directly, see slo.yml. +# Fork PRs need the privileged base-repository publisher. +# No pull request code is checked out by this privileged publisher. on: workflow_run: workflows: ["SLO"] - types: - - completed + types: [completed] jobs: publish-slo-report: + if: >- + github.event.workflow_run.event == 'pull_request' && + github.event.workflow_run.head_repository.full_name != github.repository runs-on: ubuntu-latest name: Publish YDB SLO Report permissions: + actions: read checks: write contents: read pull-requests: write - if: >- - github.event.workflow_run.conclusion != 'cancelled' && - github.event.workflow_run.conclusion != 'skipped' && - github.event.workflow_run.head_repository.full_name != github.repository steps: - name: Publish YDB SLO Report - uses: ydb-platform/ydb-slo-action/report@v2 + uses: ydb-platform/ydb-slo-action/report@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} - github_run_id: ${{ github.event.workflow_run.id }} - - remove-slo-label: - needs: publish-slo-report - if: >- - always() && github.event.workflow_run.event == 'pull_request' && - github.event.workflow_run.conclusion != 'skipped' && - github.event.workflow_run.head_repository.full_name != github.repository - runs-on: ubuntu-latest - name: Remove SLO Label - permissions: - pull-requests: write - steps: - - name: Remove SLO label from PR - uses: actions/github-script@v7 - with: - script: | - const pullRequests = context.payload.workflow_run.pull_requests; - if (!pullRequests || pullRequests.length === 0) { - console.log('No pull requests associated with this workflow run'); - return; - } - for (const pr of pullRequests) { - try { - await github.rest.issues.removeLabel({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: pr.number, - name: 'SLO' - }); - console.log(`Removed SLO label from PR #${pr.number}`); - } catch (error) { - if (error.status === 404) { - console.log(`SLO label not found on PR #${pr.number}, skipping`); - } else { - throw error; - } - } - } + github_workflows: SLO + remove_label: SLO diff --git a/.github/workflows/slo.yml b/.github/workflows/slo.yml index f314f077..b9a791ca 100644 --- a/.github/workflows/slo.yml +++ b/.github/workflows/slo.yml @@ -110,28 +110,24 @@ jobs: path: baseline fetch-depth: 1 - - name: Check baseline workload availability - id: baseline-workload + - name: Stage shared workload harness run: | - # Revisions older than the migration to ydb-slo-action cannot report the - # metrics the report is built from, so they are not used as a baseline. - if [[ -f "$GITHUB_WORKSPACE/baseline/slo-workload/src/Metrics.php" ]]; then - echo "available=true" >> "$GITHUB_OUTPUT" - else - echo "available=false" >> "$GITHUB_OUTPUT" - fi + set -euxo pipefail + # Share the checker, not the SDK sources or the built image. + rm -rf "$GITHUB_WORKSPACE/baseline/slo-workload" + cp -a "$GITHUB_WORKSPACE/current/slo-workload" "$GITHUB_WORKSPACE/baseline/slo-workload" - name: Build current workload image working-directory: current run: docker build --platform linux/amd64 -f slo-workload/Dockerfile -t ydb-app-current . - name: Build baseline workload image - if: steps.baseline-workload.outputs.available == 'true' working-directory: baseline run: docker build --platform linux/amd64 -f slo-workload/Dockerfile -t ydb-app-baseline . - name: Run SLO Tests - uses: ydb-platform/ydb-slo-action/init@v2 + # Pin legacy telemetry fixes until ydb-slo-action#81 is merged. + uses: ydb-platform/ydb-slo-action/init@e136720bca3783a0bd2d14e78ac591275573c0b3 timeout-minutes: 30 with: github_issue: ${{ github.event.inputs.github_issue }} @@ -144,67 +140,37 @@ jobs: workload_current_command: >- -read-rps ${{ inputs.slo_workload_read_max_rps || '1000' }} -write-rps ${{ inputs.slo_workload_write_max_rps || '100' }} - workload_baseline_ref: ${{ steps.baseline-workload.outputs.available == 'true' && steps.baseline.outputs.ref || '' }} - workload_baseline_image: ${{ steps.baseline-workload.outputs.available == 'true' && 'ydb-app-baseline' || '' }} + workload_baseline_ref: ${{ steps.baseline.outputs.ref }} + workload_baseline_image: ydb-app-baseline workload_baseline_command: >- -read-rps ${{ inputs.slo_workload_read_max_rps || '1000' }} -write-rps ${{ inputs.slo_workload_write_max_rps || '100' }} - disable_compose_profiles: ${{ steps.baseline-workload.outputs.available != 'true' && 'workload-baseline' || '' }} + metrics_schema: legacy_table - # Pull requests from forks get their report from slo-report.yml: their token is - # read-only and cannot publish anything. + # Build graph artifacts for every run. Same-repository PRs report directly; + # fork PR comments belong to the privileged workflow_run publisher. publish-slo-report: needs: ydb-slo-action if: >- - !cancelled() && needs.ydb-slo-action.result != 'skipped' && - (github.event_name != 'pull_request' || - github.event.pull_request.head.repo.full_name == github.repository) + !cancelled() && needs.ydb-slo-action.result != 'skipped' name: Publish YDB SLO Report runs-on: ubuntu-latest permissions: + actions: read checks: write contents: read pull-requests: write steps: - name: Publish YDB SLO Report - uses: ydb-platform/ydb-slo-action/report@v2 + uses: ydb-platform/ydb-slo-action/report@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} github_run_id: ${{ github.run_id }} - - # Pull requests from forks get the label removed by slo-report.yml: their token is - # read-only and cannot edit the labels. - remove-slo-label: - needs: [ydb-slo-action, publish-slo-report] - if: >- - always() && needs.ydb-slo-action.result != 'skipped' && - github.event_name == 'pull_request' && - github.event.pull_request.head.repo.full_name == github.repository - - name: Remove SLO Label - runs-on: ubuntu-latest - permissions: - pull-requests: write - - steps: - - name: Remove SLO label from PR - uses: actions/github-script@v7 - with: - script: | - try { - await github.rest.issues.removeLabel({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - name: 'SLO' - }); - console.log(`Removed SLO label from PR #${context.issue.number}`); - } catch (error) { - if (error.status === 404) { - console.log(`SLO label not found on PR #${context.issue.number}, skipping`); - } else { - throw error; - } - } + post_comment: >- + ${{ github.event_name == 'workflow_dispatch' || + github.event.pull_request.head.repo.full_name == github.repository }} + remove_label: >- + ${{ github.event_name == 'pull_request' && + github.event.pull_request.head.repo.full_name == github.repository && 'SLO' || '' }} diff --git a/slo-workload/README.MD b/slo-workload/README.MD index 564bc6ba..dbe635e8 100644 --- a/slo-workload/README.MD +++ b/slo-workload/README.MD @@ -8,6 +8,12 @@ deploys a YDB cluster with Prometheus and a chaos monkey, starts the workload im revision side by side, and builds a comparison report out of the metrics both of them push. See [.github/workflows/slo.yml](../.github/workflows/slo.yml) and [.github/workflows/slo-report.yml](../.github/workflows/slo-report.yml). +The workflow uses Action v3 with `metrics_schema: legacy_table`, retaining the +existing `sdk.*` metrics. A baseline SDK checkout is always built independently. +Both builds use the current `slo-workload` harness so older SDK revisions can +participate without changing their SDK sources. A failed baseline build fails +the job; the current image is never substituted for it. + ## Usage ``` From 6818156b84562cabf1bac4cb19f24a7bba13d310 Mon Sep 17 00:00:00 2001 From: KirillKurdyukov Date: Wed, 21 Oct 2026 22:04:55 +0300 Subject: [PATCH 2/3] SLO: document report ownership and label cleanup --- slo-workload/README.MD | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/slo-workload/README.MD b/slo-workload/README.MD index dbe635e8..3ed8c918 100644 --- a/slo-workload/README.MD +++ b/slo-workload/README.MD @@ -14,6 +14,10 @@ Both builds use the current `slo-workload` harness so older SDK revisions can participate without changing their SDK sources. A failed baseline build fails the job; the current image is never substituted for it. +Same-repository PRs publish their report directly; fork PRs use the privileged +`workflow_run` publisher without checking out PR code. Action v3 removes the +`SLO` label after reporting, including when report generation fails. + ## Usage ``` From ff52e485fbc341c43ee183e8122394f269a7df87 Mon Sep 17 00:00:00 2001 From: KirillKurdyukov Date: Thu, 22 Oct 2026 11:02:27 +0300 Subject: [PATCH 3/3] SLO: use existing workload metrics --- .github/workflows/slo.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/slo.yml b/.github/workflows/slo.yml index b9a791ca..ef1892a9 100644 --- a/.github/workflows/slo.yml +++ b/.github/workflows/slo.yml @@ -127,7 +127,7 @@ jobs: - name: Run SLO Tests # Pin legacy telemetry fixes until ydb-slo-action#81 is merged. - uses: ydb-platform/ydb-slo-action/init@e136720bca3783a0bd2d14e78ac591275573c0b3 + uses: ydb-platform/ydb-slo-action/init@d66bd1e10f893e5f70d542c4430a3cffb6d6f9f8 timeout-minutes: 30 with: github_issue: ${{ github.event.inputs.github_issue }} @@ -145,7 +145,7 @@ jobs: workload_baseline_command: >- -read-rps ${{ inputs.slo_workload_read_max_rps || '1000' }} -write-rps ${{ inputs.slo_workload_write_max_rps || '100' }} - metrics_schema: legacy_table + workload_type: table # Build graph artifacts for every run. Same-repository PRs report directly; # fork PR comments belong to the privileged workflow_run publisher.