Skip to content

Conversation

@otaviof
Copy link
Collaborator

@otaviof otaviof commented Sep 25, 2025

Passing the flags, force, debug and dry-run to the MCP tool, so the installer job uses the same settings. Also, adapting the tssc_status tool to recognise a dry-run job.

Summary by CodeRabbit

  • New Features
    • Added support for --dry-run, --debug, and --force flags in the deployment tool.
    • Enforced single-deployment-per-cluster with an option to force-redeploy existing jobs.
    • Introduced pre-deployment topology validation with actionable guidance on failures.
  • Documentation
    • Updated help text to explain new flags, dry-run behavior, defaults, and monitoring options.
    • Improved error messages with clearer next steps and a logs command for troubleshooting.

Passing the flags, force, debug and dry-run to the MCP tool, so the
installer job uses the same settings. Also, adapting the `tssc_status`
tool to recognize a dry-run job.
@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Sep 25, 2025

@otaviof: This pull request references RHTAP-5637 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 story to target the "4.21.0" version, but no target version was set.

Details

In response to this:

Passing the flags, force, debug and dry-run to the MCP tool, so the installer job uses the same settings. Also, adapting the tssc_status tool to recognise a dry-run job.

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 jkopriva and rhopp September 25, 2025 13:21
@coderabbitai
Copy link

coderabbitai bot commented Sep 25, 2025

Walkthrough

The installer job logic now builds arguments dynamically, supports debug/dry-run flags, and enforces single-deployment-per-cluster with optional force deletion. A new Run method replaces Create. Deploy tool wiring parses debug/dry-run/force flags, validates topology, and calls Run, updating messages and constants accordingly.

Changes

Cohort / File(s) Summary of Changes
Installer Job control flow & args
pkg/installer/job.go
Replaced Create with Run(debug, dryRun, force, ...). Added dry-run detection in GetState. Introduced deleteJob helper. createJob now accepts debug/dryRun to construct Args dynamically (--debug, --log-level=debug, --dry-run). Implemented force-based deletion when an existing deployment is found. Simplified error/control flow.
Deploy tool flags & orchestration
pkg/mcptools/deploytools.go
Added exported constants: DeployToolName, DebugArg, DryRunArg, ForceArg. Parse debug/dryRun/force flags. Validate topology before running. Switched to Job.Run(debug, dryRun, force, ...). Updated descriptions, defaults, and user-facing messages, including guidance and log-follow command on errors.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Tool as DeployTool
  participant Validator as TopologyValidator
  participant Job as InstallerJob
  participant K8s as Kubernetes API

  User->>Tool: Invoke deploy (args: debug, dryRun, force)
  Tool->>Validator: Validate topology
  alt invalid topology
    Validator-->>Tool: Error
    Tool-->>User: Return tool error with guidance
  else valid
    Tool->>Job: Run(ctx, debug, dryRun, force, ns, image)
    Job->>K8s: GetState()
    alt Existing job is dry-run-only
      K8s-->>Job: Present (marked NotFound)
    end
    alt No existing deployment
      Job->>K8s: createJob(debug/dryRun args)
      K8s-->>Job: Created
      Job-->>Tool: OK
      Tool-->>User: Deployment started / dry-run note
    else Deployment exists
      alt force = true
        Job->>K8s: deleteJob()
        K8s-->>Job: Deleted
        Job->>K8s: createJob(debug/dryRun args)
        K8s-->>Job: Created
        Job-->>Tool: OK
        Tool-->>User: Re-deployment started (forced)
      else force = false
        Job-->>Tool: Error (already exists)
        Tool-->>User: Error with logs command
      end
    end
  end
Loading
sequenceDiagram
  autonumber
  participant Job as InstallerJob
  participant K8s as Kubernetes API

  Job->>K8s: Get existing Job spec
  K8s-->>Job: Job with containers/args
  alt Single container with --dry-run
    Note right of Job: Treat as NotFound state
  else Otherwise
    Note right of Job: Use actual state
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I twitch my ears at flags that run,
--debug, --dry-run greet the sun.
One hop per cluster, rules enforce;
with force, I chart a fresher course.
I nibble logs to see the show—
deploy, delete, then off I go! 🐇

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title concisely highlights the primary change, which is the introduction and handling of flags for the deployment tool. It directly reflects the core changeset without unnecessary detail. This phrasing allows a reviewer scanning the history to understand at a glance that this PR modifies deployment tool flags.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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 and usage tips.

@sonarqubecloud
Copy link

@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Sep 25, 2025

@otaviof: This pull request references RHTAP-5637 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 story to target the "4.21.0" version, but no target version was set.

Details

In response to this:

Passing the flags, force, debug and dry-run to the MCP tool, so the installer job uses the same settings. Also, adapting the tssc_status tool to recognise a dry-run job.

Summary by CodeRabbit

  • New Features
  • Added support for --dry-run, --debug, and --force flags in the deployment tool.
  • Enforced single-deployment-per-cluster with an option to force-redeploy existing jobs.
  • Introduced pre-deployment topology validation with actionable guidance on failures.
  • Documentation
  • Updated help text to explain new flags, dry-run behavior, defaults, and monitoring options.
  • Improved error messages with clearer next steps and a logs command for troubleshooting.

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7e56aeb and a59007a.

📒 Files selected for processing (2)
  • pkg/installer/job.go (8 hunks)
  • pkg/mcptools/deploytools.go (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
pkg/mcptools/deploytools.go (2)
pkg/constants/contants.go (1)
  • AppName (7-7)
pkg/mcptools/statustool.go (1)
  • StatusToolName (31-31)
🔇 Additional comments (1)
pkg/mcptools/deploytools.go (1)

68-86: Flag parsing reads cleanly

The boolean flag extraction cleanly defaults to false and respects any values supplied by the MCP request. Nicely done.

Copy link
Member

@dperaza4dustbit dperaza4dustbit left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci
Copy link

openshift-ci bot commented Sep 25, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dperaza4dustbit, otaviof

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 TSSC components sequentially.`,
Deploys TSSC components to the cluster, using the cluster configuration to deploy
the components sequentially. Note the "dry-run" flag: the deployment process will
only be initiated when the "dry-run" flag is set to "false". By default, this flag
Copy link
Member

Choose a reason for hiding this comment

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

I find it strange that dry-run is the default. I can't think of another tools that is setup this way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, that's true. Given the nature of platform engineering, the idea is to have the user explicitly confirm that the deployment should happen. Let's validate this idea and change it if we need to.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

/cc @lcarva

@otaviof
Copy link
Collaborator Author

otaviof commented Sep 25, 2025

/retest

@otaviof otaviof requested a review from Roming22 September 25, 2025 18:25
@openshift-merge-bot openshift-merge-bot bot merged commit bf6e820 into redhat-appstudio:main Sep 25, 2025
10 checks passed
@otaviof otaviof deleted the RHTAP-5637 branch September 25, 2025 22:12
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.

4 participants