Skip to content

feat: Add Rollout actions (#8568) - #257

Open
keithchong wants to merge 3 commits into
redhat-developer:mainfrom
keithchong:8568-RolloutActions
Open

feat: Add Rollout actions (#8568)#257
keithchong wants to merge 3 commits into
redhat-developer:mainfrom
keithchong:8568-RolloutActions

Conversation

@keithchong

Copy link
Copy Markdown
Collaborator

Signed-off-by: Keith Chong <kykchong@redhat.com>
@openshift-ci
openshift-ci Bot requested a review from wtam2018 July 30, 2026 18:29
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

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

Next review available in: 49 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 582c3c6c-4a8e-4784-bbed-a307db7a9d2a

📥 Commits

Reviewing files that changed from the base of the PR and between 523b6fc and 13c5e64.

📒 Files selected for processing (4)
  • src/gitops/components/rollout/RolloutList.tsx
  • src/gitops/components/rollout/RolloutNavPage.tsx
  • src/gitops/components/rollout/hooks/useRolloutRevisionsActionsProvider.tsx
  • src/gitops/components/rollout/revisions/Revisions.tsx
📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added rollout revision actions, including Rollback and refined enablement for Promote/Abort/Retry/Restart.
    • Enhanced rollout and revision UI with clearer status/error messaging, scaling-down countdown text, and human-readable duration formatting.
  • Bug Fixes

    • Improved rollout status display when status is missing (with a translated fallback) and refined degraded/tooltip behavior.
    • Updated revision-action toast errors to show message with additional details when available.
  • Style

    • Improved action menus with proper separators/dividers, refined paused-status icon color, and adjusted rollout revisions page/table layout.

Walkthrough

Changes

Rollout revisions workflow

Layer / File(s) Summary
Rollout actions and patch services
src/gitops/components/rollout/services/Rollout.ts, src/gitops/components/rollout/hooks/*, src/gitops/components/rollout/RolloutNavPage.tsx, src/gitops/utils/components/ActionDropDown/ActionDropDown.tsx
Adds promote, abort, retry, restart, and rollback actions backed by Kubernetes patches, route-specific providers, and dropdown separators.
Revision timing and display data
src/gitops/components/rollout/revisions/ReplicaSetInfo.ts, src/gitops/components/shared/Ticker/Ticker.tsx, src/gitops/utils/utils.tsx, package.json, src/gitops/components/rollout/revisions/Revisions.tsx
Adds scale-down deadline data, duration formatting, periodic ticker updates, runtime packages, and revision display support.
Revision table actions and alerts
src/gitops/components/rollout/revisions/Revisions.tsx, src/gitops/components/rollout/revisions/Revisions.scss, src/gitops/components/rollout/RolloutRevisionsTab.tsx, src/gitops/utils/components/Icons/Icons.tsx
Adds table and toolbar actions, rollback controls, error details, countdown labels, styling changes, and revised revision-page presentation.
Rollout status fallback and localization
src/gitops/components/rollout/RolloutStatus.tsx, src/gitops/components/rollout/RolloutList.tsx, src/gitops/components/rollout/RolloutDetailsTab.tsx, locales/*/plugin__gitops-plugin.json
Displays translated guidance when rollout status is absent and makes phase-label rendering configurable across updated locale entries.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Revisions
  participant ActionProvider
  participant RolloutService
  participant Kubernetes
  participant AlertGroup
  User->>Revisions: Select rollout or revision action
  Revisions->>ActionProvider: Build enabled action
  ActionProvider->>RolloutService: Invoke rollout patch helper
  RolloutService->>Kubernetes: Submit JSON-Patch
  Kubernetes-->>RolloutService: Return patched rollout
  RolloutService-->>Revisions: Resolve or report error
  Revisions->>AlertGroup: Display action error
Loading

Suggested reviewers: wtam2018

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

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.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: adding Rollout actions to the GitOps console plugin.
Description check ✅ Passed The description references the linked GITOPS-8568 issue, which is related to the rollout actions changes.
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.

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.

@codecov-commenter

codecov-commenter commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 2.19780% with 178 lines in your changes missing coverage. Please review.
✅ Project coverage is 11.63%. Comparing base (01e9db1) to head (13c5e64).
⚠️ Report is 28 commits behind head on main.

Files with missing lines Patch % Lines
.../gitops/components/rollout/revisions/Revisions.tsx 0.00% 54 Missing ⚠️
src/gitops/utils/utils.tsx 3.44% 24 Missing and 4 partials ⚠️
...llout/hooks/useRolloutRevisionsActionsProvider.tsx 0.00% 23 Missing ⚠️
src/gitops/components/rollout/services/Rollout.ts 0.00% 17 Missing and 1 partial ⚠️
src/gitops/components/shared/Ticker/Ticker.tsx 0.00% 14 Missing and 3 partials ⚠️
...out/hooks/useRolloutRevisionsRSActionsProvider.tsx 0.00% 14 Missing ⚠️
src/gitops/components/rollout/RolloutList.tsx 0.00% 7 Missing ⚠️
src/gitops/components/rollout/RolloutNavPage.tsx 0.00% 6 Missing ⚠️
src/gitops/components/rollout/RolloutStatus.tsx 0.00% 5 Missing ⚠️
...rc/gitops/components/rollout/RolloutDetailsTab.tsx 0.00% 3 Missing ⚠️
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #257      +/-   ##
==========================================
- Coverage   11.92%   11.63%   -0.29%     
==========================================
  Files         154      160       +6     
  Lines        6272     6488     +216     
  Branches     2028     2221     +193     
==========================================
+ Hits          748      755       +7     
+ Misses       5524     5502      -22     
- Partials        0      231     +231     
Flag Coverage Δ
unit-tests 11.63% <2.19%> (-0.29%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@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: 9

🧹 Nitpick comments (2)
src/gitops/components/rollout/RolloutStatus.tsx (1)

15-25: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

status is now used as optional; update the type.

The component explicitly handles status === undefined (line 51) and callers pass obj.status?.phase as RolloutStatus, casting away undefined. Making status optional avoids relying on as casts to bypass the type checker.

🩹 Proposed fix
 interface RolloutStatusProps {
-  status: RolloutStatus;
+  status?: RolloutStatus;
   message?: string;
   showPhaseLabel?: boolean;
 }
🤖 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 `@src/gitops/components/rollout/RolloutStatus.tsx` around lines 15 - 25, Update
RolloutStatusProps so status is optional, matching RolloutStatusFragment’s
existing handling of an undefined status and allowing callers to pass optional
phase values without casts. Preserve the current rendering behavior for defined
statuses and the status === undefined branch.
src/gitops/components/rollout/revisions/Revisions.tsx (1)

394-470: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Toolbar buttons duplicate the dropdown action logic and skip RBAC gating.

Promote/FullPromote/Abort/Retry/Restart here re-implement the same isDisabled conditions and service calls already defined in useRolloutRevisionsActionsProvider (used for RolloutActionsCell right above). Two risks: (1) the two implementations can drift over time, and (2) unlike the dropdown's ActionDropdownItem (which enforces accessReview via useAccessReview), these buttons have no permission-based disabling, so users without patch rights see enabled buttons that always fail server-side.

Consider driving these buttons off the same useRolloutRevisionsActionsProvider(rollout, onRevisionError) actions array (mapping id → button) to keep behavior and RBAC gating in one place.

🤖 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 `@src/gitops/components/rollout/revisions/Revisions.tsx` around lines 394 -
470, Update the toolbar in Revisions to use the action definitions returned by
useRolloutRevisionsActionsProvider(rollout, onRevisionError) instead of
duplicating promoteRollout, abortRollout, retryRollout, and restartRollout
handlers and disabled conditions. Map each action by its id to the corresponding
button, preserving labels and button layout while deriving disabled state and
invocation from the shared actions so accessReview/RBAC gating remains
consistent with RolloutActionsCell.
🤖 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 `@src/gitops/components/rollout/hooks/useRolloutRevisionsActionsProvider.tsx`:
- Around line 64-68: Update the separator item in
useRolloutRevisionsActionsProvider so its cta handler returns undefined without
using an empty function, preserving the separator’s existing behavior while
satisfying the no-empty-function lint rule.

In
`@src/gitops/components/rollout/hooks/useRolloutRevisionsRSActionsProvider.tsx`:
- Around line 26-45: Update the Rollback action in the
useRolloutRevisionsRSActionsProvider hook to disable it when
replicaSet.replicaSet is missing, in addition to the existing index === 0
condition. Preserve rollbackRollout invocation for valid ReplicaSet entries and
keep the current error handling unchanged.

In `@src/gitops/components/rollout/revisions/ReplicaSetInfo.ts`:
- Line 188: Update the replicaSetScaleDownDeadline access in getReplicaSetInfo
to safely handle missing metadata.annotations by applying optional chaining to
annotations before reading the scale-down-deadline key, while preserving the
existing value when annotations are present.

In `@src/gitops/components/rollout/revisions/Revisions.scss`:
- Around line 1-6: Add the required blank line before the first declaration in
the .gitops-revisions-table tbody > tr:first-child rule to satisfy Stylelint’s
declaration-empty-line-before rule.

In `@src/gitops/components/rollout/revisions/Revisions.tsx`:
- Around line 159-166: Update onRevisionError to keep the user-facing
RevisionAlert.message concise and move error.stack into RevisionAlert.details
instead of exposing raw traces in the toast. Ensure the alert presentation
renders details only through its existing expandable/details mechanism,
preserving stack visibility for users who explicitly expand it.

In `@src/gitops/components/rollout/RolloutNavPage.tsx`:
- Around line 39-40: Update the revision actions provider call in RolloutNavPage
to pass the existing revision alert mechanism as its onError callback. Ensure
failures consumed by useRolloutRevisionsActionsProvider are surfaced to users
while preserving the current action setup.
- Around line 38-41: Update RolloutNavPage’s action selection to use the
pathname returned by useLocation(), then invoke both
useRolloutRevisionsActionsProvider and useRolloutActionsProvider unconditionally
and select the appropriate returned array based on the revisions-route check.
Preserve the existing route-sensitive action behavior while keeping hook calls
in a stable order.

In `@src/gitops/components/rollout/services/Rollout.ts`:
- Around line 42-45: Update the JSON Patch operations for the optional restartAt
and pauseConditions fields in Rollout to use `add` instead of `replace`, so
patches succeed whether the target members are absent or already present.

In `@src/gitops/utils/utils.tsx`:
- Around line 213-254: Update formatDuration to use inclusive day, hour, and
minute thresholds so exact multiples render in their largest applicable unit
(for example, 3600 seconds as hours). Adjust the sigfigs truncation path to join
selected segments without appending a trailing space, while preserving existing
rounding and formatting behavior.

---

Nitpick comments:
In `@src/gitops/components/rollout/revisions/Revisions.tsx`:
- Around line 394-470: Update the toolbar in Revisions to use the action
definitions returned by useRolloutRevisionsActionsProvider(rollout,
onRevisionError) instead of duplicating promoteRollout, abortRollout,
retryRollout, and restartRollout handlers and disabled conditions. Map each
action by its id to the corresponding button, preserving labels and button
layout while deriving disabled state and invocation from the shared actions so
accessReview/RBAC gating remains consistent with RolloutActionsCell.

In `@src/gitops/components/rollout/RolloutStatus.tsx`:
- Around line 15-25: Update RolloutStatusProps so status is optional, matching
RolloutStatusFragment’s existing handling of an undefined status and allowing
callers to pass optional phase values without casts. Preserve the current
rendering behavior for defined statuses and the status === undefined branch.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c07b52cf-0502-4a89-88f5-1c0c70ae5fad

📥 Commits

Reviewing files that changed from the base of the PR and between e36ff57 and 6eba5a1.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (21)
  • locales/en/plugin__gitops-plugin.json
  • locales/ja/plugin__gitops-plugin.json
  • locales/ko/plugin__gitops-plugin.json
  • locales/zh/plugin__gitops-plugin.json
  • package.json
  • src/gitops/components/rollout/RolloutDetailsTab.tsx
  • src/gitops/components/rollout/RolloutList.tsx
  • src/gitops/components/rollout/RolloutNavPage.tsx
  • src/gitops/components/rollout/RolloutRevisionsTab.tsx
  • src/gitops/components/rollout/RolloutStatus.tsx
  • src/gitops/components/rollout/hooks/useRolloutActionsProvider.tsx
  • src/gitops/components/rollout/hooks/useRolloutRevisionsActionsProvider.tsx
  • src/gitops/components/rollout/hooks/useRolloutRevisionsRSActionsProvider.tsx
  • src/gitops/components/rollout/revisions/ReplicaSetInfo.ts
  • src/gitops/components/rollout/revisions/Revisions.scss
  • src/gitops/components/rollout/revisions/Revisions.tsx
  • src/gitops/components/rollout/services/Rollout.ts
  • src/gitops/components/shared/Ticker/Ticker.tsx
  • src/gitops/utils/components/ActionDropDown/ActionDropDown.tsx
  • src/gitops/utils/components/Icons/Icons.tsx
  • src/gitops/utils/utils.tsx
💤 Files with no reviewable changes (1)
  • src/gitops/components/rollout/hooks/useRolloutActionsProvider.tsx

Comment thread src/gitops/components/rollout/revisions/ReplicaSetInfo.ts Outdated
Comment thread src/gitops/components/rollout/revisions/Revisions.scss
Comment thread src/gitops/components/rollout/revisions/Revisions.tsx
Comment thread src/gitops/components/rollout/RolloutNavPage.tsx Outdated
Comment thread src/gitops/components/rollout/RolloutNavPage.tsx Outdated
Comment thread src/gitops/components/rollout/services/Rollout.ts
Comment thread src/gitops/utils/utils.tsx
@shmecam

shmecam commented Jul 30, 2026 via email

Copy link
Copy Markdown

Signed-off-by: Keith Chong <kykchong@redhat.com>
Signed-off-by: Keith Chong <kykchong@redhat.com>

@aali309 aali309 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 @keithchong , left a few comments

readyCount++;
}
});
podsChildren.push({

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.

Align (current 5 cells) with parent (6 rows actions column). May be we add an empty 6th cell so the tree table stays aligned?

Comment thread package.json
"git-url-parse": "^13.1.0",
"lodash": "^4.18.1",
"moment": "^2.29.4",
"pnpm": "^11.18.0",

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.

"pnpm": "^11.18.0" conflicts with packageManager: pnpm@10.33.2 and breaks pnpm run start under Corepack. Do we want to remove from deps?

promoteRollout(rollout, true).catch((err: unknown) => {
onRevisionError(
err instanceof Error ? err : String(err),
t('FullPromote'),

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.

nit: Use t('Full Promote') instead of t('FullPromote') to match the button label / locale key.

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