Skip to content

Conversation

@Xia-Zhao-rh
Copy link
Contributor

What this PR does / why we need it:

This PR introduces a new operator-catalog plugin that provides comprehensive tooling for building and managing operator catalog index images using OPM (Operator Package Manager) and Podman.

Key Features:

Building Catalogs

  1. generate-semver-template - Generate semver template configuration files from bundle lists

    • Supports configurable major/minor channel generation
    • Accepts comma-separated bundle image lists
    • Outputs properly formatted YAML templates
  2. build-semver-index - Build catalog index from semver templates

    • Renders semver templates into catalog structures
    • Validates catalog configuration
    • Builds multi-architecture images (amd64, arm64, ppc64le, s390x)
    • Supports cacheless builds for production use
  3. build-index - Build catalog index from existing catalog directories

    • Works directly with pre-existing catalog structures
    • Supports both single and multi-architecture builds
    • Flexible architecture selection (multi, amd64, arm64, ppc64le, s390x)
    • Cacheless mode support

Querying Catalogs

  1. list-packages - List all packages in a catalog

    • Supports both image references and local directories
    • Shows package names and default channels
  2. list-channels - List channels for packages

    • Optional package filtering
    • Displays channel names and HEAD versions
    • Works with images and local catalog directories
  3. list-bundles - List bundles with detailed information

    • Optional package filtering
    • Shows upgrade graph (replaces/skips)
    • Displays bundle images and metadata
    • Accepts both image references and directory paths

Why we need it:

This plugin automates the complete workflow for operator catalog management, from template generation to multi-platform image building and catalog inspection. It eliminates manual steps and
reduces errors in the catalog build process, making it easier for developers to:

  • Generate properly formatted catalog configurations
  • Build and publish multi-architecture catalog indexes
  • Inspect catalog contents without manual YAML parsing
  • Support both local development (directory-based) and production (image-based) workflows

Which issue(s) this PR fixes:

Fixes N/A (new feature)

Special notes for your reviewer:

Plugin Structure

  • All commands follow the Linux man-page inspired format (Name, Synopsis, Description, Arguments, Implementation, Examples, etc.)
  • Commands are well-documented with multiple examples covering common use cases
  • README provides clear overview and usage patterns

Key Implementation Details

  1. Multi-architecture support: All build commands support configurable architectures
  2. Cacheless builds: Production-ready minimal images using scratch base
  3. Flexible input: Query commands accept both container image references and local directory paths
  4. OPM integration: Leverages opm alpha commands for catalog operations
  5. Podman manifests: Creates multi-platform manifest lists for broad compatibility

Dependencies

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs (comprehensive README and per-command documentation).

@openshift-ci openshift-ci bot requested review from brandisher and stleerh November 3, 2025 04:59
@openshift-ci
Copy link

openshift-ci bot commented Nov 3, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Xia-Zhao-rh
Once this PR has been reviewed and has the lgtm label, please assign bryan-cox for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

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

@openshift-ci openshift-ci bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 3, 2025
@openshift-ci
Copy link

openshift-ci bot commented Nov 3, 2025

Hi @Xia-Zhao-rh. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 kubernetes-sigs/prow repository.

@Xia-Zhao-rh Xia-Zhao-rh changed the title add /operator-catalog plugin to build operator index image Add /operator-catalog plugin to build operator index image Nov 3, 2025
"description": "Generate HyperShift cluster creation commands via hcp CLI from natural language descriptions"
},
{
"name": "operator-catalog",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can these commands be part of the common OLM plugin? https://github.com/openshift-eng/ai-helpers/tree/main/plugins/olm

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, @chiragkyal
Thanks a lot for your comments.
The commands has been change to /olm:opm

Copy link

Choose a reason for hiding this comment

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

Great idea on namespacing, that will help with organization.

@stbenjam
Copy link
Member

stbenjam commented Nov 3, 2025

Please join the openshift-eng org. There's a pinned message on Slack.

/ok-to-test

@openshift-ci openshift-ci bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 3, 2025
@coderabbitai
Copy link

coderabbitai bot commented Nov 4, 2025

Walkthrough

Adds documentation and command metadata for a new /olm:opm command in the olm plugin that exposes Operator Package Manager (opm) actions: build-index-image, build-semver-index-image, generate-semver-template, and list (packages/channels/bundles).

Changes

Cohort / File(s) Summary
Top-level docs
PLUGINS.md
Added entry documenting the new /olm:opm command.
Plugin command doc
plugins/olm/commands/opm.md
New detailed command documentation describing actions (build-index-image, build-semver-index-image, generate-semver-template, list), synopses, arguments, examples, implementation outline, validation, prerequisites, return schema, and error handling.
Command metadata
docs/data.json
Added opm command entry under the olm plugin with description, synopsis (bash), and argument hint (<action> [arguments...]).

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant OlmPlugin as olm:opm (plugin)
  participant OPM as opm CLI
  participant Podman as podman
  participant Registry as ImageRegistry

  User->>OlmPlugin: /olm:opm <action> [args]
  OlmPlugin->>OlmPlugin: validate args & prerequisites
  alt validation fails
    OlmPlugin-->>User: error (validation/prereq)
  else validation succeeds
    OlmPlugin->>OPM: run opm <action> [args]
    alt action builds images
      OPM->>Podman: create manifests / build / push
      Podman->>Registry: push images
      Podman-->>OPM: push result
    end
    OPM-->>OlmPlugin: result / output
    OlmPlugin-->>User: formatted result or error
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Check plugins/olm/commands/opm.md for alignment with actual opm CLI flags and semantics.
  • Verify docs/data.json entry follows existing schema and will surface in command listings.
  • Confirm PLUGINS.md entry matches plugin naming and invocation conventions.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between b0d35d4 and 11b38ef.

📒 Files selected for processing (3)
  • PLUGINS.md (1 hunks)
  • docs/data.json (1 hunks)
  • plugins/olm/commands/opm.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • PLUGINS.md
  • plugins/olm/commands/opm.md
  • docs/data.json

Comment @coderabbitai help to get the list of available commands and usage tips.

@Xia-Zhao-rh Xia-Zhao-rh changed the title Add /operator-catalog plugin to build operator index image Add /olm:opm command to build operator index image Nov 4, 2025
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: 0

🧹 Nitpick comments (2)
plugins/olm/commands/opm.md (2)

10-10: Add language identifiers to fenced code blocks.

Fenced code blocks throughout the file lack language specifications, reducing syntax highlighting and accessibility. Lines 10, 36, 49, 59, 72, 83, 94, 104, 116, 125, 136, 146, and 157 should use ```bash instead of ```.

For example, apply this diff to line 10–17:

- ```
+ ```bash
  /olm:opm build-index-image <catalog-path> <index-image-tag> [--cacheless] [--arch=<arch>] [--base-image=<image>] [--builder-image=<image>]
  /olm:opm build-semver-index-image <semver-template-file> <index-image-tag> [--cacheless] [--arch=<arch>] [--base-image=<image>] [--builder-image=<image>]
  /olm:opm generate-semver-template <bundle-list> [--output=<file>] [--major=true|false] [--minor=true|false]
  /olm:opm list packages <index-ref>
  /olm:opm list channels <index-ref> [package-name]
  /olm:opm list bundles <index-ref> [package-name]
- ```
+ ```

Repeat for all other code blocks.

Also applies to: 36-36, 49-49, 59-59, 72-72, 83-83, 94-94, 104-104, 116-116, 125-125, 136-136, 146-146, 157-157


173-173: Wrap bare URL in angle brackets.

Line 173 contains a bare URL without markdown link formatting. Wrap it in angle brackets or convert to a proper markdown link for better readability and consistency with markdown conventions.

Apply this diff:

- - Check for `opm`: `which opm`
-   - If not found, provide installation instructions: https://github.com/operator-framework/operator-registry/releases
+ - Check for `opm`: `which opm`
+   - If not found, provide installation instructions: <https://github.com/operator-framework/operator-registry/releases>
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 9511985 and b0d35d4.

📒 Files selected for processing (3)
  • PLUGINS.md (1 hunks)
  • docs/data.json (1 hunks)
  • plugins/olm/commands/opm.md (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
plugins/olm/commands/opm.md

10-10: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


36-36: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


49-49: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


59-59: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


72-72: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


83-83: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


94-94: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


104-104: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


116-116: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


125-125: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


136-136: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


146-146: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


157-157: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


173-173: Bare URL used

(MD034, no-bare-urls)

🔇 Additional comments (3)
plugins/olm/commands/opm.md (1)

1-358: Documentation is comprehensive and well-structured.

The opm command documentation is well-organized with clear sections for each action (build-index-image, build-semver-index-image, generate-semver-template, list packages/channels/bundles), detailed implementation workflows, and practical examples. The YAML frontmatter aligns with the metadata in docs/data.json, and prerequisites, defaults, and multi-architecture support are clearly articulated. The overall structure and content quality are solid.

docs/data.json (1)

331-336: Command entry is correctly formatted and consistent.

The new opm command entry is properly structured with accurate description, a representative synopsis example, and a generic argument hint that covers all supported actions. Placement within the olm plugin commands array is appropriate.

PLUGINS.md (1)

126-126: New command listing is correctly integrated.

The /olm:opm command entry is properly formatted, consistently placed within the Olm Plugin command list, and accurately describes the functionality. The integration with opm.md and docs/data.json is seamless.

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

Labels

ok-to-test Indicates a non-member PR verified by an org member that is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants