Skip to content

OSPRH-33339: Add rebasebot post-rebase hook script - #428

Open
dlaw4608 wants to merge 1 commit into
openshift:mainfrom
shiftstack:rebasebot-hook-script
Open

OSPRH-33339: Add rebasebot post-rebase hook script#428
dlaw4608 wants to merge 1 commit into
openshift:mainfrom
shiftstack:rebasebot-hook-script

Conversation

@dlaw4608

@dlaw4608 dlaw4608 commented Jul 29, 2026

Copy link
Copy Markdown

Adds hack/rebasebot-helpers/post-rebase.sh, a post-rebase hook script for ShiftStacks migration from merge-bot to rebasebot.

This replaces the merge-bot --run-make flag which ran make merge-bot after each rebase. The script runs make merge-bot (full-vendoring, generate, generate-openshift) and commits the results, following the pattern used by
cluster-capi-operator.

The rebasebot periodic configs in openshift/release will reference this script via:
--post-rebase-hook git:dest/main:hack/rebasebot-helpers/post-rebase.sh

The git:dest/main: prefix fetches the script from main, so all release branch jobs (4.16 through 5.1) will use it without needing the script on each branch.

Summary by CodeRabbit

  • Chores
    • Added an automated post-rebase workflow that runs required generation and vendoring steps.
    • Automatically records resulting updates with standardized commit messages.
    • Supports configuring commit author details through environment settings.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 29, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 29, 2026

Copy link
Copy Markdown

@dlaw4608: This pull request references OSPRH-33339 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the sub-task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Adds hack/rebasebot-helpers/post-rebase.sh, a post-rebase hook script for ShiftStacks migration from merge-bot to rebasebot.

This replaces the merge-bot --run-make flag which ran make merge-bot after each rebase. The script runs make merge-bot (full-vendoring, generate, generate-openshift) and commits the results, following the pattern used by
cluster-capi-operator.

The rebasebot periodic configs in openshift/release will reference this script via:
--post-rebase-hook git:dest/main:hack/rebasebot-helpers/post-rebase.sh

The git:dest/main: prefix fetches the script from main, so all release branch jobs (4.16 through 5.1) will use it without needing the script on each branch.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
openshift-ci Bot requested review from gryf and mandre July 29, 2026 13:50
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@dlaw4608, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 54 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8c12ae9f-b4c6-4637-b9a6-ad681ce12d2c

📥 Commits

Reviewing files that changed from the base of the PR and between 3bc009c and 640e5ad.

📒 Files selected for processing (1)
  • hack/rebasebot-helpers/post-rebase.sh

Walkthrough

Adds a strict Bash post-rebase hook that runs vendoring and generation targets, conditionally stages and commits changes after each target, supports optional author metadata, and invokes the workflow through main.

Changes

Rebasebot post-rebase automation

Layer / File(s) Summary
Conditional generated-change commits
hack/rebasebot-helpers/post-rebase.sh
The hook enables strict Bash failure handling and defines conditional staging and committing with optional rebasebot author metadata.
Generation target orchestration
hack/rebasebot-helpers/post-rebase.sh
main() runs the vendoring and generation targets in order, creating corresponding UPSTREAM: <drop>: commits.
Estimated code review effort: 2 (Simple) ~10 minutes
🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately describes the main change: adding a rebasebot post-rebase hook script.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 only adds a shell hook script; no Ginkgo tests or test titles were added or modified.
Test Structure And Quality ✅ Passed The PR only adds a shell post-rebase hook; no Ginkgo test files or test blocks were changed, so the test-quality check is not applicable.
Microshift Test Compatibility ✅ Passed The PR only adds a shell hook script; no Ginkgo/e2e tests or OpenShift API-using test code were introduced, so MicroShift compatibility is unaffected.
Single Node Openshift (Sno) Test Compatibility ✅ Passed Only a rebasebot shell hook changed; no new or modified Ginkgo tests to assess for SNO assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed Only a post-rebase shell hook was added; no deployment manifests, operator code, or controllers affecting scheduling were changed.
Ote Binary Stdout Contract ✅ Passed PR only adds a bash rebasebot hook; no OTE binary process-level stdout writes were introduced.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PASS: The PR only adds a shell rebasebot hook; no Ginkgo e2e tests, IP-family assumptions, or external connectivity code were introduced.
No-Weak-Crypto ✅ Passed PR only adds a bash hook script; diff shows no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, no custom crypto, and no secret comparisons.
Container-Privileges ✅ Passed Only a bash hook was added; no container/K8s manifests or privilege settings changed.
No-Sensitive-Data-In-Logs ✅ Passed The new hook script contains no echo/printf/debug logging of secrets or PII; REBASEBOT author values are only used in git commit metadata.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-ci

openshift-ci Bot commented Jul 29, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign eshulman2 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/rebasebot-helpers/post-rebase.sh`:
- Around line 19-21: Update the automated commit flow around the git status
check and first make invocation so pre-existing worktree changes cannot enter
generated commits: require a clean worktree before running the initial make, or
capture and stage only each target’s newly produced diff instead of using git
add -A. Preserve committing generated changes while excluding unrelated user or
rebase modifications.
🪄 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: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ac6322e4-9994-43ce-b88b-d04ba8b37737

📥 Commits

Reviewing files that changed from the base of the PR and between 28766d4 and 3bc009c.

📒 Files selected for processing (1)
  • hack/rebasebot-helpers/post-rebase.sh

Comment thread hack/rebasebot-helpers/post-rebase.sh Outdated
Comment on lines +19 to +21
if [[ -n $(git status --porcelain) ]]; then
git add -A
git commit "${author_flag[@]}" -q -m "$commit_message"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Prevent unrelated changes from entering generated commits.

git add -A stages the entire worktree, so any pre-existing user or rebase changes are included in the next automated commit. Require a clean worktree before the first make, or track and stage only the diff produced by each target.

Proposed guard
 main(){
+    if [[ -n "$(git status --porcelain)" ]]; then
+        echo "post-rebase hook requires a clean worktree" >&2
+        return 1
+    fi
+
     make full-vendoring
🤖 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/rebasebot-helpers/post-rebase.sh` around lines 19 - 21, Update the
automated commit flow around the git status check and first make invocation so
pre-existing worktree changes cannot enter generated commits: require a clean
worktree before running the initial make, or capture and stage only each
target’s newly produced diff instead of using git add -A. Preserve committing
generated changes while excluding unrelated user or rebase modifications.

This script is invoked by rebasebot via --post-rebase-hook to run
`make merge-bot` after a rebase, replacing the merge-bot --run-make flag.
Signed-off-by: Daniel Lawton <dlawton@redhat.com>
@dlaw4608
dlaw4608 force-pushed the rebasebot-hook-script branch from 3bc009c to 640e5ad Compare July 29, 2026 13:54
@openshift-ci

openshift-ci Bot commented Jul 29, 2026

Copy link
Copy Markdown

@dlaw4608: all tests passed!

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

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

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants