Skip to content

WIP: ROX-35081: Add weekly ACS instance report CronJob#2752

Closed
kovayur wants to merge 1 commit into
mainfrom
yury/ROX-35081-instance-report-cronjob
Closed

WIP: ROX-35081: Add weekly ACS instance report CronJob#2752
kovayur wants to merge 1 commit into
mainfrom
yury/ROX-35081-instance-report-cronjob

Conversation

@kovayur

@kovayur kovayur commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

PR summary

Adds a weekly ACS instance report CronJob to ACS Fleet Manager.


The following was generated by @coderabbitai and may be updated automatically.

Summary

Adds a centrals report admin command that generates Slack-formatted ACS instance reports, including new, evaluation, expired, and failed instances. The command is exposed through fleet-manager, uses authenticated client context, and includes expanded organisation metadata.

Adds a weekly Tekton CronJob that runs the report and sends the output to Slack, with repository checkout, retention, authentication, and failure-safe notifications configured.

Checklist (Definition of Done)

  • Unit and integration tests added
  • Documentation added if necessary (i.e. changes to dev setup, test execution, ...)
  • CI and all relevant tests are passing
  • Discussed security and business related topics privately
  • Add secret to app-interface Vault or Secrets Manager if necessary

Test manual

  1. Run the admin report command with valid authentication and verify the Slack-formatted sections and tables.
  2. Run the report against centrals covering new, evaluation, expired, and failed statuses.
  3. Trigger the Tekton PipelineRun and verify repository checkout, report generation, and Slack notification delivery.

@openshift-ci

openshift-ci Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kovayur

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

@kovayur kovayur deployed to development July 10, 2026 10:54 — with GitHub Actions Active
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds an authenticated centrals report command, central organisation fields, CLI registration changes, and a scheduled Tekton pipeline that builds the command and sends its report to Slack.

Changes

ACS instance reporting

Layer / File(s) Summary
Central data contract and presentation
internal/central/pkg/api/admin/private/..., internal/central/pkg/presenters/admin_central.go, openapi/fleet-manager-private-admin.yaml
Adds organisation_name to Central schemas and maps organisation and quota fields into admin Central responses.
Admin authentication and client context
internal/central/pkg/cmd/admin/..., internal/central/pkg/cmd/fleetmanagerclient/client.go
Initializes authenticated fleet-manager clients, stores them in command context, and updates central commands to retrieve them there.
Central report generation and formatting
internal/central/pkg/cmd/admin/centrals/report.go, internal/central/pkg/cmd/admin/centrals/report_test.go
Adds paginated retrieval, status filtering, central categorisation, Slack-formatted sections, row formatters, and unit tests.
CLI exposure and scheduled execution
cmd/fleet-manager/main.go, cmd/acsfleetctl/main.go, .tekton/acs-instance-report-cron.yaml
Registers the admin command in fleet-manager, removes it from acsfleetctl, and schedules report execution with Slack notification.

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

Sequence Diagram(s)

sequenceDiagram
  participant ACSReportPipeline
  participant GitClone
  participant FleetManager
  participant SlackNotification
  ACSReportPipeline->>GitClone: clone main branch
  ACSReportPipeline->>FleetManager: build and run admin central report
  FleetManager-->>ACSReportPipeline: return report message and exit code
  ACSReportPipeline->>SlackNotification: send report message
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 21.62% 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
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.
Title check ✅ Passed The title matches the main change: adding a weekly ACS instance report job.
Description check ✅ Passed The description matches the template, which explicitly allows leaving it empty.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch yury/ROX-35081-instance-report-cronjob

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.

@kovayur kovayur requested a review from kurlov July 10, 2026 10:55
@kovayur kovayur changed the title ROX-35081: Add weekly ACS instance report CronJob WIP: ROX-35081: Add weekly ACS instance report CronJob Jul 10, 2026

@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

🧹 Nitpick comments (1)
.tekton/acs-instance-report-cron.yaml (1)

123-129: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Build step memory limit may be too low for a full Go build.

make fleet-manager compiles a large Go module; a 512Mi memory limit can trigger OOM kills during compilation/linking, causing intermittent cron failures. Consider raising the memory limit (e.g., 1–2Gi) and validating against a real run.

🤖 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 @.tekton/acs-instance-report-cron.yaml around lines 123 - 129, Increase the
build step memory limit in the computeResources block used by make fleet-manager
from 512Mi to an appropriate value such as 1Gi–2Gi, while retaining the existing
request unless needed; validate the cron job with a real full Go build to
confirm it no longer encounters OOM failures.
🤖 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 @.tekton/acs-instance-report-cron.yaml:
- Line 121: Update the printf command in the pipeline report step to use a
format that interprets escaped newline sequences, such as %b, so the separators
in MESSAGE and PIPELINE_LINK render as actual blank lines rather than literal \n
text.

---

Nitpick comments:
In @.tekton/acs-instance-report-cron.yaml:
- Around line 123-129: Increase the build step memory limit in the
computeResources block used by make fleet-manager from 512Mi to an appropriate
value such as 1Gi–2Gi, while retaining the existing request unless needed;
validate the cron job with a real full Go build to confirm it no longer
encounters OOM failures.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 93654d42-0add-49d7-bc07-f89f1b7147bd

📥 Commits

Reviewing files that changed from the base of the PR and between 6367cc1 and 42d24cc.

📒 Files selected for processing (13)
  • .tekton/acs-instance-report-cron.yaml
  • cmd/acsfleetctl/main.go
  • cmd/fleet-manager/main.go
  • internal/central/pkg/api/admin/private/api/openapi.yaml
  • internal/central/pkg/api/admin/private/model_central.go
  • internal/central/pkg/cmd/admin/centrals/cmd.go
  • internal/central/pkg/cmd/admin/centrals/list.go
  • internal/central/pkg/cmd/admin/centrals/report.go
  • internal/central/pkg/cmd/admin/centrals/report_test.go
  • internal/central/pkg/cmd/admin/cmd.go
  • internal/central/pkg/cmd/fleetmanagerclient/client.go
  • internal/central/pkg/presenters/admin_central.go
  • openapi/fleet-manager-private-admin.yaml
💤 Files with no reviewable changes (1)
  • cmd/acsfleetctl/main.go

fi

PIPELINE_LINK="<${PIPELINE_RUN_URL}|${PIPELINE_RUN_NAME}>"
printf '%s' "${MESSAGE}\n\nPipeline run: ${PIPELINE_LINK}" > $(results.message.path)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

printf '%s' will not expand \n; Slack message will contain literal \n.

With %s, the \n\n between the message and pipeline link (and the \n\n embedded in the build-failure MESSAGE) are emitted as literal backslash-n rather than newlines. Use %b (or actual newlines) so the separators render correctly.

🔧 Proposed fix
-            printf '%s' "${MESSAGE}\n\nPipeline run: ${PIPELINE_LINK}" > $(results.message.path)
+            printf '%b' "${MESSAGE}\n\nPipeline run: ${PIPELINE_LINK}" > $(results.message.path)
📝 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
printf '%s' "${MESSAGE}\n\nPipeline run: ${PIPELINE_LINK}" > $(results.message.path)
printf '%b' "${MESSAGE}\n\nPipeline run: ${PIPELINE_LINK}" > $(results.message.path)
🤖 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 @.tekton/acs-instance-report-cron.yaml at line 121, Update the printf command
in the pipeline report step to use a format that interprets escaped newline
sequences, such as %b, so the separators in MESSAGE and PIPELINE_LINK render as
actual blank lines rather than literal \n text.

@kovayur kovayur closed this Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant