perf: auto-file Gitea issues on pipeline step failure/skip and test failure/skip #213

Closed
opened 2026-03-25 01:00:47 +00:00 by kert · 1 comment
Owner

Problem

Pipeline step failures, skips, and test failures/skips were not automatically creating Gitea issues.

Solution

  • src/perf/hooks.py — on_step_failure(), on_step_skip(), pytest_runtest_logreport()
  • Pipeline runner wired to call on_step_failure() on any exception
  • Pytest hook registered in tests/conftest.py (gated by STACK_FILE_TEST_ISSUES env var)
  • Reuses existing GiteaClient.create_issue() and label resolution

Activation

  • Pipeline hooks: always active when perf is installed
  • Test hooks: set STACK_FILE_TEST_ISSUES=true in CI workflows

Tests

11 tests covering:

  • Issue title/body generation for step failures and skips
  • Label assignment (bug+pipeline for failures, pipeline for skips)
  • Pytest hook gating (setup phase ignored, env var required)
  • Runner integration (mock verifies hook fires on exception)
## Problem Pipeline step failures, skips, and test failures/skips were not automatically creating Gitea issues. ## Solution - `src/perf/hooks.py` — `on_step_failure()`, `on_step_skip()`, `pytest_runtest_logreport()` - Pipeline runner wired to call `on_step_failure()` on any exception - Pytest hook registered in `tests/conftest.py` (gated by `STACK_FILE_TEST_ISSUES` env var) - Reuses existing `GiteaClient.create_issue()` and label resolution ## Activation - Pipeline hooks: always active when `perf` is installed - Test hooks: set `STACK_FILE_TEST_ISSUES=true` in CI workflows ## Tests 11 tests covering: - Issue title/body generation for step failures and skips - Label assignment (bug+pipeline for failures, pipeline for skips) - Pytest hook gating (setup phase ignored, env var required) - Runner integration (mock verifies hook fires on exception)
kert added this to the P26: Pipeline Telemetry — OTel instrumentation, perf module, Grafana dashboards milestone 2026-03-25 01:00:47 +00:00
Author
Owner

Complete.

Created:

  • src/perf/hooks.py — 3 hooks:
    • on_step_failure(step, exc, pipeline=) — files issue with traceback, labels bug+pipeline
    • on_step_skip(step, pipeline=, reason=) — files issue with skip reason, label pipeline
    • pytest_runtest_logreport(report) — fires on test failure/skip when STACK_FILE_TEST_ISSUES=true

Modified:

  • src/aco/pipe/runner.py — wraps step execution in try/except, calls on_step_failure on raise
  • tests/conftest.py — imports pytest_runtest_logreport from perf.hooks (gated by ImportError)

Tests: 11 in test_hooks.py

✅ 12,037 total passed, lint clean.

Complete. **Created:** - `src/perf/hooks.py` — 3 hooks: - `on_step_failure(step, exc, pipeline=)` — files issue with traceback, labels `bug`+`pipeline` - `on_step_skip(step, pipeline=, reason=)` — files issue with skip reason, label `pipeline` - `pytest_runtest_logreport(report)` — fires on test failure/skip when `STACK_FILE_TEST_ISSUES=true` **Modified:** - `src/aco/pipe/runner.py` — wraps step execution in try/except, calls `on_step_failure` on raise - `tests/conftest.py` — imports `pytest_runtest_logreport` from `perf.hooks` (gated by ImportError) **Tests:** 11 in `test_hooks.py` ✅ 12,037 total passed, lint clean.
kert closed this issue 2026-03-25 01:08:47 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: homelab/stack#213