Skip to content

Commit 894193c

Browse files
vmrh21claude
andcommitted
fix: update cve.fix.md to use new simplified mapping schema
- Step 3.1: look up container in repos[].containers[] (not container_to_repo_mapping) - Step 3.2: iterate .components[X].repos[] (not repositories object) - Example JSON updated from old nested structure to new flat repos[] array Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 4dab8d1 commit 894193c

1 file changed

Lines changed: 24 additions & 31 deletions

File tree

workflows/cve-fixer/.claude/commands/cve.fix.md

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -132,22 +132,21 @@ Summary:
132132
**3.1: Use container to scope repos (preferred)**
133133

134134
If a `CONTAINER` was extracted in Step 1:
135-
- Look up `CONTAINER` in `container_to_repo_mapping` for the component
136-
- **If container not found in mapping**:
135+
- Search all repos in `.components[COMPONENT].repos[]` for one whose `.containers[]` includes `CONTAINER`
136+
- **If container not found**:
137137
- Log a warning: "⚠️ Container [CONTAINER] not in mapping — may be a new container not yet registered. Processing all component repos."
138138
- Fall back to processing all repos in the component (scan in Step 5 filters irrelevant ones)
139-
- **If container found**: gives the **primary repo** (e.g., `opendatahub-io/workload-variant-autoscaler`)
140-
- Check if the primary repo has a `subcomponent` field in the `repositories` section
139+
- **If container found**: note which repo it belongs to, read its `subcomponent` field
141140
- **If `subcomponent` is defined**: collect all repos in the component with the same `subcomponent` value — this is the chain (upstream + midstream + downstream)
142-
- **If `subcomponent` is not defined**: process ALL repositories in the component (safe fallback — the CVE scan in Step 5 will filter out repos where the CVE doesn't exist)
141+
- **If `subcomponent` is not defined**: process ALL repos in the component (safe fallback — the CVE scan in Step 5 will filter out repos where the CVE doesn't exist)
143142
- **This ensures only the repos relevant to that specific container get PRs** — not repos belonging to other subcomponents
144143

145-
Example: `rhoai/odh-workload-variant-autoscaler-controller-rhel9` → primary repo `opendatahub-io/workload-variant-autoscaler` `subcomponent: autoscaler` → only process `llm-d/llm-d-workload-variant-autoscaler`, `opendatahub-io/workload-variant-autoscaler`, `red-hat-data-services/workload-variant-autoscaler`.
144+
Example: `rhoai/odh-workload-variant-autoscaler-controller-rhel9` found in repo with `subcomponent: autoscaler` → only process `llm-d/llm-d-workload-variant-autoscaler`, `opendatahub-io/workload-variant-autoscaler`, `red-hat-data-services/workload-variant-autoscaler`.
146145

147146
**3.2: Fallback — use all repos**
148147

149148
If no `CONTAINER` was extracted (summary doesn't match expected pattern):
150-
- Process ALL repositories listed under the component
149+
- Process all entries in `.components[COMPONENT].repos[]`
151150
- The CVE scan in Step 5 acts as the safety net — it will skip repos where the CVE doesn't exist
152151
- Log a warning: "⚠️ Could not extract container from summary — processing all component repos"
153152

@@ -1485,37 +1484,31 @@ After completing this phase:
14851484
- Filter the repository list to only those that contain the CVE
14861485
- **Multi-Repository Support**: A single component can map to MULTIPLE repositories
14871486
- Common pattern: an **upstream** repo (e.g., `opendatahub-io/models-as-a-service`) and one or more **downstream** repos (e.g., `red-hat-data-services/models-as-a-service`)
1488-
- Each repository has its own `default_branch`, `cve_fix_workflow`, and `repo_type`
1489-
- The `repo_type` field can be `"upstream"` or `"downstream"` to indicate the relationship
1490-
- When fixing CVEs, iterate through ALL repositories for the component and apply fixes to each one independently
1491-
- Downstream repos often track different branches (e.g., `rhoai-3.0`) than upstream (`main`)
1492-
- Each repository gets its own clone directory, feature branch, verification, test run, and PR
1493-
- **Mapping File Structure**:
1487+
- Each repo entry has its own `default_branch`, `active_branches`, and `type`
1488+
- The `type` field is `"upstream"`, `"midstream"`, or `"downstream"`
1489+
- When fixing CVEs, iterate through ALL repos for the component and apply fixes to each one independently
1490+
- Downstream repos often track different branches (e.g., `rhoai-3.4`) than upstream (`main`)
1491+
- Each repo gets its own clone directory, feature branch, verification, test run, and PR
1492+
- **Mapping File Structure** (simplified schema):
14941493
```json
14951494
{
14961495
"components": {
14971496
"Component Name": {
1498-
"container_to_repo_mapping": { ... },
1499-
"repositories": {
1500-
"org/repo-upstream": {
1497+
"repos": [
1498+
{
1499+
"url": "https://github.com/org/upstream-repo",
1500+
"type": "upstream",
15011501
"default_branch": "main",
1502-
"active_release_branches": [...],
1503-
"cve_fix_workflow": {
1504-
"primary_target": "main",
1505-
"backport_targets": "..."
1506-
},
1507-
"repo_type": "upstream"
1502+
"active_branches": ["release-0.6"],
1503+
"containers": ["rhoai/odh-container-rhel9"]
15081504
},
1509-
"org/repo-downstream": {
1510-
"default_branch": "rhoai-3.0",
1511-
"active_release_branches": ["rhoai-3.0"],
1512-
"cve_fix_workflow": {
1513-
"primary_target": "rhoai-3.0",
1514-
"backport_targets": "rhoai-3.0"
1515-
},
1516-
"repo_type": "downstream"
1505+
{
1506+
"url": "https://github.com/org/downstream-repo",
1507+
"type": "downstream",
1508+
"default_branch": "main",
1509+
"active_branches": ["rhoai-3.4", "rhoai-3.4-ea.2"]
15171510
}
1518-
}
1511+
]
15191512
}
15201513
}
15211514
}

0 commit comments

Comments
 (0)