Skip to content

Add reusable source changelogs to MintMaker promotion PRs - #1211

Draft
flacatus wants to merge 1 commit into
redhat-appstudio:mainfrom
flacatus:codex/mintmaker-promotion-changelog
Draft

flacatus wants to merge 1 commit into
redhat-appstudio:mainfrom
flacatus:codex/mintmaker-promotion-changelog

Conversation

@flacatus

@flacatus flacatus commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

What

Add a reusable github-commit-changelog PromotionTask and enable it for MintMaker Rings 0–4. Promotion PRs show separate linked commit lists for the controller, Renovate image and schedule calculator, comparing each ring's previous image SHA tag with its selected Freight tag.

Source comparisons resolve credentials with repoCredentials() for each source repository, using Kargo-managed Git credentials such as GitHub App installation tokens.

Refresh generated descriptions when reusing an existing promotion PR, after verifying its repository, branch, base and published head. Existing callers opt in through the optional prChangelog field.

Environments affected: Kargo internal-production configuration, including MintMaker's staging Ring 1 and production rings.

Why

Promotion PRs currently show changed configuration values without the source history behind them. MintMaker has three independent source repositories; one controller comparison cannot describe all three images. Kargo's native git-open-pr also adopts an existing PR without refreshing its body.

Validation

  • All four root environment overlays and the combined Kargo projects render with Kustomize.
  • YAML lint and git diff --check pass.
  • Checked credential lookup URLs for all three MintMaker repositories and the missing-credential error path; no live credentials were read.
  • Validated Stage/PromotionTask CRDs and HTTP/compose-output schemas against Kargo v1.12.4, including task-call webhook restrictions.
  • 148 expression/template evaluations using Kargo's template evaluator: real controller (32 commits) and scheduler (20 commits) comparisons, truncation, unknown/digest baselines, unchanged SHAs, rollbacks, divergence, API failures, subject formatting, JSON serialization, and native/recovered PR refresh guards.
  • Confirmed existing signing, stable branches, publication result contracts, CI and merge gates remain unchanged.
  • This opt-in project workflow change is proposed together for Rings 0–4; no separate deployed staging validation or live promotion run was available. No external automated review was completed.

Risk Assessment

Risk Level: Medium.

Each changed valid source pair adds a bounded GitHub comparison request. Matching Git credentials and GitHub App repository access must exist for each source repository; live credential availability was not verified. Lists show at most 20 commits with full comparison links. Missing source SHAs, digest-pinned previous images, rate limits and lookup failures produce explicit unavailable notes without changing promotion eligibility. CLI version tags and the unrecorded previous shared-base source revision do not get inferred changelogs. Commit lists are not deduplicated merged-PR release notes or image provenance attestations.

Refreshing the generated PR body requires the existing shared credential's pull-request write access; a failed refresh blocks publication to avoid silently retaining a stale changelog. This replaces manual body edits. GitHub has no atomic expected-head condition for body updates; the returned head is verified, but concurrent branch updates may still require a retry. Already-merged matching PRs and no-ops are not edited.

Rollback: Revert this PR. Existing Promotions retain their expanded steps; newly created Promotions use the reconciled task configuration.

@openshift-ci

openshift-ci Bot commented Nov 10, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: flacatus

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@qodo-for-redhat-appstudio

Copy link
Copy Markdown

PR Summary by Qodo

Add source changelogs to MintMaker promotion PRs

✨ Enhancement 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Add reusable GitHub source-commit changelogs for MintMaker promotions across Rings 0–4.
• Show separate, bounded commit lists for the controller, Renovate image, and schedule calculator.
• Refresh opted-in promotion PR bodies after verifying their repository, branch, base, and published
 head.
Diagram

sequenceDiagram
    participant S as Ring stage
    participant P as Prepare task
    participant C as Changelog tasks
    participant G as GitHub API
    participant B as Publisher task
    participant R as Promotion PR
    S->>P: Prepare promotion
    P-->>S: Previous image SHAs
    S->>C: Three source ranges
    C->>G: Compare valid SHA pairs
    G-->>C: Commit histories
    C-->>S: Changelog Markdown
    S->>B: Publish with changelog
    B->>R: Open or reuse PR
    B->>G: Verify PR and head
    G-->>B: Verified target
    B->>G: Refresh open PR body
    G-->>R: Updated description
Loading
High-Level Assessment

The shared, opt-in task is appropriate for three independently versioned sources: it avoids duplicating comparison logic across rings and does not infer provenance from controller manifest refs. Reusing the existing PR publisher with a guarded refresh preserves the established signing and publication workflow; inline per-ring comparisons would add duplication without improving the source baseline.

Files changed (11) +463 / -17

Enhancement (8) +373 / -14
promotiontask.yamlExpose previous source SHA candidates from ring configuration +8/-0

Expose previous source SHA candidates from ring configuration

• Returns the previous controller, Renovate, and scheduler image tags for changelog comparisons. Suppresses each tag when a digest takes precedence, leaving non-SHA values for the changelog task to reject.

components/kargo/internal-production/projects/kargo-konflux-mintmaker/components/mintmaker/promotiontask.yaml

ring-0-stage.yamlAdd three source changelogs to Ring 0 publication +45/-0

Add three source changelogs to Ring 0 publication

• Calls the shared task for each MintMaker source repository after preparation. Passes their separate Markdown results and provenance caveats to the PR publisher.

components/kargo/internal-production/projects/kargo-konflux-mintmaker/components/mintmaker/stages/ring-0-stage.yaml

ring-1-stage.yamlAdd three source changelogs to Ring 1 publication +45/-0

Add three source changelogs to Ring 1 publication

• Compares Ring 1’s previous image tags with selected Freight tags for the controller, Renovate image, and scheduler. Includes the resulting sections in the promotion PR description.

components/kargo/internal-production/projects/kargo-konflux-mintmaker/components/mintmaker/stages/ring-1-stage.yaml

ring-2-stage.yamlAdd three source changelogs to Ring 2 publication +45/-0

Add three source changelogs to Ring 2 publication

• Invokes independent source comparisons using Ring 2’s previous tags and selected Freight tags. Forwards their Markdown and scope caveats through the optional publisher input.

components/kargo/internal-production/projects/kargo-konflux-mintmaker/components/mintmaker/stages/ring-2-stage.yaml

ring-3-stage.yamlAdd three source changelogs to Ring 3 publication +45/-0

Add three source changelogs to Ring 3 publication

• Adds controller, Renovate, and scheduler comparisons before publishing the Ring 3 PR. Keeps origin-cli and the shared base snapshot outside the inferred source-commit lists.

components/kargo/internal-production/projects/kargo-konflux-mintmaker/components/mintmaker/stages/ring-3-stage.yaml

ring-4-stage.yamlAdd three source changelogs to Ring 4 publication +45/-0

Add three source changelogs to Ring 4 publication

• Runs the shared comparison task separately for Ring 4’s three SHA-tagged images. Adds their results and baseline limitations to the publisher’s optional changelog input.

components/kargo/internal-production/projects/kargo-konflux-mintmaker/components/mintmaker/stages/ring-4-stage.yaml

github-commit-changelog.yamlIntroduce reusable GitHub commit comparison task +72/-0

Introduce reusable GitHub commit comparison task

• Validates repository and full source SHAs, requests bounded GitHub comparisons, and renders linked commit Markdown. Handles unchanged revisions, rollback or divergence, truncated ranges, and unavailable comparisons without changing promotion eligibility.

components/kargo/internal-production/shared/promotion-tasks/github-commit-changelog.yaml

publish-promotion-pr.yamlGuard and refresh opted-in promotion PR descriptions +68/-14

Guard and refresh opted-in promotion PR descriptions

• Adds optional 'prChangelog' content to a reusable generated PR body. For opted-in callers, reads back the resolved PR, checks its repository, branches, and published head, then refreshes an open PR body before publication completes.

components/kargo/internal-production/shared/promotion-tasks/publish-promotion-pr.yaml

Documentation (2) +89 / -3
README.mdDocument MintMaker promotion changelogs +30/-0

Document MintMaker promotion changelogs

• Explains the three source repositories, Git-configured comparison baselines, unavailable cases, and bounded commit lists. Documents when a reused PR body is refreshed and what the changelog does not attest.

components/kargo/internal-production/projects/kargo-konflux-mintmaker/README.md

README.mdDocument the shared changelog and PR refresh contracts +59/-3

Document the shared changelog and PR refresh contracts

• Defines task inputs, output, comparison limits, fallbacks, and a Stage usage example. Explains opt-in body refresh, its validation requirements, and concurrency limitations.

components/kargo/internal-production/shared/promotion-tasks/README.md

Other (1) +1 / -0
kustomization.yamlRegister the shared changelog task +1/-0

Register the shared changelog task

• Adds the new PromotionTask to the shared Kustomize component so projects can reference it.

components/kargo/internal-production/shared/promotion-tasks/kustomization.yaml

@qodo-for-redhat-appstudio

qodo-for-redhat-appstudio Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Code Review by Qodo


View medium (3)
Remediation recommended
1. Commit subjects with non-ASCII text are cut short 🐞 Bug ⭐ New
Description
The subject truncation slices with [0:min(160, len(subject))]. In expr-lang, the len builtin
counts runes (characters), but string slicing counts bytes. Any subject containing multi-byte
characters (em dashes, emoji, accented names) loses its last bytes − runes bytes even when it is
far shorter than 160 characters, and the cut can land inside a UTF-8 sequence, so the changelog in
the promotion PR shows clipped or garbled subjects.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The changelog subject truncation `replace(...)[0:min(160, len(replace(...)))]` mixes expr's rune-based `len` with byte-based string slicing. Non-ASCII subjects therefore lose trailing bytes and can be cut mid-character.

## Fix Focus Areas
- components/kargo/internal-production/shared/promotion-tasks/github-commit-changelog.yaml[70-71]

## Recommended Fix
Do not bound the slice with `len()`. expr's `Slice` already clamps the end index to the byte length, so use `replace(replace(#.subject, '`', "'"), '\r', ' ')[0:160]`. If you need a character-accurate cap, append an ellipsis only when `len(subject) > 160` and accept byte-level truncation, or truncate in the http step output with a rune-safe approach. Also add a test case with a subject that contains an em dash or emoji.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

2. Promotion PR refreshes can fail at GitHub 🐞 Bug
Description
refresh-description sends a JSON body through *github-headers, which supplies Authorization
and Accept but no Content-Type. When an existing MintMaker promotion PR is reused, GitHub can
reject the PATCH instead of updating its generated changelog.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR-body PATCH sends JSON without declaring its request content type, so GitHub can reject the refresh.
## Fix Focus Areas
- components/kargo/internal-production/shared/promotion-tasks/publish-promotion-pr.yaml[183-188]
## Recommended Fix
Add `Content-Type: application/json` to the PATCH request headers, retaining the existing authorization and accept headers. Keep the body serialized with `quote()`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

3. A transient GitHub error fails the whole promotion 🐞 Bug
Description
In read-description-target and refresh-description, failureExpression: response.status != 200
treats every non-200 response as a terminal Failed status. That covers 5xx, 429 and rate-limit 403
responses, and retry.errorThreshold never retries a Failed step. Because MintMaker always sends a
non-empty prChangelog, one short GitHub hiccup after the branch has been force-pushed now fails
every Ring 0–4 promotion. The PR is left with its old body, and CI and merge never start.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new read-description-target and refresh-description http steps mark any non-200 response (5xx, 429, rate-limit 403) as Failed. A Failed step is never retried, so one transient GitHub error blocks publication.

## Fix Focus Areas
- components/kargo/internal-production/shared/promotion-tasks/publish-promotion-pr.yaml[163-170]
- components/kargo/internal-production/shared/promotion-tasks/publish-promotion-pr.yaml[189-193]

## Recommended Fix
Use the same failureExpression shape as `find-pr`: `response.status in [401, 404, 422] || (response.status == 403 && response.header('X-RateLimit-Remaining') != '0' && response.header('Retry-After') == '' && !(lower(response.body?.message ?? '') contains 'rate limit'))`. For the PATCH step, also keep the head-SHA mismatch check. Add a `pollInterval` so transient errors are polled within the step's retry timeout.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


View low (1)
Informational
4. Freshly created PRs are patched for no reason 🐞 Bug
Description
The read-description-target and refresh-description steps also run when git-open-pr has just
created a new PR whose body is already the generated description. Each new promotion PR therefore
costs two extra PAT-backed requests, and the PATCH adds a failure point that can block publication.
It never checks whether the body already matches before writing.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR body is refreshed even when it already matches the generated description, as with a newly created PR.

## Fix Focus Areas
- components/kargo/internal-production/shared/promotion-tasks/publish-promotion-pr.yaml[171-178]

## Recommended Fix
Add a `current` output to read-description-target: `response.body.body == ${{ quote(task.outputs['description'].body) }}`. Gate refresh-description on `!task.outputs['read-description-target'].current`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


Compare independent image source revisions and refresh generated PR bodies
when reusing the stable promotion branch.

Assisted-by: OpenAI Codex
Signed-off-by: flacatus <flacatus@redhat.com>
@openshift-ci

openshift-ci Bot commented Nov 22, 2026

Copy link
Copy Markdown

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant