feat: add prow-trigger-nightly skill#26
Conversation
Port the trigger-nightly-job bash script from the rhdh repo to a stdlib-only Python skill. Supports triggering nightly jobs for both the rhdh and rhdh-plugin-export-overlays repos via the OpenShift CI Gangway REST API. Assisted-by: OpenCode
Overlay jobs don't support parameter overrides or Slack alerts via Gangway. Previously the script silently ignored these flags (with a warning for overrides, nothing for --send-alerts). Now it errors out and lists all unsupported flags, giving the user clear feedback. Assisted-by: OpenCode
… flags Cross-checked with openshift/release step-ref YAMLs. Overlay jobs support GITHUB_ORG_NAME, GITHUB_REPOSITORY_NAME, and RELEASE_BRANCH_NAME overrides but NOT IMAGE_REPO, IMAGE_REGISTRY, TAG_NAME, or SKIP_SEND_ALERT. The script now allows --org, --repo, --branch for overlay jobs and errors only on the unsupported flags. Assisted-by: OpenCode
durandom
left a comment
There was a problem hiding this comment.
Review Summary
Clean, well-structured single-purpose CLI skill. Correct stdlib-only implementation, thorough error handling, good security practices (list-form subprocess, dedicated kubeconfig, proper URL encoding). The SKILL.md workflow with natural language mapping is excellent agent UX.
Verdict: Approve — no bugs, no security issues.
Suggestions (non-blocking)
1. Argument group label is misleading
overrides = parser.add_argument_group("RHDH job overrides (ignored for overlay jobs)")These flags actually error out for overlay jobs (sys.exit(1)), they're not silently ignored. Consider: "RHDH job overrides (not supported for overlay jobs)".
2. Hardcoded like:1. tag filter will miss RHDH 2.x tags
f"?limit={limit}&onlyActiveTags=true&filter_tag_name=like:1."When RHDH 2.0 ships, --list-tags will silently return no results. A broader numeric filter or a --tag-prefix arg would future-proof this.
3. Redundant os.environ["KUBECONFIG"] assignment (nit)
Every oc call already passes --kubeconfig explicitly via oc_base. The env var set in main() is redundant — not harmful, just unnecessary process-global mutation.
4. No --json flag (consistency, non-blocking)
The lifecycle scripts in PR #25 all support --json for structured output. Adding it to --list and --list-tags would enable programmatic consumption by other skills.
The flags error out for overlay jobs rather than being silently ignored. Update the label from 'ignored for overlay jobs' to 'not supported for overlay jobs' to match the actual behavior. Assisted-by: OpenCode
The Quay API filter `like:1.` would silently return no results when RHDH 2.0 ships. Remove the server-side prefix filter since the local regex already correctly filters to valid version tags. Assisted-by: OpenCode
Every oc call already passes --kubeconfig explicitly via oc_base, so the process-global os.environ mutation is unnecessary. Assisted-by: OpenCode
Enables programmatic consumption of job listings and tag listings by other skills and scripts, consistent with the --json convention used across the repo. Assisted-by: OpenCode style: apply ruff formatting Assisted-by: OpenCode
Replace pagination-based tag fetching with a smarter approach: - With --tag-filter: single Quay request using like:<filter> (fast, precise) - Without filter: dual-prefix fallback (like:1. + like:2.) covering current and upcoming RHDH major versions This is faster than pagination (~0.5s vs ~11s) and future-proof for RHDH 2.x without hardcoding version assumptions. Update SKILL.md to instruct agents to derive --tag-filter from the selected branch (e.g. release-1.10 -> --tag-filter 1.10). Assisted-by: OpenCode fix: paginate Quay tag API to find version tags without hardcoded prefix Without the server-side like:1. filter, version tags are buried among sha/sig/att artifacts. Paginate the Quay API (up to 10 pages, stopping after 2 consecutive pages with no version tags) and filter locally with the existing regex. The limit parameter now controls how many results to display (latest N), while JSON output returns all matches. Assisted-by: OpenCode fix: warn when --tag-filter is used without --list-tags Assisted-by: OpenCode docs: don't hardcode main branch to a specific version in SKILL.md Assisted-by: OpenCode
693609c to
d461ec9
Compare
|
Thank you for the review. Good points! I addressed them. The PR is ready for a merge now |
durandom
left a comment
There was a problem hiding this comment.
All 4 suggestions addressed cleanly. The dual-prefix tag filter and --json flag are well-implemented additions. LGTM.
Summary
trigger-nightly-job.shscript from the rhdh repo to a stdlib-only Python skillredhat-developer/rhdhandredhat-developer/rhdh-plugin-export-overlaysrepos via the OpenShift CI Gangway REST APIWhat's included
SKILL.mdwith interactive workflow (list jobs, natural language selection, options, confirm, execute)trigger_nightly_job.py— Python 3.9+ stdlib-only replacement for the bash script--list: fetches configured nightly jobs from both repos, prints a table--list-tags: fetches available image tags from quay.io--job: triggers a job with optional overrides--dry-run: prints the equivalent curl command--org,--repo,--branch) but error on image/alert flags (--tag,--image-repo,--image-registry,--send-alerts), matching the step-ref YAML definitions in openshift/release