Skip to content

feat(skills): add rhdh-must-gather-helm-bump skill and script - #86

Closed
nickboldt wants to merge 14 commits into
mainfrom
feat/RHIDP-16046-must-gather-helm-bump
Closed

nickboldt wants to merge 14 commits into
mainfrom
feat/RHIDP-16046-must-gather-helm-bump

Conversation

@nickboldt

@nickboldt nickboldt commented Aug 12, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds the rhdh-must-gather-helm-bump skill (skills/ci/) and bundled scripts/bump-must-gather-helm.py to propagate a Helm CLI version bump across:

Repo What the skill changes
redhat-developer/rhdh-must-gather Makefile HELM_VERSION, CGW artifacts.lock.yaml or vendor/helm/, Stage 2a/2b on Containerfile and .rhdh/docker/Containerfile
gitlab.cee.redhat.com/rhidp/rhdh Mirror helm-related files into distgit/containers/rhdh-must-gather/; regenerate the hermetic distgit Containerfile; patch must-gather Tekton prefetch; write sync/upstream_SHA_rhdh-must-gather

This is the Helm CLI in the must-gather image, not the RHDH Helm chart (oci://quay.io/rhdh/chart). The script does not commit, push, or open a PR/MR.

Catalog: registered under skills/ci/ in catalog.json, marketplace, and /ask-rhdh routes.

https://redhat.atlassian.net/browse/RHIDP-16046

What the script does

Preview (ungated): --check probes CGW and prints helm_version= / mode=cgw|vendor. --dry-run prints the planned writes without touching trees. Approval to preview is not approval to apply.

Apply (after /mutation-gate; upstream and distgit/Tekton as separate operations):

  1. Choose install path by probing upstream hack/check-helm-binary-available.sh (same probe for --check and apply, including --skip-upstream):
    • CGW (preferred): hack/update-helm-lockfile.sh → Konflux generic prefetch on distgit root → Stage 2a active
    • Vendor fallback: hack/update-vendor.sh helm → gomod prefetch on vendor/helm → Stage 2b active
  2. Flip Stage 2a/2b bidirectionally (doc-only comments stay commented) on upstream Containerfile, .rhdh/docker/Containerfile, and the regenerated distgit Containerfile.
  3. Sync into distgit: Makefile, artifacts.lock.yaml, entire hack/, .rhdh/docker/Containerfile, entire vendor/ (on CGW, omit/delete vendor/helm; keep websocat etc.). Does not copy upstream root Containerfile onto hermetic distgit.
  4. Regenerate distgit Containerfile from .rhdh/docker/Containerfile, preserving RHDH_MUST_GATHER_VERSION and the Brew/Konflux ENV SUMMARY= / LABEL footer. Increments release="N" → N+1 and the konflux.additional-tags version-release suffix with a numeric boundary (2.0-1 → 2.0-2, 2.0-10 → 2.0-11 not 2.0-20).
  5. Patch Tekton prefetch for must-gather only: .tekton/rhdh-must-gather-2-{pull,push}.yaml and must-gather.prefetch_input in .tekton-templates/components.yaml (generic vs gomod). Other components.yaml entries are left untouched.
  6. Write sync/upstream_SHA_rhdh-must-gather from a committed upstream HEAD. Refuses to pin a dirty HEAD (--allow-dirty still does not write a SHA from uncommitted work).

--skip-upstream syncs distgit + Tekton + SHA only. --skip-downstream bumps upstream only.

Discovery and guards

  • --parent-dir finds must-gather (1-must-gather, …) and midstream (4-rhdh, rhdh-downstream, rhidp-rhdh) only when the candidate has distgit/containers/rhdh-must-gather (skips a GitHub rhdh clone).
  • Requires hack/check-helm-binary-available.sh on upstream; missing bash / rsync is a hard error.
  • git status failures (fatal: not a git repository, etc.) die instead of looking clean.
  • Requires Python 3.9+, bash, curl, git, rsync.

Agent workflow (in SKILL.md)

  1. Confirm --to against Helm releases.
  2. Resolve checkouts.
  3. --check + --dry-run (preview).
  4. Apply only after /mutation-gate.
  5. Review git diff + references/verification.md (unit tests, Konflux, E2E triage including Helm 4 OCI stdout).
  6. Commit / PR or MR only when asked, again through /mutation-gate (Jira via /rhdh-jira-link).

References: install-paths (CGW vs vendor, tarball layout), tekton-prefetch, verification, helm4-notes.

Related upstream work: rhdh-must-gather#284 (CGW binary), rhdh-must-gather#282 (vendored fallback).

Tests

tests/unit/test_must_gather_helm_bump.py (invoked via sys.executable):

  • Real --to bump off the 4.2.3 fixture (lockfile/vendor stubs update HELM_VERSION)
  • CGW sync omits vendor/helm, keeps websocat, scopes prefetch to must-gather, updates pull and push PLRs
  • Vendor mode flips 2a→2b; a second case flips 2b back to 2a
  • --dry-run writes nothing
  • release="10" / 2.0-10 → 11 / 2.0-11
  • Failed git status, dirty-HEAD SHA refusal, rhdh-downstream discovery, missing CGW probe script
  • --skip-upstream --check still reports mode=cgw when upstream CGW is available (stale distgit vendor/helm does not win)

Test plan

  • uv run pytest tests/unit/test_must_gather_helm_bump.py
  • uv run pytest tests/unit/test_skill_catalog.py
  • --check / --dry-run smoke test against local must-gather + midstream checkouts

Generated-by: cursor

nickboldt and others added 2 commits August 12, 2026 10:02
Automate Helm CLI version bumps across rhdh-must-gather upstream and
rhidp/rhdh distgit, including Konflux .tekton prefetch (CGW generic vs
vendored gomod). Covers the multi-repo workflow introduced for RHIDP-16046.

https://redhat.atlassian.net/browse/RHIDP-16046

Generated-by: cursor
Co-authored-by: Cursor <cursoragent@cursor.com>
Restructure SKILL.md with verification gates, success criteria, and
E2E triage pointers from rhdh-must-gather#284. Add references for Helm 4
OCI stdout, Konflux/E2E verification, and CGW flat tarball layout.

Script now updates sync/upstream_SHA_rhdh-must-gather and removes stale
distgit vendor/helm on the CGW path.

https://redhat.atlassian.net/browse/RHIDP-16046

Generated-by: cursor
Co-authored-by: Cursor <cursoragent@cursor.com>
nickboldt and others added 8 commits August 13, 2026 18:01
Reflect merged upstream checksum verify (verify-helm-tarball.sh),
TARGETPLATFORM arch field-2 notes, and midstream !697 lesson: sync
hack/ into distgit and stop excluding it in upstream_repos.yml so
Stage 2a COPY does not break after bot sync.

https://redhat.atlassian.net/browse/RHIDP-16046

Generated-by: cursor
Co-authored-by: Cursor <cursoragent@cursor.com>
Midstream main already keeps hack/ in sync; the bump skill only needs to
copy verify-helm-tarball.sh and document #284 hardening (checksum verify,
TARGETPLATFORM field-2, E2E pipefail). Remove ensure_hack_not_excluded
and related docs/tests.

https://redhat.atlassian.net/browse/RHIDP-16046

Generated-by: cursor
Co-authored-by: Cursor <cursoragent@cursor.com>
Scope components.yaml prefetch to must-gather only, stop copying
upstream root Containerfile onto hermetic distgit, regenerate distgit
Containerfile from .rhdh/docker (preserving VERSION/MIDSTREAM_REPO),
flip Stage 2a/2b bidirectionally, sync whole hack/ and vendor/ (omit
helm on CGW), and tighten script guards plus skill prose.

https://redhat.atlassian.net/browse/RHIDP-16046

Generated-by: cursor
Co-authored-by: Cursor <cursoragent@cursor.com>
Resolve README conflict with main's catalog-first layout, move
rhdh-must-gather-helm-bump under skills/ci/, register it in
catalog.json / marketplace / ask-rhdh routes, and satisfy catalog
Completion + name-only composition rules.

https://redhat.atlassian.net/browse/RHIDP-16046

Generated-by: cursor
Co-authored-by: Cursor <cursoragent@cursor.com>
CI lint job failed on `ruff format --check` for the new unit test file.

https://redhat.atlassian.net/browse/RHIDP-16046

Generated-by: cursor
Co-authored-by: Cursor <cursoragent@cursor.com>
Regenerating from .rhdh/docker/Containerfile was dropping the Brew/Konflux
ENV SUMMARY/LABEL block that sync-midstream appends. Keep that footer, and
stop flipping upstream Containerfiles on --skip-upstream.

https://redhat.atlassian.net/browse/RHIDP-16046

Generated-by: cursor
Co-authored-by: Cursor <cursoragent@cursor.com>
When regenerating distgit Containerfile from .rhdh/docker, increment
LABEL release and the matching konflux.additional-tags version-release
suffix (e.g. 2.0-1 → 2.0-2), mirroring sync-midstream.sh.

https://redhat.atlassian.net/browse/RHIDP-16046

Generated-by: cursor
Co-authored-by: Cursor <cursoragent@cursor.com>
Match the rhdh-skill convention of Python bundled scripts so the Helm
bump workflow is easier to test and maintain than the previous bash
implementation, while preserving CGW/vendor sync and Tekton prefetch
behavior.

https://redhat.atlassian.net/browse/RHIDP-16046

Generated-by: cursor
Co-authored-by: Cursor <cursoragent@cursor.com>

@Fortune-Ndlovu Fortune-Ndlovu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@schultzp2020 schultzp2020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The CGW vs vendor split, and editing only must-gather's prefetch, are the right idea. I'd tighten the apply path before this runs against rhidp/rhdh. --check and --skip-upstream can pick different modes, 2.0-10 becomes 2.0-20, and a failed git status looks clean. Tests don't hit those cases. On Windows the new file fails on shebang exec (WinError 193) before rsync is involved.

Comments below are the hunks I'd change. While you're there: don't write upstream_SHA from a dirty HEAD; require hack/check-helm-binary-available.sh and turn a missing bash/rsync into die(); run tests via sys.executable and actually bump --to off the 4.2.3 fixture (the lockfile stubs are no-ops); cover --dry-run, push.yaml, and 2b back to 2a. Same skills/ci/... path is in the script docstring. PR body still names bump-must-gather-helm.sh.

nickboldt and others added 2 commits August 14, 2026 19:15
Address review on the apply path: probe upstream for CGW vs vendor on
apply, fail git status errors, numeric-boundary release tags, discover
rhdh-downstream, gate writes behind /mutation-gate, and run tests via
sys.executable with a real --to bump.

https://redhat.atlassian.net/browse/RHIDP-16046

Generated-by: cursor
Co-authored-by: Cursor <cursoragent@cursor.com>
@nickboldt
nickboldt dismissed schultzp2020’s stale review August 24, 2026 12:17

addressed concerns

@nickboldt
nickboldt requested a review from schultzp2020 August 24, 2026 12:17

@schultzp2020 schultzp2020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks. I would wait to merge until you fix the two apply-path comments.

Die on dirty upstream HEAD before distgit/SHA writes, treat probe exit 1
as vendor and any other code as fatal, and document --skip-downstream
then --skip-upstream as the apply path.

https://redhat.atlassian.net/browse/RHIDP-16046

Generated-by: cursor
Co-authored-by: Cursor <cursoragent@cursor.com>

Piping `helm template … | kubectl apply` fails validation (`apiVersion not set, kind not set`) unless those status lines are stripped. Upstream E2E uses `helm_template_yaml()` in `tests/e2e/lib/test-utils.sh`.

Must-gather **collection** scripts do not pipe template output to kubectl today. If a future collector adds that pattern, filter pull lines or use `--output-dir` + `kubectl apply -f`.

@rm3l rm3l Aug 25, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this will ever happen. The must-gather collection scripts never create resources in the cluster, but only collect data. So seeing a kubectl apply in any of the collectors would be a red flag.
Right now, kubectl apply -f is indeed run as part of the E2E setup phase to deploy the necessary resources.

@nickboldt
nickboldt dismissed schultzp2020’s stale review September 1, 2026 18:13

Thanks. I would wait to merge until you fix the two apply-path comments.

Fixed, please have another look?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This skill may not be needed anymore. With the rewrite of the must-gather in Golang (RHIDP-16540), it no longer depends on the Helm binary directly, but instead consumes the Helm Go SDK.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

so we don't have to update any of these files with every new RHDH .y or .z update?

https://github.com/redhat-developer/rhdh-skills/pull/86/changes#diff-6899cb90b4882e4bbbaef3325a0e53d616bd6a59426376acecf5a079b63c6fb0R15-R23

Repo Path What changes
redhat-developer/rhdh-must-gather repo root Makefile HELM_VERSION, artifacts.lock.yaml or vendor/helm/, Stage 2a/2b, hack scripts
gitlab.cee.redhat.com/rhidp/rhdh distgit/containers/rhdh-must-gather/ Mirror helm-related files; regenerate hermetic Containerfile from .rhdh/docker/Containerfile
Same (midstream) .tekton/rhdh-must-gather-2-{pull,push}.yaml prefetch-input (generic vs gomod)
Same .tekton-templates/components.yaml must-gather.prefetch_input only
Same sync/upstream_SHA_rhdh-must-gather Upstream commit SHA after sync

@rm3l rm3l Sep 23, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Correct. That was indeed part of the simplification we wanted to achieve with the full rewrite to Go.

@nickboldt nickboldt closed this Sep 23, 2026
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.

4 participants