Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Outdated image string join logic in ImageRow.image_ref #3125

Merged
merged 4 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions changes/3125.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix outdated image string join logic in `ImageRow.image_ref`.
2 changes: 1 addition & 1 deletion src/ai/backend/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def is_ip_address_format(str: str) -> bool:
return False


def join_non_empty(*args, sep):
def join_non_empty(*args: Optional[str], sep: str) -> str:
"""
Joins non-empty strings from the given arguments using the specified separator.
"""
Expand Down
4 changes: 3 additions & 1 deletion src/ai/backend/manager/models/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
ImageRegistry,
ResourceSlot,
)
from ai.backend.common.utils import join_non_empty
from ai.backend.logging import BraceStyleAdapter
from ai.backend.manager.models.container_registry import ContainerRegistryRow

Expand Down Expand Up @@ -264,7 +265,8 @@ def image_ref(self) -> ImageRef:
image_name = ""
_, tag = ImageRef.parse_image_tag(self.name.split(f"{self.registry}/", maxsplit=1)[1])
else:
image_and_tag = self.name.split(f"{self.registry}/{self.project}/", maxsplit=1)[1]
join = functools.partial(join_non_empty, sep="/")
_, _, image_and_tag = self.name.partition(f"{join(self.registry, self.project)}/")
jopemachine marked this conversation as resolved.
Show resolved Hide resolved
image_name, tag = ImageRef.parse_image_tag(image_and_tag)

return ImageRef(
Expand Down