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: Wrong image name extraction logic #2391

Closed
wants to merge 2 commits into from

Conversation

jopemachine
Copy link
Member

@jopemachine jopemachine commented Jul 5, 2024

Existing code appears to assume the image name format is <registry URL>/<namespace>/<image>

new_name = base_image_ref.name.split("/", maxsplit=1)[1]
else:
# for cases where project name is not specified (e.g. redis, nginx, ...)
new_name = base_image_ref.name
# remove any existing customized related tag from base canonical
filtered_tag_set = [
x for x in base_image_ref.tag.split("-") if not x.startswith("customized_")
]
new_canonical = (
f"{registry_hostname}/{registry_project}/{new_name}:{'-'.join(filtered_tag_set)}"
)

If the image name format is <registry URL>/<namespace>/<project>/<image>, this logic incorrectly extracts the image name.

For example,

>>> base_image_ref = "jopemachine/ghcr-test/python"
>>> new_name = base_image_ref.split("/", maxsplit=1)[1]
>>> new_name 
'ghcr-test/python'  # <project>/<image> 

new_name includes not only the image name but also the project name.

As a result, in the logic that assigns new_canonical, the project name is included twice.

(like ghcr.io/jopemachine/ghcr-test/ghcr-test/python:3.9-ubuntu20.04)


Ref: #2341.

Checklist: (if applicable)

  • Milestone metadata specifying the target backport version

📚 Documentation preview 📚: https://sorna--2391.org.readthedocs.build/en/2391/


📚 Documentation preview 📚: https://sorna-ko--2391.org.readthedocs.build/ko/2391/

Copy link

graphite-app bot commented Jul 5, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “flow:merge-queue” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “flow:hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

@github-actions github-actions bot added area:docs Documentations comp:manager Related to Manager component size:XS ~10 LoC labels Jul 5, 2024
Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @jopemachine and the rest of your teammates on Graphite Graphite

@jopemachine
Copy link
Member Author

Closing this PR because the logic for obtaining the image name is intentional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:docs Documentations comp:manager Related to Manager component size:XS ~10 LoC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant