Skip to content

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

Merged
keithchong merged 7 commits into
redhat-developer:mainfrom
keithchong:8568-RolloutActions
Jul 31, 2026
Merged

feat: Add Rollout actions (#8568)#257
keithchong merged 7 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

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c4b18c50-4780-49b5-af41-e06b9a3c838e

📥 Commits

Reviewing files that changed from the base of the PR and between 74eb3f2 and 3aa59d3.

📒 Files selected for processing (1)
  • src/gitops/components/rollout/services/Rollout.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/gitops/components/rollout/services/Rollout.ts

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added rollout revision actions, including Rollback, Promote, Abort, Retry, and Restart.
    • Enhanced rollout and revision views with scaling-down countdowns, duration formatting, status messaging, action controls, and error alerts.
  • Bug Fixes

    • Improved handling of missing rollout status and unavailable rollback actions.
    • Added clearer feedback for action failures.
  • Style

    • Added separators to action menus and refined paused-status icon color.
  • Documentation

    • Expanded translations for rollout actions, statuses, errors, and interface labels.

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 rollout actions backed by Kubernetes patches, route-specific providers, revision alerts, 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.scss
Adds scale-down deadline data, duration formatting, periodic ticker updates, runtime packages, and revision table styling.
Revision table actions and alerts
src/gitops/components/rollout/revisions/Revisions.tsx, src/gitops/components/rollout/components/RevisionAlertGroup/*, src/gitops/components/rollout/RolloutRevisionsTab.tsx, src/gitops/utils/components/Icons/Icons.tsx
Adds revision controls, status displays, countdowns, error alerts, and revised 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 updates localized rollout 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 identifies the main change: adding Rollout actions.
Description check ✅ Passed The description links the pull request to the related GITOPS-8568 issue.
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.04082% with 192 lines in your changes missing coverage. Please review.
✅ Project coverage is 11.61%. Comparing base (01e9db1) to head (3aa59d3).
⚠️ Report is 28 commits behind head on main.

Files with missing lines Patch % Lines
.../gitops/components/rollout/revisions/Revisions.tsx 0.00% 45 Missing ⚠️
src/gitops/utils/utils.tsx 3.44% 28 Missing ⚠️
...llout/hooks/useRolloutRevisionsActionsProvider.tsx 0.00% 23 Missing ⚠️
...mponents/RevisionAlertGroup/RevisionAlertGroup.tsx 0.00% 21 Missing ⚠️
src/gitops/components/rollout/services/Rollout.ts 0.00% 18 Missing ⚠️
src/gitops/components/shared/Ticker/Ticker.tsx 0.00% 17 Missing ⚠️
...out/hooks/useRolloutRevisionsRSActionsProvider.tsx 0.00% 14 Missing ⚠️
src/gitops/components/rollout/RolloutNavPage.tsx 0.00% 8 Missing ⚠️
src/gitops/components/rollout/RolloutList.tsx 0.00% 7 Missing ⚠️
src/gitops/components/rollout/RolloutStatus.tsx 0.00% 5 Missing ⚠️
... and 4 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #257      +/-   ##
==========================================
- Coverage   11.92%   11.61%   -0.32%     
==========================================
  Files         154      161       +7     
  Lines        6272     6502     +230     
  Branches     2028     2221     +193     
==========================================
+ Hits          748      755       +7     
- Misses       5524     5747     +223     
Flag Coverage Δ
unit-tests 11.61% <2.04%> (-0.32%) ⬇️

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 Outdated
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

Comment thread src/gitops/components/rollout/revisions/Revisions.tsx
Comment thread package.json Outdated
Comment thread src/gitops/components/rollout/revisions/Revisions.tsx Outdated
Signed-off-by: Keith Chong <kykchong@redhat.com>

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/gitops/components/rollout/hooks/useRolloutRevisionsActionsProvider.tsx (1)

33-36: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Propagate revision-action failures to a user-visible error handler.

RolloutNavPage.tsx calls useRolloutRevisionsActionsProvider(rollout) without onError. The catch handlers then consume patch errors through onError?.(...), so header actions can fail silently. Pass an error reporter from RolloutNavPage.tsx or rethrow when no reporter exists.

🤖 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/hooks/useRolloutRevisionsActionsProvider.tsx`
around lines 33 - 36, Update the revision-action error handling between
useRolloutRevisionsActionsProvider and RolloutNavPage so failures from
promoteRollout and the other action catch handlers always reach a user-visible
reporter. Prefer passing RolloutNavPage’s existing error handler into
useRolloutRevisionsActionsProvider; otherwise rethrow errors when onError is
absent instead of silently consuming them.
🧹 Nitpick comments (1)
src/gitops/components/rollout/revisions/Revisions.tsx (1)

399-471: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Add tests for the new revision action states and failures.

Cover Promote, Full Promote, Abort, Retry, and Restart. Test both disabled-state conditions and rejected patch requests. The supplied Codecov report shows very low patch coverage and should be refreshed against the current base branch.

🤖 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 399 -
471, Add or update tests covering the Promote, Full Promote, Abort, Retry, and
Restart actions in the Revisions component. Verify each action’s disabled-state
behavior, including the phase and deployment conditions, and assert that
rejected action requests invoke onRevisionError with the appropriate action
label. Refresh the Codecov report against the current base branch.
🤖 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 `@package.json`:
- Line 137: Add a trailing newline after the final closing brace in package.json
so the file satisfies Prettier formatting and lint checks.

---

Outside diff comments:
In `@src/gitops/components/rollout/hooks/useRolloutRevisionsActionsProvider.tsx`:
- Around line 33-36: Update the revision-action error handling between
useRolloutRevisionsActionsProvider and RolloutNavPage so failures from
promoteRollout and the other action catch handlers always reach a user-visible
reporter. Prefer passing RolloutNavPage’s existing error handler into
useRolloutRevisionsActionsProvider; otherwise rethrow errors when onError is
absent instead of silently consuming them.

---

Nitpick comments:
In `@src/gitops/components/rollout/revisions/Revisions.tsx`:
- Around line 399-471: Add or update tests covering the Promote, Full Promote,
Abort, Retry, and Restart actions in the Revisions component. Verify each
action’s disabled-state behavior, including the phase and deployment conditions,
and assert that rejected action requests invoke onRevisionError with the
appropriate action label. Refresh the Codecov report against the current base
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: e7f487c7-b2bc-4787-bbee-e8204d75b480

📥 Commits

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

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (9)
  • 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/RolloutList.tsx
  • src/gitops/components/rollout/RolloutNavPage.tsx
  • src/gitops/components/rollout/hooks/useRolloutRevisionsActionsProvider.tsx
  • src/gitops/components/rollout/revisions/Revisions.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/gitops/components/rollout/RolloutNavPage.tsx

Comment thread package.json Outdated
Signed-off-by: Keith Chong <kykchong@redhat.com>
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.

LGTM!

@keithchong
keithchong merged commit d8f8848 into redhat-developer:main Jul 31, 2026
5 checks passed
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