Skip to content

ROX-35081: Add weekly ACS instance report pipeline - #2752

Open
kovayur wants to merge 2 commits into
yury/ROX-35081-instance-reportfrom
yury/ROX-35081-instance-report-cronjob
Open

ROX-35081: Add weekly ACS instance report pipeline#2752
kovayur wants to merge 2 commits into
yury/ROX-35081-instance-reportfrom
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 pipeline to ACS Fleet Manager.

Comments summary

  • The author requested Konflux and standard retests.
  • The author requested two full CodeRabbit reviews; both finished.
  • A subsequent CodeRabbit review was triggered, with a note that already reviewed commits would not be re-reviewed.

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

Summary

Adds a Tekton pipeline that runs the weekly ACS Fleet Manager instance report.

The pipeline:

  • Runs fleet-manager admin central report with RHSSO authentication.
  • Captures report output and command errors.
  • Limits the Slack message size.
  • Adds a Konflux pipeline-run link.
  • Sends the result to Slack through the acs-instance-report webhook.
  • Sends the Slack notification even when report generation fails.

Checklist (Definition of Done)

  • 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. Start the acs-instance-report pipeline with valid Fleet Manager, Konflux, RHSSO, and Slack configuration.
  2. Confirm that the pipeline generates the ACS instance report.
  3. Confirm that the Slack message includes the report and Konflux pipeline-run link.
  4. Run the pipeline with an invalid report command or authentication configuration.
  5. Confirm that the pipeline posts the error output to Slack and preserves the report command exit code.
  6. Confirm that long output is truncated within the configured message limit.

@coderabbitai

coderabbitai Bot commented Jul 10, 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 53a84122-85e4-47cb-ab78-aa44cec3e656

📥 Commits

Reviewing files that changed from the base of the PR and between da1249f and 9198404.

📒 Files selected for processing (1)
  • .tekton/acs-instance-report-pipeline.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .tekton/acs-instance-report-pipeline.yaml

📝 Walkthrough

Walkthrough

Adds the acs-instance-report Tekton pipeline. It runs the authenticated fleet-manager central report, formats and truncates the output, stores it as a task result, and sends it to Slack through an always-run notification step.

Changes

ACS instance reporting

Layer / File(s) Summary
Pipeline and task wiring
.tekton/acs-instance-report-pipeline.yaml
Adds pipeline parameters, an embedded generate-report task, RHSSO and Fleet Manager environment variables, and Konflux pipeline-run metadata.
Central report generation and formatting
.tekton/acs-instance-report-pipeline.yaml
Runs fleet-manager admin central report, captures its output and exit code, formats success or error messages, appends the pipeline link, truncates oversized output, and writes results.message.
Scheduled Slack delivery
.tekton/acs-instance-report-pipeline.yaml
Adds an always-run Slack notification step that uses the generated message and the acs-instance-report webhook secret.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Pipeline
  participant GenerateReport
  participant FleetManager
  participant SlackNotification
  Pipeline->>GenerateReport: pass image and pipeline-run metadata
  GenerateReport->>FleetManager: run authenticated central report
  FleetManager-->>GenerateReport: return output and exit code
  GenerateReport->>SlackNotification: send results.message
Loading

Suggested reviewers: ebensh, kurlov

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 21.05% 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 addition of the weekly ACS instance report pipeline and includes the relevant issue identifier.
Description check ✅ Passed The description is empty, but the repository template explicitly permits an empty description and the PR objective is clear from the available context.
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.
✨ Finishing Touches
🧪 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

Comment thread .tekton/acs-instance-report-cron.yaml Outdated

@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 @.tekton/acs-instance-report-pipeline.yaml:
- Around line 103-107: Replace the error-message assignment in the report
formatting logic with printf -v so \n becomes actual newlines while preserving
EXIT_CODE and REPORT values; also update the truncation-note assignment at
.tekton/acs-instance-report-pipeline.yaml lines 114-119 to use printf -v and
produce real line breaks.
🪄 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: 7902d30f-3a11-468e-b2c2-e8eeec7925a6

📥 Commits

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

📒 Files selected for processing (1)
  • .tekton/acs-instance-report-pipeline.yaml

Comment thread .tekton/acs-instance-report-pipeline.yaml
@kovayur

kovayur commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

/konflux-retest

@kovayur kovayur changed the title WIP: ROX-35081: Add weekly ACS instance report CronJob ROX-35081: Add weekly ACS instance report CronJob Jul 16, 2026
@kovayur

kovayur commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@kovayur
kovayur requested a review from ebensh July 17, 2026 08:38

@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.

🧹 Nitpick comments (1)
cmd/fleet-manager/main.go (1)

52-63: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Prevent duplicate error messages on CLI misuse.

By default, Cobra prints command execution errors (such as unknown flags or invalid commands) to stderr before returning them. Because run() wraps and returns this error, and main() prints it again, the user will see the error twice.

Consider configuring the root command with SilenceErrors: true (where rootCmd is defined) to suppress Cobra's automatic error printing, leaving the printing entirely to main().

🤖 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 `@cmd/fleet-manager/main.go` around lines 52 - 63, Configure the Cobra root
command at its definition with SilenceErrors enabled so command execution
failures are not printed automatically. Keep run() returning the wrapped Execute
error and let main() remain the sole place that prints CLI errors.
🤖 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.

Nitpick comments:
In `@cmd/fleet-manager/main.go`:
- Around line 52-63: Configure the Cobra root command at its definition with
SilenceErrors enabled so command execution failures are not printed
automatically. Keep run() returning the wrapped Execute error and let main()
remain the sole place that prints CLI errors.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: e8bfdae9-43f5-4912-9ff1-c9f33b689bba

📥 Commits

Reviewing files that changed from the base of the PR and between c6428fb and 5deae7c.

📒 Files selected for processing (4)
  • .tekton/acs-instance-report-pipeline.yaml
  • cmd/fleet-manager/main.go
  • internal/central/pkg/cmd/admin/cmd.go
  • internal/central/pkg/cmd/fleetmanagerclient/client.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • internal/central/pkg/cmd/fleetmanagerclient/client.go
  • .tekton/acs-instance-report-pipeline.yaml

@kovayur kovayur changed the title ROX-35081: Add weekly ACS instance report CronJob ROX-35081: Add weekly ACS instance report pipeline Jul 17, 2026
@kovayur

kovayur commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.


Your plan includes PR reviews subject to rate limits. More reviews will be available in 45 seconds.

@kovayur

kovayur commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

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

🤖 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-pipeline.yaml:
- Around line 38-41: Update the fleet-manager-image parameter default in the
pipeline to reference an immutable image digest instead of the mutable :latest
tag. Preserve the existing registry image repository and ensure the digest
identifies the reviewed fleet-manager image.
- Around line 109-118: The truncation logic around MESSAGE, SUFFIX, and CUT must
enforce MAX_BYTES using UTF-8 byte lengths rather than character counts or
offsets. Replace ${`#MESSAGE`}, ${`#SUFFIX`}, and character-based substring
truncation with UTF-8-safe byte-aware truncation, while preserving complete
valid characters and ensuring the final message including SUFFIX never exceeds
MAX_BYTES.

In `@internal/central/pkg/cmd/admin/centrals/report.go`:
- Around line 103-107: Update the region classification around the c.Region
check to include Canadian regions such as ca-central-1 alongside us- regions,
while preserving the existing seven-day CreatedAt filtering and naInstances
append behavior.
- Around line 62-71: Update the pagination loop in the centrals-fetching
function around api.GetCentrals so it detects when list.Items is empty and
terminates instead of requesting further pages. Preserve the existing
total-count termination and fetch error behavior, using an appropriate error
return or break for the empty-page case.

In `@internal/central/pkg/cmd/admin/cmd.go`:
- Around line 34-38: Replace the panic-based impl.OptionFromEnv() call in the
command’s auth initialization with an error-returning environment parser, and
propagate its error through the Cobra command instead of allowing a panic.
Preserve the existing “creating auth” stderr message and exit behavior for
returned errors, while ensuring malformed environment configuration reaches that
handler without a stack trace.
🪄 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: 255db1f4-8de6-4ae0-9548-270fb42b017e

📥 Commits

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

📒 Files selected for processing (13)
  • .tekton/acs-instance-report-pipeline.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

Comment on lines +38 to +41
- name: fleet-manager-image
type: string
description: Pre-built fleet-manager container image reference
default: "quay.io/redhat-services-prod/acscs-rhacs-tenant/acscs-main/acs-fleet-manager:latest"

@coderabbitai coderabbitai Bot Jul 17, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Pin the credential-bearing workload image by digest.

The default :latest tag is mutable, and this image receives the RHSSO client secret. Pin an immutable digest so registry tag movement cannot execute unreviewed code with these credentials.

🤖 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-pipeline.yaml around lines 38 - 41, Update the
fleet-manager-image parameter default in the pipeline to reference an immutable
image digest instead of the mutable :latest tag. Preserve the existing registry
image repository and ensure the digest identifies the reviewed fleet-manager
image.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To achieve this, I need the binary changes to be merged first. Therefore, I have split the PR into two parts: this one and #2764.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@kovayur, understood. The digest cannot identify the new binary until PR #2764 produces the reviewed image.

The finding remains valid for this pipeline. Please pin fleet-manager-image to the resulting immutable digest in PR #2764.

You are interacting with an AI system.

Comment thread .tekton/acs-instance-report-pipeline.yaml Outdated
Comment thread internal/central/pkg/cmd/admin/centrals/report.go
Comment on lines +103 to +107
if strings.HasPrefix(c.Region, "us-") {
if !c.CreatedAt.Before(sevenDaysAgo) {
naInstances = append(naInstances, *c)
}
}

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

Include Canadian regions in North America.

The us- check excludes regions such as ca-central-1, so Canadian instances are missing from the North America section.

-		if strings.HasPrefix(c.Region, "us-") {
+		if strings.HasPrefix(c.Region, "us-") || strings.HasPrefix(c.Region, "ca-") {
📝 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
if strings.HasPrefix(c.Region, "us-") {
if !c.CreatedAt.Before(sevenDaysAgo) {
naInstances = append(naInstances, *c)
}
}
if strings.HasPrefix(c.Region, "us-") || strings.HasPrefix(c.Region, "ca-") {
🤖 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 `@internal/central/pkg/cmd/admin/centrals/report.go` around lines 103 - 107,
Update the region classification around the c.Region check to include Canadian
regions such as ca-central-1 alongside us- regions, while preserving the
existing seven-day CreatedAt filtering and naInstances append behavior.

Comment on lines +34 to +38
auth, err := impl.NewAuth(ctx, authType, impl.OptionFromEnv())
if err != nil {
_, _ = fmt.Fprintf(os.Stderr, "creating auth: %v\n", err)
os.Exit(1)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Return environment parsing errors instead of panicking.

impl.OptionFromEnv() uses utils.Must, so malformed environment configuration panics before this error handler and can still print a stack trace. Introduce an error-returning environment parser and propagate that error through Cobra.

🤖 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 `@internal/central/pkg/cmd/admin/cmd.go` around lines 34 - 38, Replace the
panic-based impl.OptionFromEnv() call in the command’s auth initialization with
an error-returning environment parser, and propagate its error through the Cobra
command instead of allowing a panic. Preserve the existing “creating auth”
stderr message and exit behavior for returned errors, while ensuring malformed
environment configuration reaches that handler without a stack trace.

@kovayur
kovayur changed the base branch from main to yury/ROX-35081-instance-report August 7, 2026 14:57
Add a Tekton pipeline that runs `fleet-manager admin central report`
and posts the result to Slack via webhook. Triggered by a CronJob
in konflux-release-data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kovayur
kovayur force-pushed the yury/ROX-35081-instance-report-cronjob branch from da1249f to f847edd Compare August 7, 2026 15:03
@openshift-ci

openshift-ci Bot commented Aug 7, 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

The Tekton result size limit is byte-based, but the script was using
${#VAR} and ${VAR:0:N} which count characters. With multi-byte UTF-8
content (e.g. organisation names), the result could exceed the limit.
Switch to wc -c and head -c for byte-accurate enforcement.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kovayur

kovayur commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant