Skip to content

feat: add prow-trigger-nightly skill#26

Merged
durandom merged 8 commits into
redhat-developer:mainfrom
zdrapela:prow-trigger-nightly
May 26, 2026
Merged

feat: add prow-trigger-nightly skill#26
durandom merged 8 commits into
redhat-developer:mainfrom
zdrapela:prow-trigger-nightly

Conversation

@zdrapela
Copy link
Copy Markdown
Member

Summary

  • Ports the trigger-nightly-job.sh script from the rhdh repo to a stdlib-only Python skill
  • Adds support for triggering nightly jobs from both redhat-developer/rhdh and redhat-developer/rhdh-plugin-export-overlays repos via the OpenShift CI Gangway REST API
  • Since this now covers both repositories, it makes sense to extract the skill here rather than keeping it in the rhdh repo alone

What's included

  • SKILL.md with 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
  • Flag validation per repo: overlay jobs accept fork overrides (--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

zdrapela added 3 commits May 14, 2026 15:25
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
@zdrapela zdrapela marked this pull request as ready for review May 14, 2026 13:51
Copy link
Copy Markdown
Member

@durandom durandom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

zdrapela added 5 commits May 20, 2026 14:05
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
@zdrapela zdrapela force-pushed the prow-trigger-nightly branch from 693609c to d461ec9 Compare May 20, 2026 13:24
@zdrapela
Copy link
Copy Markdown
Member Author

Thank you for the review. Good points! I addressed them. The PR is ready for a merge now

Copy link
Copy Markdown
Member

@durandom durandom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All 4 suggestions addressed cleanly. The dual-prefix tag filter and --json flag are well-implemented additions. LGTM.

@durandom durandom merged commit bcb5d52 into redhat-developer:main May 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants