Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions projects/cluster/toolbox/deploy_custom_catalog/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def validate_parameters(args, ctx):
if not args.catalog_image:
raise ValueError("catalog_image is required")

return f"Validated custom catalog parameters for {ctx.display_name}"
return f"Validated custom catalog parameters for {args.display_name}"


@task
Expand All @@ -66,7 +66,7 @@ def render_catalog_source_manifest(args, ctx):
args.artifact_dir / "src" / f"{args.catalog_source_name}-catalogsource.yaml"
)
template.render_template_to_file("catalogsource.yaml.j2", ctx.catalog_manifest_file)
return f"Rendered CatalogSource manifest for {ctx.display_name}"
return f"Rendered CatalogSource manifest for {args.display_name}"


@task
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
spec:
sourceType: grpc
image: {{ args.catalog_image }}
displayName: {{ ctx.display_name }}
displayName: {{ args.display_name }}
{% if args.publisher %}
publisher: {{ args.publisher }}
{% endif %}
24 changes: 15 additions & 9 deletions projects/rhoai/library/pr_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

Supported syntax::

/rhoai.rc-image quay.io/rhoai/rhoai-fbc-fragment@sha256:abc123
/rhoai.rc-image quay.io/rhoai/rhoai-fbc-fragment@sha256:abc123 [CHANNEL]
"""

from __future__ import annotations
Expand All @@ -22,7 +22,9 @@ def handle_rhoai_rc_image_directive(line: str) -> dict[str, Any]:
"""
Handle /rhoai.rc-image directive for setting RHOAI RC catalog image.

Format: /rhoai.rc-image IMAGE
Format: /rhoai.rc-image IMAGE [CHANNEL]

CHANNEL is optional and defaults to "beta" if not specified.

Args:
line: The directive line
Expand All @@ -33,18 +35,21 @@ def handle_rhoai_rc_image_directive(line: str) -> dict[str, Any]:
Raises:
ValueError: If image is empty
"""
image = line.removeprefix("/rhoai.rc-image").strip()
parts = line.removeprefix("/rhoai.rc-image").strip().split()

if not image:
if not parts or not parts[0]:
raise ValueError(
"Invalid /rhoai.rc-image directive: image cannot be empty. "
"Example: /rhoai.rc-image quay.io/rhoai/rhoai-fbc-fragment@sha256:abc123"
"Example: /rhoai.rc-image quay.io/rhoai/rhoai-fbc-fragment@sha256:abc123 [beta]"
)

image = parts[0]
channel = parts[1] if len(parts) > 1 else "beta"

return {
"platform.rhoai.custom_catalog.enabled": True,
"platform.rhoai.custom_catalog.image": image,
"platform.operators.rhods-operator.channel": "beta",
"platform.operators.rhods-operator.channel": channel,
}


Expand All @@ -69,7 +74,8 @@ def get_supported_rhoai_directives() -> dict[str, str]:
"""
return {
"/rhoai.rc-image": """Set RHOAI RC catalog image for testing release candidates.
Format: /rhoai.rc-image IMAGE
Example: /rhoai.rc-image quay.io/rhoai/rhoai-fbc-fragment@sha256:abc123
Effect: Enables custom catalog with the given image and sets operator channel to beta.""",
Format: /rhoai.rc-image IMAGE [CHANNEL]
CHANNEL is optional and defaults to beta if not specified.
Example: /rhoai.rc-image quay.io/rhoai/rhoai-fbc-fragment@sha256:abc123 stable
Effect: Enables custom catalog with the given image and sets operator channel.""",
}
Loading