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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
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.removeprefix(f"{join(self.registry, self.project)}/")
image_name, tag = ImageRef.parse_image_tag(image_and_tag)

return ImageRef(
Expand Down