Skip to content

Conversation

@naspirato
Copy link
Collaborator

@naspirato naspirato commented Nov 27, 2025

Что добавлено

  • Центральная часть: интерактивные бейджи в теле PR (Run tests / Backport) — позволяют:
    • запускать workflow напрямую (▶),
    • открыть UI для редактирования параметров перед запуском (⚙️).
  • Генерация и вставка бейджей реализована в validate_pr_description.py (при включённой фиче).
  • Список целевых веток для бэкпортов вынесен в .github/config/backport_branches.json.
  • Прическа UX для прогонов тестов:
    • .github/actions/run_tests/pr_comment.py — создаёт/обновляет комментарий в PR при старте и по завершении прогона (с ссылкой на run).
    • run_tests workflow обновлён: публикует стартовый комментарий и обновляет его с результатами.
  • Поддержка и тестирование:
    • .github/actions/validate_pr_description/test_validation.py — локальная проверка валидации и превью генерации таблиц.
    • action.yaml прокидывает SHOW_ADDITIONAL_INFO_IN_PR и APP_DOMAIN в окружение.
  • Мелкие правки: правки в .github/scripts/cherry_pick_v2.py и мелкие поправки в run_tests.yml (sparse-checkout, опции).

Критерии приёмки

  • Бейджи видны в теле PR (вставлены после секции "Description for reviewers" или в конце).
  • По клику на ▶ запускается соответствующий workflow с нужными параметрами (build_preset, test_size, test_targets, pr_number и т.д.).
  • По клику на ⚙️ открывается UI для проверки/правки параметров перед запуском.
  • Бейджи для бэкпорта создают отдельные запуски для каждой целевой ветки и кнопку для массового бэкпорта.
  • Комментарии в PR появляются при старте прогона и обновляются по завершении с итоговым статусом и ссылкой на run.
  • Таблицы/бейджи добавляются автоматом только если SHOW_ADDITIONAL_INFO_IN_PR=TRUE и APP_DOMAIN задан; в противном случае тело PR не меняется.

Changelog entry

...
Not for changelog (changelog entry is not required)

Changelog category

  • Not for changelog (changelog entry is not required)

Description for reviewers

...

🔄 Backport

Actions
▶ stable-25-2,stable-25-2-1,stable-25-3,stable-25-3-1 ⚙️
▶ stable-25-3,stable-25-3-1 ⚙️
▶ stable-25-3 ⚙️

⚙️ Backport (custom)

Legend:

  • ▶ - immediately runs the workflow with default parameters
  • ⚙️ - opens UI to review and modify parameters before running

@github-actions
Copy link

github-actions bot commented Nov 27, 2025

🟢 2025-11-28 14:22:05 UTC The validation of the Pull Request description is successful.

@github-actions
Copy link

github-actions bot commented Nov 27, 2025

Test Run Completed Successfully

Build Preset: relwithdebinfo
Test Size: small,medium
Test Targets: ydb/tests/olap/common

Test Results:

Tests successful.

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
0 0 0 0 0 0

View workflow run

@github-actions
Copy link

github-actions bot commented Nov 27, 2025

Test Run Completed Successfully

Build Preset: relwithdebinfo
Test Size: small,medium
Test Targets: ydb/core/kqp/ut/olap/

Test Results:

Tests successful.

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
7985 7985 0 0 0 0

View workflow run

@ydbot
Copy link
Collaborator

ydbot commented Nov 27, 2025

Backported to stable-25-3-1: draft PR #29712 (contains conflicts requiring manual resolution) - workflow run

@naspirato naspirato marked this pull request as ready for review November 27, 2025 23:22
Copilot AI review requested due to automatic review settings November 27, 2025 23:22
@naspirato naspirato changed the title Add PR comment functionality for test runs Badges to PR body Nov 27, 2025
This commit updates the `validate_pr_description.py` script to check for the presence of a legend in the PR body before appending it. If the legend already exists, it will not be added again, improving the clarity and conciseness of PR descriptions.

Key changes:
- Added a check for the legend's existence in the PR body.
- Modified the logic for appending tables and the legend to ensure no duplicates are included.
This commit enhances the `test_validation.py` script by adding functionality to automatically determine the GitHub repository from the git remote URL. This improvement allows for better local testing by setting the `GITHUB_REPOSITORY` environment variable if it is not already defined.

Key changes:
- Introduced `find_github_repository` function to extract the repository name from the git remote URL.
- Updated the main function to set `GITHUB_REPOSITORY` for local testing, improving usability and reducing manual setup requirements.
- Enhanced documentation to clarify the automatic setting of `GITHUB_WORKSPACE` and `GITHUB_REPOSITORY` environment variables.
…te_pr_description.py`. The script now directly uses the PR body for validation, streamlining the process and improving usability.
This commit modifies the `validate_pr_description` workflow to introduce two new environment variables: `SHOW_RUN_TESTS_IN_PR` and `SHOW_BACKPORT_IN_PR`. These flags control the inclusion of test execution and backport tables in the PR body. The `ensure_tables_in_pr_body` function is updated to handle these flags, allowing for more flexible table generation based on user requirements.

Key changes:
- Replaced `SHOW_ADDITIONAL_INFO_IN_PR` with the new flags in the action configuration.
- Updated `test_validation.py` to reflect the new environment variables and their usage.
- Enhanced `validate_pr_description.py` to conditionally add tables based on the new flags, improving the clarity and usability of PR descriptions.
This commit enhances the `generate_backport_table` function in `validate_pr_description.py` to collect and sort unique branches from the input. The changes ensure that the backporting URL is generated for all unique branches, improving the accuracy and clarity of the backport table in PR descriptions.

Key changes:
- Updated logic to collect unique branches from multiple entries.
- Sorted branches for consistent output.
- Modified the backport button label for clarity.
@github-actions
Copy link

github-actions bot commented Nov 28, 2025

2025-11-28 13:47:46 UTC Pre-commit check linux-x86_64-release-asan for b21cafa has started.
2025-11-28 13:48:15 UTC Artifacts will be uploaded here
2025-11-28 14:03:49 UTC ya make is running...
🟢 2025-11-28 14:03:55 UTC Tests successful.

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
0 0 0 0 0 0

🟢 2025-11-28 14:04:01 UTC Build successful.
2025-11-28 14:04:12 UTC Check cancelled

@github-actions
Copy link

github-actions bot commented Nov 28, 2025

2025-11-28 13:55:06 UTC Pre-commit check linux-x86_64-relwithdebinfo for b21cafa has started.
2025-11-28 13:55:23 UTC Artifacts will be uploaded here
2025-11-28 13:58:13 UTC ya make is running...
🟢 2025-11-28 13:58:20 UTC Tests successful.

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
0 0 0 0 0 0

🟢 2025-11-28 13:58:26 UTC Build successful.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +204 to +209
# Try to get PR number from remaining args
if len(sys.argv) > idx + 2:
try:
pr_number = int(sys.argv[idx + 2])
except ValueError:
pass
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The argument parsing logic has an issue. When --body-file is used with a PR number (e.g., test_validation.py --body-file file.txt 12345), the PR number would be at index 3, but the code tries to parse it from sys.argv[idx + 2] where idx is the index of --body-file (index 1). This means sys.argv[3] would be the PR number, which is correct. However, if the command is test_validation.py 12345 --body-file file.txt, then idx is 2, and sys.argv[4] would be accessed, which might not exist. The logic should handle different argument orders more robustly.

Copilot uses AI. Check for mistakes.
url = f"{base_url}?{query_string}"
url_ui = f"{base_url}?{query_string}&ui=true"

rows.append(f"| [![▶ {branch}](https://img.shields.io/badge/%E2%96%B6_{branch.replace('-', '_')}-4caf50?style=flat-square)]({url}) [![⚙️](https://img.shields.io/badge/%E2%9A%99%EF%B8%8F-ff9800?style=flat-square)]({url_ui}) |")
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The badge label for backport branches at line 192 uses branch.replace('-', '_') but doesn't handle commas. When a branch entry contains multiple branches separated by commas (e.g., "stable-25-2,stable-25-2-1,stable-25-3"), the commas will remain in the badge label, which may cause issues with URL encoding or badge rendering. Consider also replacing commas with underscores or another separator: branch.replace('-', '_').replace(',', '_').

Suggested change
rows.append(f"| [![▶ {branch}](https://img.shields.io/badge/%E2%96%B6_{branch.replace('-', '_')}-4caf50?style=flat-square)]({url}) [![⚙️](https://img.shields.io/badge/%E2%9A%99%EF%B8%8F-ff9800?style=flat-square)]({url_ui}) |")
rows.append(f"| [![▶ {branch}](https://img.shields.io/badge/%E2%96%B6_{branch.replace('-', '_').replace(',', '_')}-4caf50?style=flat-square)]({url}) [![⚙️](https://img.shields.io/badge/%E2%9A%99%EF%B8%8F-ff9800?style=flat-square)]({url_ui}) |")

Copilot uses AI. Check for mistakes.
if not run_id:
raise ValueError("GITHUB_RUN_ID environment variable is not set")

return f"{github_server}/{github_repo}/actions/runs/{run_id}"
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR comment logic identifies comments by workflow run URL (line 35), but the "Update PR comment with results" step runs within the matrix job (lines 245-256 in run_tests.yml). Since all matrix jobs share the same GITHUB_RUN_ID, they will all try to update the same comment. This will cause the last completing matrix job to overwrite the results from other jobs, losing information about tests for other branches. Consider either:

  1. Creating separate comments per matrix branch by including the branch in the identifier
  2. Moving the update step to a separate job that runs after all matrix jobs complete and aggregates results
  3. Including the matrix branch context in the comment identification and creating one comment per branch

Copilot uses AI. Check for mistakes.
This commit updates the issue pattern matching in `pr_template.py` to use a negative lookahead, preventing false matches with branch names in URLs. Additionally, the `validate_pr_description.py` script is modified to check for the "Bugfix" category in a case-insensitive manner, improving the accuracy of PR description validation.

Key changes:
- Updated issue pattern to avoid matching branch names.
- Added case-insensitive check for "Bugfix" category in PR descriptions.
@github-actions
Copy link

github-actions bot commented Nov 28, 2025

2025-11-28 14:05:50 UTC Pre-commit check linux-x86_64-release-asan for 0a9145b has started.
2025-11-28 14:06:21 UTC Artifacts will be uploaded here
2025-11-28 14:08:33 UTC ya make is running...
🟢 2025-11-28 14:08:41 UTC Tests successful.

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
0 0 0 0 0 0

🟢 2025-11-28 14:08:51 UTC Build successful.

@github-actions
Copy link

github-actions bot commented Nov 28, 2025

2025-11-28 14:20:08 UTC Pre-commit check linux-x86_64-release-asan for d895f23 has started.
2025-11-28 14:20:24 UTC Artifacts will be uploaded here
2025-11-28 14:34:15 UTC ya make is running...
🟢 2025-11-28 14:34:21 UTC Tests successful.

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
0 0 0 0 0 0

🟢 2025-11-28 14:34:27 UTC Build successful.

@github-actions
Copy link

github-actions bot commented Nov 28, 2025

2025-11-28 14:31:56 UTC Pre-commit check linux-x86_64-relwithdebinfo for d895f23 has started.
2025-11-28 14:32:14 UTC Artifacts will be uploaded here
2025-11-28 14:41:49 UTC ya make is running...
🟢 2025-11-28 14:41:56 UTC Tests successful.

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
0 0 0 0 0 0

🟢 2025-11-28 14:42:01 UTC Build successful.

@maximyurchuk
Copy link
Collaborator

🔄 Backport

Actions
▶ stable-25-2,stable-25-2-1,stable-25-3,stable-25-3-1 ⚙️
▶ stable-25-3,stable-25-3-1 ⚙️
▶ stable-25-3 ⚙️

⚙️ Backport (custom)

Legend:

  • ▶ - immediately runs the workflow with default parameters
  • ⚙️ - opens UI to review and modify parameters before running

@maximyurchuk
Copy link
Collaborator

maximyurchuk commented Nov 28, 2025

  • скругленные углы
  • разная ширина бэйджей (возможно стоит вынести список бранчей в отдельный столбец)
  • показывать только после мерджа (но прям сразу)
  • дефисы пропали
  • потерялись параметры после авторизации
  • commits выглядит странно в аппе, там же пр. Вроде не так было
  • 🔄 не нужно
  • убрать запуск одной кнопкой, легенда тоже становится не нужна
  • как то отметить что нужно просто нажать run workflow и оно само

@ydbot
Copy link
Collaborator

ydbot commented Nov 28, 2025

Backported to stable-25-3: draft PR #29786 (contains conflicts requiring manual resolution) - workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants