Skip to content

OCM-24478 | chore: add historical changelog automation#3245

Open
olucasfreitas wants to merge 1 commit into
openshift:masterfrom
olucasfreitas:OCM-24478-git-cliff-changelog
Open

OCM-24478 | chore: add historical changelog automation#3245
olucasfreitas wants to merge 1 commit into
openshift:masterfrom
olucasfreitas:OCM-24478-git-cliff-changelog

Conversation

@olucasfreitas
Copy link
Copy Markdown
Contributor

@olucasfreitas olucasfreitas commented May 21, 2026

PR Summary

Add git-cliff configuration, repository helpers, and a seeded CHANGELOG.md so ROSA can generate a historical changelog after stable tags. Document the post-tag Prow flow and manual fallback commands for changelog regeneration and backfills.

Detailed Description of the Issue

ROSA does not currently keep a historical CHANGELOG.md in the repository, and the release-time changelog work needs to stay on Prow rather than being introduced as a GitHub Actions workflow. This change adds the repo-side git-cliff configuration, bootstrap changelog content, and helper scripts that a stable-tag Prow job can call to generate a changelog branch and open a reviewable PR back to master.

Related Issues and PRs

Type of Change

  • feat - adds a new user-facing capability.
  • fix - resolves an incorrect behavior or bug.
  • docs - updates documentation only.
  • style - formatting or naming changes with no logic impact.
  • refactor - code restructuring with no behavior change.
  • test - adds or updates tests only.
  • chore - maintenance work (tooling, housekeeping, non-product code).
  • build - changes build system, packaging, or dependencies for build output.
  • ci - changes CI pipelines, jobs, or automation workflows.
  • perf - improves performance without changing intended behavior.

Previous Behavior

ROSA did not have a committed historical changelog, git-cliff configuration, or repo-side scripts that could generate a changelog PR after a stable tag. Release-note grouping only existed in GoReleaser, and no Prow job was wired to maintain a repository changelog.

Behavior After This Change

ROSA now has a historical CHANGELOG.md generated by git-cliff, a repo-side changelog generation helper, and a PR helper script designed for stable-tag Prow automation. Contributors do not add changelog fragments to feature PRs; instead, stable tags trigger a reviewable historical changelog update flow.

How to Test (Step-by-Step)

Preconditions

  • Stable tags exist in the repository history.
  • The companion openshift/release PR is applied when validating the full Prow flow.

Test Steps

  1. Run ./hack/changelog-generate.sh --tag v1.2.63 --previous-tag v1.2.62 --output "$(mktemp)".
  2. Run ./hack/changelog-generate.sh --bootstrap.
  3. Review cliff.toml, CHANGELOG.md, hack/changelog-generate.sh, and hack/changelog-pr.sh.
  4. Run make test, make lint, and make rosa.

Expected Results

  • The helper can generate a single stable-tag changelog entry.
  • The bootstrap command rebuilds the historical CHANGELOG.md from stable tags only.
  • The generated changelog format stays consistent with the committed file.
  • ROSA test, lint, and build checks pass.

Proof of the Fix

  • Screenshots: N/A
  • Videos: N/A
  • Logs/CLI output: ./hack/changelog-generate.sh --tag v1.2.63 --previous-tag v1.2.62, make test, make lint, make rosa
  • Other artifacts: N/A

Breaking Changes

  • No breaking changes
  • Yes, this PR introduces a breaking change (describe impact and migration plan below)

Breaking Change Details / Migration Plan

N/A

Developer Verification Checklist

  • Commit subject/title follows [JIRA-TICKET] | [TYPE]: <MESSAGE>.
  • PR description clearly explains both what changed and why.
  • Relevant Jira/GitHub issues and related PRs are linked.
  • make install-hooks has been run in this clone.
  • Tests were added/updated where appropriate.
  • I manually tested the change.
  • make test passes.
  • make lint passes.
  • make rosa passes.
  • Documentation or repo-local agent guidance was added/updated where appropriate.
  • Any risk, limitation, or follow-up work is documented.

Summary by CodeRabbit

  • Documentation

    • Updated contributing guidelines with details on historical changelog storage, git-cliff integration, and manual generation commands.
    • Enhanced release helper documentation with new changelog generation and PR automation script descriptions.
  • Chores

    • Added changelog generation configuration and tooling to support automated release note management.

Add git-cliff configuration, repository helpers, and a seeded CHANGELOG.md so ROSA can generate a historical changelog after stable tags. Document the post-tag Prow flow and manual fallback commands for changelog regeneration and backfills.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

📝 Walkthrough

Walkthrough

This pull request adds a complete changelog generation and publishing infrastructure for ROSA. It introduces a git-cliff configuration file (cliff.toml) that defines how to format and group changelog entries, a new changelog-generate.sh script that generates historical or incremental changelog entries with automatic binary resolution and caching, and a changelog-pr.sh script that automates PR creation for changelog updates with GitHub API integration. Supporting changes include documentation in CONTRIBUTING.md and hack/README.md and three new Makefile targets (changelog-bootstrap, changelog-generate, changelog-pr) that invoke these scripts.

🚥 Pre-merge checks | ✅ 10 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Microshift Test Compatibility ⚠️ Warning New ROSA/HCP e2e tests in tests/e2e/ lack MicroShift protection ([Skipped:MicroShift] labels or [apigroup:...] tags); HCP features are unavailable on MicroShift. Add [Skipped:MicroShift] labels to HCP test names or use [apigroup:...] tags; MicroShift CI jobs auto-skip incompatible apigroup tests.
✅ Passed checks (10 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adding historical changelog automation infrastructure (git-cliff config, helpers, and seeded CHANGELOG.md) via the OCM-24478 ticket reference.
Description check ✅ Passed The PR description is comprehensive, covering the problem (no historical changelog system), why it's needed, detailed changes, testing procedures, and validation results. All major template sections are completed appropriately.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The PR contains no Ginkgo test files or test declarations. It only adds changelog infrastructure (shell scripts, config, and documentation), making this check not applicable.
Test Structure And Quality ✅ Passed PR contains no Ginkgo test code (only configuration, documentation, and shell scripts), making the test structure quality check not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No Ginkgo e2e tests added in this PR. Changes only include changelog infrastructure (bash scripts, config files, documentation).
Topology-Aware Scheduling Compatibility ✅ Passed PR adds changelog automation infrastructure only—no Kubernetes manifests, operator code, or scheduling constraints that could break on non-standard topologies.
Ote Binary Stdout Contract ✅ Passed OTE Binary Stdout Contract check is not applicable: ROSA is a CLI tool, not an OpenShift Tests Extension binary. No OTE JSON stdout contract exists for this codebase.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed This PR does not add any Ginkgo e2e tests, only changelog automation scripts, configuration, and documentation. The check applies only to new Ginkgo tests.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 21, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: olucasfreitas

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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 21, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@hack/changelog-generate.sh`:
- Around line 150-153: The commit range logic drops the repository's first
commit because using root_commit..${current_tag} excludes root_commit; update
the branch that handles i==0 so that when computing commit_range you use just
"${current_tag}" (or otherwise include root_commit by using
"${root_commit}"..="${current_tag}" if your Git supports the inclusive range)
instead of root_commit..${current_tag}; modify the code that sets root_commit
and commit_range (variables root_commit, commit_range, current_tag, and the i==0
conditional) so the first-tag path includes the initial commit in the changelog.

In `@hack/changelog-pr.sh`:
- Line 84: The diff check currently hardcodes "CHANGELOG.md" which ignores the
configurable variable CHANGELOG_FILE; update the git diff invocation in
hack/changelog-pr.sh (the if condition using git -C "${REPO_ROOT}" diff --quiet
-- "CHANGELOG.md") to reference the CHANGELOG_FILE variable instead (e.g., use
"${CHANGELOG_FILE}") so the script respects the configured changelog path and
correctly detects changes for non-default files.

In `@hack/README.md`:
- Around line 33-35: Replace the fenced triple-backtick code blocks used for the
shell examples (the snippet showing ./hack/changelog-generate.sh --bootstrap and
the two other similar examples) with the repository’s configured indented
code-block style so markdownlint MD046 is satisfied; locate the three
occurrences (the example blocks currently fenced at the shown snippets) and
convert them to indented blocks preserving the exact shell commands and spacing.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 6fd2d8a0-633d-402e-9ef8-4df5cb3c5011

📥 Commits

Reviewing files that changed from the base of the PR and between c332d23 and fd2396d.

📒 Files selected for processing (7)
  • CHANGELOG.md
  • CONTRIBUTING.md
  • Makefile
  • cliff.toml
  • hack/README.md
  • hack/changelog-generate.sh
  • hack/changelog-pr.sh

Comment on lines +150 to +153
if (( i == 0 )); then
root_commit=$(git -C "${REPO_ROOT}" rev-list --max-parents=0 "${current_tag}" | tail -1)
commit_range="${root_commit}..${current_tag}"
else
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Bootstrap range drops the repository’s first commit.

Using root_commit..${current_tag} excludes root_commit, so the first historical entry can miss the initial commit set. For the first tag, use the tag as the range input directly.

Proposed fix
-    if (( i == 0 )); then
-      root_commit=$(git -C "${REPO_ROOT}" rev-list --max-parents=0 "${current_tag}" | tail -1)
-      commit_range="${root_commit}..${current_tag}"
+    if (( i == 0 )); then
+      commit_range="${current_tag}"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (( i == 0 )); then
root_commit=$(git -C "${REPO_ROOT}" rev-list --max-parents=0 "${current_tag}" | tail -1)
commit_range="${root_commit}..${current_tag}"
else
if (( i == 0 )); then
commit_range="${current_tag}"
else
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@hack/changelog-generate.sh` around lines 150 - 153, The commit range logic
drops the repository's first commit because using root_commit..${current_tag}
excludes root_commit; update the branch that handles i==0 so that when computing
commit_range you use just "${current_tag}" (or otherwise include root_commit by
using "${root_commit}"..="${current_tag}" if your Git supports the inclusive
range) instead of root_commit..${current_tag}; modify the code that sets
root_commit and commit_range (variables root_commit, commit_range, current_tag,
and the i==0 conditional) so the first-tag path includes the initial commit in
the changelog.

Comment thread hack/changelog-pr.sh
fi
"${SCRIPT_DIR}/changelog-generate.sh" "${generate_args[@]}"

if git -C "${REPO_ROOT}" diff --quiet -- "CHANGELOG.md"; then
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use CHANGELOG_FILE in the diff check for consistency.

The script supports a configurable changelog path, but this check is hardcoded to CHANGELOG.md. That can skip PR creation when a non-default path is used.

Proposed fix
-if git -C "${REPO_ROOT}" diff --quiet -- "CHANGELOG.md"; then
+if git -C "${REPO_ROOT}" diff --quiet -- "${CHANGELOG_FILE}"; then
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if git -C "${REPO_ROOT}" diff --quiet -- "CHANGELOG.md"; then
if git -C "${REPO_ROOT}" diff --quiet -- "${CHANGELOG_FILE}"; then
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@hack/changelog-pr.sh` at line 84, The diff check currently hardcodes
"CHANGELOG.md" which ignores the configurable variable CHANGELOG_FILE; update
the git diff invocation in hack/changelog-pr.sh (the if condition using git -C
"${REPO_ROOT}" diff --quiet -- "CHANGELOG.md") to reference the CHANGELOG_FILE
variable instead (e.g., use "${CHANGELOG_FILE}") so the script respects the
configured changelog path and correctly detects changes for non-default files.

Comment thread hack/README.md
Comment on lines +33 to +35
```shell
./hack/changelog-generate.sh --bootstrap
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use the repository’s configured code-block style to avoid markdownlint failures.

These new examples use fenced blocks, but markdownlint reports MD046 expecting indented blocks for this file. Please switch these three snippets to the configured style (or align lint config if fencing is intended).

Also applies to: 39-41, 59-61

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 33-33: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@hack/README.md` around lines 33 - 35, Replace the fenced triple-backtick code
blocks used for the shell examples (the snippet showing
./hack/changelog-generate.sh --bootstrap and the two other similar examples)
with the repository’s configured indented code-block style so markdownlint MD046
is satisfied; locate the three occurrences (the example blocks currently fenced
at the shown snippets) and convert them to indented blocks preserving the exact
shell commands and spacing.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant