@@ -56,20 +56,45 @@ def default_notebook(
5656 # Optional Auth annotations
5757 auth_annotations = request .param .get ("auth_annotations" , {})
5858
59+ # Optional custom image parameter (for custom workbench image testing)
60+ custom_image = request .param .get ("custom_image" , None )
61+
62+ # Validate custom_image if provided
63+ if custom_image is not None :
64+ custom_image = custom_image .strip ()
65+ if not custom_image :
66+ raise ValueError ("custom_image cannot be empty or whitespace" )
67+
5968 # Set the correct username
6069 username = get_username (dyn_client = admin_client )
6170 assert username , "Failed to determine username from the cluster"
6271
63- # Check internal image registry availability
64- internal_image_registry = check_internal_image_registry_available (admin_client = admin_client )
65-
66- # Set the image path based on internal image registry status
67- minimal_image_path = (
68- f"{ INTERNAL_IMAGE_REGISTRY_PATH } /{ py_config ['applications_namespace' ]} /{ minimal_image } "
69- if internal_image_registry
70- else ":" + minimal_image .rsplit (":" , maxsplit = 1 )[1 ]
72+ # Error messages
73+ _ERR_INVALID_CUSTOM_IMAGE = (
74+ "custom_image must be a valid OCI image reference "
75+ "(e.g., 'quay.io/org/image:tag' or 'quay.io/org/image@sha256:digest'), "
76+ "got: '{custom_image}'"
7177 )
7278
79+ # Determine which image to use
80+ if custom_image :
81+ # Custom image provided - use it directly (must be valid OCI image reference)
82+ if ":" not in custom_image or "/repository/" in custom_image or "/manifest/" in custom_image :
83+ raise ValueError (_ERR_INVALID_CUSTOM_IMAGE .format (custom_image = custom_image ))
84+ minimal_image_path = custom_image
85+ LOGGER .info (f"Using custom workbench image: { custom_image } " )
86+ else :
87+ # No custom image - use default minimal image with registry resolution
88+ # Check internal image registry availability
89+ internal_image_registry = check_internal_image_registry_available (admin_client = admin_client )
90+
91+ # Set the image path based on internal image registry status
92+ minimal_image_path = (
93+ f"{ INTERNAL_IMAGE_REGISTRY_PATH } /{ py_config ['applications_namespace' ]} /{ minimal_image } "
94+ if internal_image_registry
95+ else ":" + minimal_image .rsplit (":" , maxsplit = 1 )[1 ]
96+ )
97+
7398 probe_config = {
7499 "failureThreshold" : 3 ,
75100 "httpGet" : {
@@ -90,7 +115,7 @@ def default_notebook(
90115 "annotations" : {
91116 Labels .Notebook .INJECT_AUTH : "true" ,
92117 "opendatahub.io/accelerator-name" : "" ,
93- "notebooks.opendatahub.io/last-image-selection" : minimal_image ,
118+ "notebooks.opendatahub.io/last-image-selection" : minimal_image_path if custom_image else minimal_image ,
94119 # Add any additional annotations if provided
95120 ** auth_annotations ,
96121 },
0 commit comments