Skip to content

[ISV-7037] Add defaultChannel support to release-config.yaml schema#932

Merged
haripate merged 4 commits intomainfrom
ISV-7037
Apr 21, 2026
Merged

[ISV-7037] Add defaultChannel support to release-config.yaml schema#932
haripate merged 4 commits intomainfrom
ISV-7037

Conversation

@haripate
Copy link
Copy Markdown
Contributor

@haripate haripate commented Apr 16, 2026

JIRA Ticket: https://redhat.atlassian.net/browse/ISV-7037

Merge Request Checklists

  • Development is done in feature branches
  • Code changes are submitted as pull request into a primary branch [Provide reason for non-primary branch submissions]
  • Code changes are covered with unit and integration tests.
  • Code passes all automated code tests:
    • Linting
    • Code formatter - Black
    • Security scanners
    • Unit tests
    • Integration tests
  • Code is reviewed by at least 1 team member
  • Pull request is tagged with "risk/good-to-go" label for minor changes

@qodo-code-review
Copy link
Copy Markdown

ⓘ You are approaching your monthly quota for Qodo. Upgrade your plan

Review Summary by Qodo

Add defaultChannel support to release-config.yaml schema

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Add defaultChannel property to release-config schema
• Allow operators to specify default channel explicitly
• Fall back to first channel if not provided
Diagram
flowchart LR
  A["release-config.yaml"] -->|"new defaultChannel property"| B["release-config-schema.json"]
  B -->|"schema validation"| C["add_bundle_to_fbc.py"]
  C -->|"use defaultChannel or fallback"| D["olm.package object"]
Loading

Grey Divider

File Changes

1. operatorcert/schemas/release-config-schema.json ✨ Enhancement +4/-0

Add defaultChannel property to schema

• Added defaultChannel property to schema
• Property is optional with string type
• Defaults to first channel in catalog_templates if not specified

operatorcert/schemas/release-config-schema.json


2. operatorcert/entrypoints/add_bundle_to_fbc.py ✨ Enhancement +1/-1

Use configurable defaultChannel in package creation

• Modified package creation to use defaultChannel from release_config
• Falls back to first channel name if not provided
• Enables flexible default channel configuration

operatorcert/entrypoints/add_bundle_to_fbc.py


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented Apr 16, 2026

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. defaultChannel scope mismatch🐞 Bug ≡ Correctness
Description
release-config-schema.json defines defaultChannel at the top level, but BasicTemplate.create()
reads it from the per-template dict (each element of catalog_templates) passed by
release_bundle_to_fbc(), so a top-level defaultChannel will not affect the generated template.
Code

operatorcert/schemas/release-config-schema.json[R11-14]

+    "defaultChannel": {
+      "description": "the default channel for the operator package (optional, defaults to first channel in catalog_templates)",
+      "type": "string"
+    },
Evidence
The schema introduces defaultChannel as a top-level property, but the FBC release flow iterates
bundle.release_config["catalog_templates"] and passes each item (release_config_template) into
template.add_new_bundle(...); BasicTemplate.create() then calls
release_config.get("defaultChannel", ...) on that per-template object, not on the top-level
bundle.release_config.

operatorcert/schemas/release-config-schema.json[1-64]
operatorcert/entrypoints/add_bundle_to_fbc.py[453-488]
operatorcert/entrypoints/add_bundle_to_fbc.py[241-309]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`defaultChannel` is defined at the root of `release-config.yaml` schema, but the runtime code only ever reads `defaultChannel` from each `catalog_templates[]` entry. As a result, users following the schema (setting `defaultChannel` at the top level) won’t change the generated `olm.package.defaultChannel`.
### Issue Context
`release_bundle_to_fbc()` iterates `bundle.release_config["catalog_templates"]` and passes each entry to `BasicTemplate.create()`.
### Fix Focus Areas
Choose **one** consistent model and implement it end-to-end:
**Option A (global defaultChannel):**
- In `release_bundle_to_fbc()`, merge the top-level `bundle.release_config.get("defaultChannel")` into each `release_config_template` before calling `add_new_bundle()` (e.g., `cfg = dict(release_config_template); cfg.setdefault("defaultChannel", bundle.release_config.get("defaultChannel"))`).
**Option B (per-template defaultChannel):**
- Move `defaultChannel` into the `catalog_templates.items.properties` schema (and update description), and remove it from the top-level schema.
- operatorcert/entrypoints/add_bundle_to_fbc.py[465-487]
- operatorcert/entrypoints/add_bundle_to_fbc.py[274-309]
- operatorcert/schemas/release-config-schema.json[1-63]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Unvalidated defaultChannel value🐞 Bug ☼ Reliability
Description
BasicTemplate.create() will set olm.package.defaultChannel to any provided defaultChannel
string without checking it exists in release_config["channels"], which can generate a template
whose default channel has no corresponding olm.channel entry.
Code

operatorcert/entrypoints/add_bundle_to_fbc.py[R299-303]

     package = {
         "schema": "olm.package",
         "name": self.operator.operator_name,
-            "defaultChannel": channels[0]["name"],
+            "defaultChannel": release_config.get("defaultChannel", channels[0]["name"]),
     }
Evidence
The function builds channel entries exclusively from release_config["channels"] but assigns
package["defaultChannel"] from release_config.get("defaultChannel", ...) without validating
membership; therefore defaultChannel can refer to a channel that is never created in entries.

operatorcert/entrypoints/add_bundle_to_fbc.py[274-309]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`BasicTemplate.create()` can generate inconsistent templates when `defaultChannel` is set to a value not present in the configured `channels`, producing an `olm.package.defaultChannel` that points to a non-existent channel.
### Issue Context
Channel entries are created only from `release_config["channels"]`. `defaultChannel` is taken verbatim from config.
### Fix Focus Areas
- Compute `default_channel` once, then validate it:
- `default_channel = release_config.get("defaultChannel") or channels[0]["name"]`
- If `default_channel` not in `release_config["channels"]`, raise a clear `ValueError` (or alternatively, auto-add the missing channel, but be explicit).
- Consider also tightening schema validation by defining `defaultChannel` in the same object where `channels` is defined (if per-template), so type errors don’t slip through.
- operatorcert/entrypoints/add_bundle_to_fbc.py[286-304]
- operatorcert/schemas/release-config-schema.json[1-63]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Advisory comments

3. Docs omit defaultChannel🐞 Bug ⚙ Maintainability
Description
User documentation for release-config.yaml does not mention the new defaultChannel key, so users
won’t know how/where to configure it (especially given the schema/code scope ambiguity).
Code

operatorcert/schemas/release-config-schema.json[R11-14]

+    "defaultChannel": {
+      "description": "the default channel for the operator package (optional, defaults to first channel in catalog_templates)",
+      "type": "string"
+    },
Evidence
The docs describe release-config.yaml as containing catalog_templates with keys like
template_name and channels, but do not document defaultChannel, while the schema now does.

docs/users/fbc_autorelease.md[39-70]
operatorcert/schemas/release-config-schema.json[1-64]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The documentation for `release-config.yaml` doesn’t include the newly added `defaultChannel` field, which can lead to misconfiguration and confusion.
### Issue Context
Docs currently list only `catalog_templates` keys.
### Fix Focus Areas
- Add a short section describing `defaultChannel`, including whether it is top-level or per `catalog_templates[]` entry (whichever the code is updated to support).
- Update the example YAML accordingly.
- docs/users/fbc_autorelease.md[39-70]
- operatorcert/schemas/release-config-schema.json[1-64]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Comment thread operatorcert/schemas/release-config-schema.json Outdated
Comment thread operatorcert/entrypoints/add_bundle_to_fbc.py
@haripate haripate added the risk/good-to-go Indicates a small risk change label Apr 16, 2026
@acornett21
Copy link
Copy Markdown
Contributor

@haripate Can the fbc_autorelease.md also be updated so that partners know this is supported?

Copy link
Copy Markdown
Contributor

@mantomas mantomas left a comment

Choose a reason for hiding this comment

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

Provided changes looks good.

Copy link
Copy Markdown
Contributor

@BorekZnovustvoritel BorekZnovustvoritel left a comment

Choose a reason for hiding this comment

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

One problem I spotted in the tests, otherwise this seems good to me.

Comment thread operatorcert/entrypoints/add_bundle_to_fbc.py Outdated
Comment thread tests/entrypoints/test_add_bundle_to_fbc.py Outdated
@haripate
Copy link
Copy Markdown
Contributor Author

@acornett21 I have also updated the fbc_autorelease.md along with the changes in this PR.

@haripate haripate merged commit 747b04f into main Apr 21, 2026
4 checks passed
@haripate haripate deleted the ISV-7037 branch April 21, 2026 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk/good-to-go Indicates a small risk change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants