diff --git a/projects/cluster/toolbox/deploy_custom_catalog/main.py b/projects/cluster/toolbox/deploy_custom_catalog/main.py index 91c2ea738..838505a25 100644 --- a/projects/cluster/toolbox/deploy_custom_catalog/main.py +++ b/projects/cluster/toolbox/deploy_custom_catalog/main.py @@ -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 @@ -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 diff --git a/projects/cluster/toolbox/deploy_custom_catalog/templates/catalogsource.yaml.j2 b/projects/cluster/toolbox/deploy_custom_catalog/templates/catalogsource.yaml.j2 index 8f00bdc1a..a1554c2e9 100644 --- a/projects/cluster/toolbox/deploy_custom_catalog/templates/catalogsource.yaml.j2 +++ b/projects/cluster/toolbox/deploy_custom_catalog/templates/catalogsource.yaml.j2 @@ -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 %} diff --git a/projects/rhoai/library/pr_args.py b/projects/rhoai/library/pr_args.py index 6d10dccd6..e366d3808 100644 --- a/projects/rhoai/library/pr_args.py +++ b/projects/rhoai/library/pr_args.py @@ -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 @@ -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 @@ -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, } @@ -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.""", }