OCM-24478 | chore: add historical changelog automation#3245
OCM-24478 | chore: add historical changelog automation#3245olucasfreitas wants to merge 1 commit into
Conversation
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.
📝 WalkthroughWalkthroughThis pull request adds a complete changelog generation and publishing infrastructure for ROSA. It introduces a 🚥 Pre-merge checks | ✅ 10 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (10 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
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
📒 Files selected for processing (7)
CHANGELOG.mdCONTRIBUTING.mdMakefilecliff.tomlhack/README.mdhack/changelog-generate.shhack/changelog-pr.sh
| 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 |
There was a problem hiding this comment.
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.
| 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.
| fi | ||
| "${SCRIPT_DIR}/changelog-generate.sh" "${generate_args[@]}" | ||
|
|
||
| if git -C "${REPO_ROOT}" diff --quiet -- "CHANGELOG.md"; then |
There was a problem hiding this comment.
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.
| 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.
| ```shell | ||
| ./hack/changelog-generate.sh --bootstrap | ||
| ``` |
There was a problem hiding this comment.
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.
PR Summary
Add git-cliff configuration, repository helpers, and a seeded
CHANGELOG.mdso 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.mdin 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 tomaster.Related Issues and PRs
N/AType of Change
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.mdgenerated 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
openshift/releasePR is applied when validating the full Prow flow.Test Steps
./hack/changelog-generate.sh --tag v1.2.63 --previous-tag v1.2.62 --output "$(mktemp)"../hack/changelog-generate.sh --bootstrap.cliff.toml,CHANGELOG.md,hack/changelog-generate.sh, andhack/changelog-pr.sh.make test,make lint, andmake rosa.Expected Results
CHANGELOG.mdfrom stable tags only.Proof of the Fix
./hack/changelog-generate.sh --tag v1.2.63 --previous-tag v1.2.62,make test,make lint,make rosaBreaking Changes
Breaking Change Details / Migration Plan
N/A
Developer Verification Checklist
[JIRA-TICKET] | [TYPE]: <MESSAGE>.make install-hookshas been run in this clone.make testpasses.make lintpasses.make rosapasses.Summary by CodeRabbit
Documentation
Chores