Skip to content

introduce reconcile#326

Merged
maorfr merged 3 commits intomainfrom
reconcile
May 6, 2026
Merged

introduce reconcile#326
maorfr merged 3 commits intomainfrom
reconcile

Conversation

@maorfr
Copy link
Copy Markdown
Collaborator

@maorfr maorfr commented May 4, 2026

related to #294

this PR introduces (enclave-)reconcile, a python cli to reconcile components of enclave (and/or provisioned by encalve) from their current state to a desired state, as part of an upgrade flow.

Summary by CodeRabbit

  • New Features

    • Introduced a new command-line interface for operator reconciliation operations.
  • Refactor

    • Updated operator install plan approval workflow to use the new CLI interface.
  • Chores

    • Added new Python dependency for command-line tooling.
    • Updated build configuration to exclude Python bytecode files.

@github-actions github-actions Bot added infrastructure Infrastructure setup (VMs, networks) operators Operator installation/config labels May 4, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

Walkthrough

This PR introduces a Click-based command-line interface for the reconcile module, decoupling operator reconciliation logic from direct script invocation. The operator-versions command is created as a CLI entry point, the core function is renamed to match the new pattern, and all callers are updated to use the new CLI interface.

Changes

CLI Infrastructure and Caller Updates

Layer / File(s) Summary
Dependencies
ansible_pip_requirements.txt, .gitignore
Added click==8.3.3 dependency; added *.pyc to gitignore.
Core Refactoring
reconcile/operator_versions.py
Renamed main() function to reconcile() and updated module entrypoint to call reconcile().
CLI Implementation
reconcile/cli.py
New Click-based CLI with top-level cli group, operator-versions command (delegating to operator_versions_reconcile()), and mgmt-cluster-version stub command.
Caller Integration
operators/openshift-pipelines-operator-rh/operator_update_pipeline.yaml, playbooks/tasks/configure_operator.yaml
Updated Tekton Task and Ansible playbook task to invoke the new reconcile/cli.py operator-versions command instead of direct script calls.

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

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.
Title check ❓ Inconclusive The title 'introduce reconcile' is vague and generic, using non-descriptive language that doesn't convey meaningful information about what is being introduced or changed. Use a more descriptive title that explains what 'reconcile' is and what it does, such as 'Add reconcile CLI for operator version reconciliation' or similar.
✅ Passed checks (3 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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 reconcile

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.

Copy link
Copy Markdown

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

🧹 Nitpick comments (1)
reconcile/cli.py (1)

1-4: ⚡ Quick win

Make the CLI import work in both execution modes.

Line 4's absolute import only resolves when cli.py is run as a loose script from the reconcile/ directory. If this is meant to be an installed/package entry point, it will fail to import its sibling module.

♻️ Suggested import fallback
-import click
-import sys
-
-from operator_versions import reconcile as operator_versions_reconcile
+import click
+import sys
+
+try:
+    from .operator_versions import reconcile as operator_versions_reconcile
+except ImportError:
+    from operator_versions import reconcile as operator_versions_reconcile
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@reconcile/cli.py` around lines 1 - 4, The import of operator_versions is
absolute and only works when cli.py is run as a loose script; change it to try a
relative import first and fall back to the absolute import so the entry point
works both as a package and as a script. Update the import block in
reconcile/cli.py to attempt "from .operator_versions import reconcile as
operator_versions_reconcile" and on ImportError fall back to "from
operator_versions import reconcile as operator_versions_reconcile", keeping the
symbol operator_versions_reconcile unchanged so the rest of the file (e.g., any
calls to operator_versions_reconcile) continues to work.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@reconcile/cli.py`:
- Around line 13-19: The CLI default for --operators is a dict literal ("{}")
which causes reconcile.operator_versions.init_ns_op_version_map() to crash when
it expects a list; change the click option default in operator_versions
(function operator_versions) from "{}" to "[]" so sys.argv =
["operator_versions.py", operators, dry_run] provides a list literal string that
operator_versions_reconcile() and init_ns_op_version_map() can ast.literal_eval
into a list; ensure any tests or callers expecting "{}" are updated accordingly.
- Around line 22-24: The mgmt_cluster_version command currently raises
NotImplementedError and will print a traceback; either remove or hide the
command until implemented or change the failure to a clean Click error: replace
the `@cli.command`() decorator usage or add hidden=True to it (e.g.,
`@cli.command`(hidden=True)) to hide the command, or keep the command but replace
raise NotImplementedError("mgmt-cluster-version") with raising a Click exception
(e.g., raise click.ClickException("mgmt-cluster-version is not implemented")) so
users receive a clean CLI error; update the mgmt_cluster_version function
accordingly and ensure click is imported if using ClickException.

---

Nitpick comments:
In `@reconcile/cli.py`:
- Around line 1-4: The import of operator_versions is absolute and only works
when cli.py is run as a loose script; change it to try a relative import first
and fall back to the absolute import so the entry point works both as a package
and as a script. Update the import block in reconcile/cli.py to attempt "from
.operator_versions import reconcile as operator_versions_reconcile" and on
ImportError fall back to "from operator_versions import reconcile as
operator_versions_reconcile", keeping the symbol operator_versions_reconcile
unchanged so the rest of the file (e.g., any calls to
operator_versions_reconcile) continues to work.
🪄 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

Run ID: b193ccde-9145-44f3-9728-f0e0d126c356

📥 Commits

Reviewing files that changed from the base of the PR and between c98cc9a and a038b6e.

📒 Files selected for processing (6)
  • .gitignore
  • ansible_pip_requirements.txt
  • operators/openshift-pipelines-operator-rh/operator_update_pipeline.yaml
  • playbooks/tasks/configure_operator.yaml
  • reconcile/cli.py
  • reconcile/operator_versions.py

Comment thread reconcile/cli.py Outdated
Comment thread reconcile/cli.py Outdated
@rh-ecosystem-edge rh-ecosystem-edge deleted a comment from github-actions Bot May 4, 2026
@rh-ecosystem-edge rh-ecosystem-edge deleted a comment from github-actions Bot May 4, 2026
@rh-ecosystem-edge rh-ecosystem-edge deleted a comment from github-actions Bot May 4, 2026
Comment thread reconcile/cli.py Outdated
Comment thread reconcile/cli.py

@cli.command()
def mgmt_cluster_version():
raise click.ClickException("mgmt-cluster-version is not implemented yet")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Happy to implement this once this is merged.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yes! ref: #123

@rporres
Copy link
Copy Markdown
Contributor

rporres commented May 4, 2026

nice! ❤️

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

Tarball created: quay.io/edge-infrastructure/enclave:4630adebff047f60a8a0a7b213fff1c922cd3f48 (4630ade)

Copy link
Copy Markdown
Contributor

@rporres rporres left a comment

Choose a reason for hiding this comment

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

At some point we will need to add dependency scaffolding to our python stack (thinking about pyproject bits and such), but we can plan that further on the road

@maorfr maorfr merged commit 1f49674 into main May 6, 2026
27 of 30 checks passed
@maorfr maorfr deleted the reconcile branch May 6, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure Infrastructure setup (VMs, networks) operators Operator installation/config

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants