Skip to content

Commit e5a1e6d

Browse files
authored
Merge pull request #20 from Fortune-Ndlovu/feat/rhdh-pr-review
feat: add rhdh-pr-review skill for testing operator PRs on live clusters
2 parents 6f974bf + d2baecb commit e5a1e6d

6 files changed

Lines changed: 815 additions & 4 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ Track work across the four RHDH Jira projects.
4949
- **[to-issue](./skills/rhdh-jira/references/to-issue.md)** — Create a Story, Task, Bug, or Spike with automatic type inference. Grills on implementation details and story points.
5050
- **[update-jira-status](./skills/rhdh-jira/references/update-jira-status.md)** — Update an issue with session progress. Detects the related issue, adds a status comment, proposes transitions, and checks upward cascade to parent Epic/Feature.
5151

52+
### PR Review
53+
54+
- **[rhdh-pr-review](./skills/rhdh-pr-review/SKILL.md)** — Test PR changes on a live RHDH cluster. Swaps CI images, verifies code changes, and reports findings.
55+
5256
### Orchestration
5357

5458
- **[rhdh](./skills/rhdh/SKILL.md)** — Entry point and router. Detects your environment, runs `doctor` checks, maintains a cross-session worklog, and routes to the right skill. Start here if you're not sure what you need.

skills/rhdh-pr-review/SKILL.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
name: rhdh-pr-review
3+
description: Test PR changes on a live RHDH cluster. Fetches CI-built images from PR comments, checks cluster status (deploying if needed), deploys the full PR operator bundle or manifests (not just image swap), actively verifies the code changes by exercising affected code paths on the cluster, and closes with findings including best-practice and security assessment. Use when asked to review an rhdh-operator PR, test PR changes on a cluster, deploy PR images for testing, or deploy PR bundle. Also use when user mentions "operator PR", "review PR", or "test this PR on my cluster". Currently supports rhdh-operator PRs.
4+
---
5+
6+
<cli_setup>
7+
This skill uses the orchestrator CLI for activity tracking. **Set up first:**
8+
9+
```bash
10+
RHDH=../rhdh/scripts/rhdh
11+
```
12+
</cli_setup>
13+
14+
<essential_principles>
15+
16+
<principle name="ensure_cluster">
17+
Always verify the user has a running RHDH cluster with `oc` access before deploying PR bundles.
18+
If no cluster or no RHDH instance, provision one using `redhat-developer/rhdh-test-instance` — see `rhdh-repos.md` for details on that repo's capabilities.
19+
Don't just tell the user to set things up — do it.
20+
</principle>
21+
22+
<principle name="use_pr_comment_images">
23+
Extract image URLs from PR comments posted by CI — never construct image URLs manually.
24+
The tag format includes PR number + commit SHA, which only CI knows.
25+
See `references/operator-pr-images.md` for extraction commands.
26+
</principle>
27+
28+
<principle name="deploy_full_bundle">
29+
Deploy the full PR bundle/manifests, not just the operator binary image.
30+
PR changes to CRDs, RBAC, default config, or bundle metadata are baked into the OLM bundle or install.yaml manifests — a binary-only image swap misses them and the operator may fail to reconcile.
31+
For OLM-managed installs, replace the CatalogSource with the PR's `operator-catalog` image so OLM reinstalls the full bundle (CRDs, RBAC, CSV, deployment).
32+
For non-OLM installs, fetch and apply the PR branch's `install.yaml` (CRDs, RBAC, ConfigMaps, Deployment) with the CI-built operator image substituted in.
33+
Both paths preserve existing Backstage CRs, config, and Keycloak state — only the operator-side resources are replaced.
34+
</principle>
35+
36+
</essential_principles>
37+
38+
<intake>
39+
40+
## What would you like to do?
41+
42+
### PR Review Tasks
43+
44+
*For testing PR changes on a live RHDH cluster*
45+
46+
1. **Review rhdh-operator PR** — Deploy PR operator bundle on cluster and get review checklist
47+
48+
**Wait for response before proceeding.**
49+
50+
</intake>
51+
52+
<routing>
53+
54+
### PR Review Routes
55+
56+
| Response | Workflow |
57+
|----------|----------|
58+
| 1, "operator", "rhdh-operator", a PR number, "review" | Route to `workflows/review-operator-pr.md` |
59+
60+
**To route:** Read `workflows/review-operator-pr.md` and follow its process.
61+
62+
</routing>
63+
64+
<reference_index>
65+
66+
| Reference | Purpose | Path |
67+
|-----------|---------|------|
68+
| operator-pr-images | CI image extraction and validation | `references/operator-pr-images.md` |
69+
| github-reference | gh CLI patterns, PR queries | `../rhdh/references/github-reference.md` |
70+
| rhdh-repos | RHDH ecosystem repository map | `../rhdh/references/rhdh-repos.md` |
71+
72+
73+
</reference_index>
74+
75+
<skills_index>
76+
77+
| Skill | Purpose | Path |
78+
|-------|---------|------|
79+
| rhdh | Orchestrator, environment status, activity tracking | `../rhdh/SKILL.md` |
80+
81+
</skills_index>
82+
83+
<success_criteria>
84+
85+
See `workflows/review-operator-pr.md` `<success_criteria>` for the full checklist.
86+
87+
</success_criteria>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Reference: rhdh-operator PR Container Images
2+
3+
How to find and validate CI-built images for operator PRs. The CI workflow definition lives in the rhdh-operator repo at `.github/workflows/pr-container-build.yaml` — read it for the authoritative build behavior.
4+
5+
<what_to_know>
6+
7+
## Key Facts
8+
9+
- CI builds three images per PR: `operator`, `operator-bundle`, `operator-catalog`
10+
- Registry: `quay.io/rhdh-community/`
11+
- Tag format includes PR number + commit SHA (only CI knows the exact tag — never construct manually)
12+
- Images expire after 14 days (`quay.expires-after=14d` label)
13+
14+
</what_to_know>
15+
16+
<extracting_from_pr>
17+
18+
## Finding Image URLs
19+
20+
CI posts a comment on the PR with built image URLs. Extract the latest one:
21+
22+
```bash
23+
REPO="redhat-developer/rhdh-operator"
24+
PR_NUMBER=<number>
25+
26+
gh pr view $PR_NUMBER --repo $REPO --json comments \
27+
--jq '.comments[] | select(.body | test("quay.io/rhdh-community/operator:")) | .body' \
28+
| tail -1
29+
```
30+
31+
**If no comment found**, the CI workflow may not have run yet. Check status:
32+
33+
```bash
34+
BRANCH=$(gh pr view $PR_NUMBER --repo $REPO --json headRefName --jq '.headRefName')
35+
gh run list --repo $REPO --branch $BRANCH --workflow pr-container-build.yaml --limit 1 \
36+
--json status,conclusion
37+
```
38+
39+
- `in_progress` — wait for it to finish
40+
- `failure` — build failed, check workflow logs
41+
- No runs — CI may not have triggered (draft PR, docs-only change, external contributor)
42+
43+
</extracting_from_pr>
44+
45+
<validation>
46+
47+
## Validating Images Exist
48+
49+
```bash
50+
skopeo inspect docker://quay.io/rhdh-community/operator:TAG --raw 2>/dev/null \
51+
&& echo "Image exists" || echo "Image not found or expired"
52+
```
53+
54+
If expired (14-day TTL), the PR author needs to push a new commit to retrigger CI.
55+
56+
</validation>

0 commit comments

Comments
 (0)