From 51a61d6e0943d240f3392d5ead5c78a0ea474e75 Mon Sep 17 00:00:00 2001 From: Artem Ermoshkin Date: Thu, 4 Jun 2026 19:22:18 +0300 Subject: [PATCH] fix one comment --- .github/workflows/{slo_native.yml => slo.yml} | 43 ++--- .github/workflows/slo_report.yml | 45 ++--- .github/workflows/slo_userver.yml | 172 ------------------ 3 files changed, 37 insertions(+), 223 deletions(-) rename .github/workflows/{slo_native.yml => slo.yml} (82%) delete mode 100644 .github/workflows/slo_userver.yml diff --git a/.github/workflows/slo_native.yml b/.github/workflows/slo.yml similarity index 82% rename from .github/workflows/slo_native.yml rename to .github/workflows/slo.yml index 3e317c4034..90c393f279 100644 --- a/.github/workflows/slo_native.yml +++ b/.github/workflows/slo.yml @@ -1,18 +1,19 @@ -name: SLO Native +name: SLO on: pull_request: types: [opened, reopened, synchronize, labeled] +permissions: + contents: read + jobs: ydb-slo-action: if: contains(github.event.pull_request.labels.*.name, 'SLO') - name: Run YDB SLO Tests + name: Run YDB SLO Tests (${{ matrix.sdk.name }}) runs-on: ubuntu-latest - - permissions: - contents: read + timeout-minutes: 120 strategy: fail-fast: false @@ -20,6 +21,13 @@ jobs: sdk: - name: cpp-key-value preset: release-test-clang + dockerfile: tests/slo_workloads/Dockerfile + cache_scope: slo + command: "" + - name: cpp-key-value-userver + preset: release-test-clang + dockerfile: tests/slo_workloads/Dockerfile.userver + cache_scope: slo-userver command: "" concurrency: @@ -116,9 +124,9 @@ jobs: uses: actions/cache@v4 with: path: ccache - key: slo-ccache-${{ matrix.sdk.preset }}-${{ github.run_id }} + key: ${{ matrix.sdk.cache_scope }}-ccache-${{ matrix.sdk.preset }}-${{ github.run_id }} restore-keys: | - slo-ccache-${{ matrix.sdk.preset }}- + ${{ matrix.sdk.cache_scope }}-ccache-${{ matrix.sdk.preset }}- - name: Inject ccache into BuildKit uses: reproducible-containers/buildkit-cache-dance@v3.1.2 @@ -127,16 +135,8 @@ jobs: { "ccache": "/root/.ccache" } - # Always extract so newly-compiled TUs from this run are saved by - # actions/cache (key uses ${{ github.run_id }}, so each run gets - # its own snapshot). Without extraction the cache stays frozen at - # whatever was first persisted. skip-extraction: false - # A clean build of the SLO image takes ~30 min because the Dockerfile - # rebuilds the full C++ toolchain + abseil/protobuf/grpc from source. - # The GHA cache lets subsequent runs reuse every layer up to the SDK - # source COPY, so only the actual workload link step reruns (~3 min). - name: Build current workload image uses: docker/build-push-action@v6 env: @@ -144,13 +144,13 @@ jobs: DOCKER_BUILD_RECORD_UPLOAD: "false" with: context: sdk-current - file: sdk-current/tests/slo_workloads/Dockerfile + file: sdk-current/${{ matrix.sdk.dockerfile }} platforms: linux/amd64 tags: ydb-app-current load: true build-args: PRESET=${{ matrix.sdk.preset }} - cache-from: type=gha,scope=slo-${{ matrix.sdk.preset }} - cache-to: type=gha,mode=max,scope=slo-${{ matrix.sdk.preset }} + cache-from: type=gha,scope=${{ matrix.sdk.cache_scope }}-${{ matrix.sdk.preset }} + cache-to: type=gha,mode=max,scope=${{ matrix.sdk.cache_scope }}-${{ matrix.sdk.preset }} - name: Build baseline workload image id: baseline-build @@ -161,16 +161,13 @@ jobs: DOCKER_BUILD_RECORD_UPLOAD: "false" with: context: sdk-baseline - file: sdk-baseline/tests/slo_workloads/Dockerfile + file: sdk-baseline/${{ matrix.sdk.dockerfile }} platforms: linux/amd64 tags: ydb-app-baseline load: true build-args: PRESET=${{ matrix.sdk.preset }} - cache-from: type=gha,scope=slo-${{ matrix.sdk.preset }} + cache-from: type=gha,scope=${{ matrix.sdk.cache_scope }}-${{ matrix.sdk.preset }} - # If the historical commit lacks the SLO Dockerfile or can't compile, - # reuse the current image so the SLO run is still comparable against - # itself rather than failing outright. - name: Fall back to current image for baseline if: steps.baseline-build.outcome == 'failure' run: | diff --git a/.github/workflows/slo_report.yml b/.github/workflows/slo_report.yml index a6e8a5c00e..5f5d5a50f7 100644 --- a/.github/workflows/slo_report.yml +++ b/.github/workflows/slo_report.yml @@ -2,13 +2,13 @@ name: SLO Report on: workflow_run: - workflows: ["SLO Native", "SLO Userver"] + workflows: ["SLO"] types: - completed jobs: publish-slo-report: - if: github.event.workflow_run.conclusion == 'success' + if: github.event.workflow_run.conclusion != 'skipped' runs-on: ubuntu-latest name: Publish YDB SLO Report permissions: @@ -25,35 +25,24 @@ jobs: remove-slo-label: needs: publish-slo-report - if: always() && github.event.workflow_run.event == 'pull_request' + if: github.event.workflow_run.conclusion != 'skipped' && github.event.workflow_run.event == 'pull_request' 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) { - 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; - } - } - } - } else { - console.log('No pull requests associated with this workflow run'); - } + env: + PRS: ${{ toJSON(github.event.workflow_run.pull_requests) }} + REPO: ${{ github.event.workflow_run.repository.full_name }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + PR=$(jq -r '.[0].number' <<<"$PRS") + if [ "$PR" = "null" ] || [ -z "$PR" ]; then + echo "No pull requests associated with this workflow run" + exit 0 + fi + gh pr edit "$PR" --repo "$REPO" --remove-label SLO || { + echo "SLO label not found on PR #${PR}, skipping" + } diff --git a/.github/workflows/slo_userver.yml b/.github/workflows/slo_userver.yml deleted file mode 100644 index 7882b8a2e2..0000000000 --- a/.github/workflows/slo_userver.yml +++ /dev/null @@ -1,172 +0,0 @@ -name: SLO Userver - -on: - pull_request: - types: [opened, reopened, synchronize, labeled] - -jobs: - ydb-slo-action: - if: contains(github.event.pull_request.labels.*.name, 'SLO') - - name: Run YDB SLO Tests (userver) - runs-on: ubuntu-latest - timeout-minutes: 120 - - permissions: - contents: read - - strategy: - fail-fast: false - matrix: - sdk: - - name: cpp-key-value-userver - preset: release-test-clang - command: "" - - concurrency: - group: slo-userver-${{ github.ref }}-${{ matrix.sdk.name }} - cancel-in-progress: true - - steps: - - name: Install dependencies - run: | - set -euxo pipefail - YQ_VERSION=v4.48.2 - BUILDX_VERSION=0.30.1 - COMPOSE_VERSION=2.40.3 - - sudo curl -fLo /usr/local/bin/yq \ - "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64" - sudo chmod +x /usr/local/bin/yq - - sudo mkdir -p /usr/local/lib/docker/cli-plugins - - sudo curl -fLo /usr/local/lib/docker/cli-plugins/docker-buildx \ - "https://github.com/docker/buildx/releases/download/v${BUILDX_VERSION}/buildx-v${BUILDX_VERSION}.linux-amd64" - sudo chmod +x /usr/local/lib/docker/cli-plugins/docker-buildx - - sudo curl -fLo /usr/local/lib/docker/cli-plugins/docker-compose \ - "https://github.com/docker/compose/releases/download/v${COMPOSE_VERSION}/docker-compose-linux-x86_64" - sudo chmod +x /usr/local/lib/docker/cli-plugins/docker-compose - - yq --version - docker --version - docker buildx version - docker compose version - - - name: Checkout current SDK version - uses: actions/checkout@v5 - with: - path: sdk-current - fetch-depth: 0 - submodules: true - - - name: Determine baseline commit - id: baseline - working-directory: sdk-current - run: | - set -euo pipefail - BASELINE=$(git merge-base HEAD origin/main) - echo "sha=${BASELINE}" >> "$GITHUB_OUTPUT" - - if git merge-base --is-ancestor "${BASELINE}" origin/main && \ - [ "$(git rev-parse origin/main)" = "${BASELINE}" ]; then - BASELINE_REF="main" - else - BRANCH=$(git branch -r --contains "${BASELINE}" | grep -v HEAD | head -1 | sed 's|.*/||' || echo "") - if [ -n "${BRANCH}" ]; then - BASELINE_REF="${BRANCH}@${BASELINE:0:7}" - else - BASELINE_REF="${BASELINE:0:7}" - fi - fi - echo "ref=${BASELINE_REF}" >> "$GITHUB_OUTPUT" - - - name: Checkout baseline SDK version - uses: actions/checkout@v5 - with: - ref: ${{ steps.baseline.outputs.sha }} - path: sdk-baseline - fetch-depth: 1 - submodules: true - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Stage workload harness - run: | - set -euxo pipefail - rm -rf sdk-baseline/tests/slo_workloads - cp -a sdk-current/tests/slo_workloads sdk-baseline/tests/slo_workloads - cp sdk-current/tests/slo_workloads/.dockerignore sdk-current/.dockerignore - cp sdk-baseline/tests/slo_workloads/.dockerignore sdk-baseline/.dockerignore - - - name: Restore ccache - id: ccache - uses: actions/cache@v4 - with: - path: ccache - key: slo-userver-ccache-${{ matrix.sdk.preset }}-${{ github.run_id }} - restore-keys: | - slo-userver-ccache-${{ matrix.sdk.preset }}- - - - name: Inject ccache into BuildKit - uses: reproducible-containers/buildkit-cache-dance@v3.1.2 - with: - cache-map: | - { - "ccache": "/root/.ccache" - } - skip-extraction: false - - - name: Build current workload image - uses: docker/build-push-action@v6 - env: - DOCKER_BUILD_SUMMARY: "false" - DOCKER_BUILD_RECORD_UPLOAD: "false" - with: - context: sdk-current - file: sdk-current/tests/slo_workloads/Dockerfile.userver - platforms: linux/amd64 - tags: ydb-app-current - load: true - build-args: PRESET=${{ matrix.sdk.preset }} - cache-from: type=gha,scope=slo-userver-${{ matrix.sdk.preset }} - cache-to: type=gha,mode=max,scope=slo-userver-${{ matrix.sdk.preset }} - - - name: Build baseline workload image - id: baseline-build - continue-on-error: true - uses: docker/build-push-action@v6 - env: - DOCKER_BUILD_SUMMARY: "false" - DOCKER_BUILD_RECORD_UPLOAD: "false" - with: - context: sdk-baseline - file: sdk-baseline/tests/slo_workloads/Dockerfile.userver - platforms: linux/amd64 - tags: ydb-app-baseline - load: true - build-args: PRESET=${{ matrix.sdk.preset }} - cache-from: type=gha,scope=slo-userver-${{ matrix.sdk.preset }} - - - name: Fall back to current image for baseline - if: steps.baseline-build.outcome == 'failure' - run: | - echo "Baseline build failed; reusing current image as baseline." - docker tag ydb-app-current ydb-app-baseline - - - name: Run SLO Tests - uses: ydb-platform/ydb-slo-action/init@v2 - timeout-minutes: 30 - with: - github_issue: ${{ github.event.pull_request.number }} - github_token: ${{ secrets.GITHUB_TOKEN }} - workload_name: ${{ matrix.sdk.name }} - workload_duration: "600" - workload_current_ref: ${{ github.head_ref || github.ref_name }} - workload_current_image: ydb-app-current - workload_current_command: ${{ matrix.sdk.command }} --read-rps 1000 --write-rps 100 - workload_baseline_ref: ${{ steps.baseline.outputs.ref }} - workload_baseline_image: ydb-app-baseline - workload_baseline_command: ${{ matrix.sdk.command }} --read-rps 1000 --write-rps 100