feat: triage test impact analysis for CI pipeline#1196
Open
decko wants to merge 4 commits into
Open
Conversation
Contributor
Reviewer's GuideIntegrates a Rust-based triage test impact analysis tool into the Tekton CI build and test pipelines, wiring in URL/OpenAPI discovery, diff generation, and conditional pytest execution with robust fallbacks and a manual full-test override. Flow diagram for triage test impact integration in Tekton CIflowchart LR
%% Build pipeline
subgraph Build_Pipeline
CR[clone-repository task]
TD[triage-diff task
generate-diff]
PD[prefetch-dependencies task]
BI[build-image task]
end
CR --> TD
TD --> PD
PD --> BI
%% Test pipeline
subgraph Test_Pipeline
DE[deploy-environment tasks]
TU[django-admin triage_urls
generate .triage/urls.json]
TB[triage_binary tools/triage/triage
build dependency map
select tests]
DQ[check PR description
for full-test marker]
DF[[triage failure
or missing .triage/pr.diff]]
PT[conditional pytest blocks]
FT[full pytest run]
end
BI --> DE
DE --> TU
TU --> TB
TB -->|affected tests selected| PT
TB --> DF
DF --> FT
DQ -->|marker present| FT
DQ -->|no marker| TB
PT -->|no tests selected| FT
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider extracting the repeated
python3 -cJSON parsing/plugins_affectedchecks into a small helper script or function to avoid duplication and make it easier to evolve the triage JSON schema or selection logic in one place. - The newly added
.gitattributesfile is currently empty; it would be useful to add entries fortools/triage/triage(e.g., mark as binary and disable EOL normalization) so the committed Rust binary is handled consistently by Git.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider extracting the repeated `python3 -c` JSON parsing/`plugins_affected` checks into a small helper script or function to avoid duplication and make it easier to evolve the triage JSON schema or selection logic in one place.
- The newly added `.gitattributes` file is currently empty; it would be useful to add entries for `tools/triage/triage` (e.g., mark as binary and disable EOL normalization) so the committed Rust binary is handled consistently by Git.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Pre-built Rust CLI from agent-project/triage/ that analyzes Python test dependencies and selects only affected tests for a given diff. Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Exports URL routing map to .triage/urls.json by walking django.urls.get_resolver(). Used by triage to map API endpoints to viewset classes for test impact analysis. Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds a triage-diff Tekton task that runs after clone-repository and before build-container. It generates a git diff of PR changes and writes it to .triage/pr.diff in the workspace so it gets baked into the container image for downstream test selection. Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cd8fc57 to
5496559
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Integrates triage — a Rust-based test impact analysis tool — into the Tekton CI pipelines to skip unaffected tests on PRs, saving ~30-45 minutes per pipeline run.
triage-difftask generates the PR diff and bakes it into the container image[full-test]marker in PR description forces all testsChanges
tools/triage/triage— pre-built Rust binary for test impact analysis (3.4MB, with SHA256 checksum)pulp_service/management/commands/triage_urls.py— Django management command to export URL routing map.tekton/pulp-pull-request.yaml— addtriage-difftask between clone and build.tekton/pulp-deploy-and-test.yaml— add triage pre-step and wrap all 6 pytest blocks in conditionalsTest plan
pulp_service/app/constants.py— verify triage selects only affected tests and skips plugin blockspulp_service/app/middleware.py— verify run-all trigger fires and all tests run[full-test]in description — verify all tests run.triage/pr.diff) falls back to full test run gracefully🤖 Generated with Claude Code
Summary by Sourcery
Integrate a triage-based test impact analysis flow into the CI pipelines to selectively run affected tests on pull requests while preserving a safe fallback to the full suite.
New Features:
Enhancements:
CI:
Documentation:
Tests: