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: Faulty parsing of customized image's tag_set #3028

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jopemachine
Copy link
Member

@jopemachine jopemachine commented Nov 5, 2024

Fixed incorrect tag_set parsing of customized images generated via the session commit introduced in PR #1909.

Before & After

For example, in the case of the following image, the tag_set data of the parsing result is updated as shown below.

Image canonical: registry.gitlab.com/project/img_name:3.9-ubuntu20.04-customized_ecab90f3618b4ad394c737200c7f5a44

Before

{'ubuntu': '20.04', 'customized_ecab': '90f3618b4ad394c737200c7f5a44'}

After

{'ubuntu': '20.04', 'bai_customized_image_tag': 'customized_ecab90f3618b4ad394c737200c7f5a44'}

Checklist: (if applicable)

  • Milestone metadata specifying the target backport version
  • Test case(s) to:
    • Demonstrate the difference of before/after
    • Demonstrate the flow of abstract/conceptual models with a concrete implementation

@github-actions github-actions bot added comp:common Related to Common component size:S 10~30 LoC labels Nov 5, 2024
@jopemachine jopemachine added the type:bug Reports about that are not working label Nov 5, 2024
@jopemachine jopemachine added this to the 24.03 milestone Nov 5, 2024
@jopemachine jopemachine changed the title fix: Customized image tag parsing error fix: Faulty parsing of customized image's tag_set Nov 5, 2024
@jopemachine jopemachine marked this pull request as ready for review November 5, 2024 07:07
@jopemachine jopemachine added the action:on hold Hold it. Wait for the restart. label Nov 5, 2024
@jopemachine
Copy link
Member Author

Let’s avoid embedding special keywords or gimmicks directly into the parsing logic.
Instead of adding special keywords like bai_customized_image_tag, let’s consider a better approach.

@@ -312,6 +312,10 @@ def __init__(self, tags: Iterable[str], value: Optional[str] = None) -> None:
self._data = dict()
rx = type(self)._rx_ver
for tag in tags:
if re.match(r"^customized_[0-9a-fA-F]{32}$", tag):
self._data["bai_customized_image_tag"] = tag

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't you remove customized_ from tag?

Copy link
Member Author

@jopemachine jopemachine Nov 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this PR, I mappped the tag itself to the special keyword bai_customized_image_tag.
If we’re only mapping the UUID of the custom image, it might be better to rename the keyword to something like bai_customized_image_id.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action:on hold Hold it. Wait for the restart. comp:common Related to Common component size:S 10~30 LoC type:bug Reports about that are not working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants