Skip to content

Conversation

@Luap99
Copy link
Member

@Luap99 Luap99 commented Mar 26, 2025

ImageReference is an interface and we generally have no idea about the underlying layout here and if that can be printed as string. In case of the docker transport we get:
{{{docker.io library/busybox} latest} %!s(bool=false)}

That is clearly wrong and confusing, instead use transports.ImageName() which is the recommended way to refer to images in the UI.

ImageReference is an interface and we generally have no idea about the
underlying layout here and if that can be printed as string. In case of
the docker transport we get:
{{{docker.io library/busybox} latest} %!s(bool=false)}

That is clearly wrong and confusing, instead use transports.ImageName()
which is the recommended way to refer to images in the UI.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 26, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Luap99

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Luap99
Copy link
Member Author

Luap99 commented Mar 26, 2025

cc @mtrmac

@Luap99
Copy link
Member Author

Luap99 commented Mar 26, 2025

I wonder why none of the linters complained about this, the interface does not implement fmt.Stringer so it should be an invalid format specifier in my eyes.

@mheon
Copy link
Member

mheon commented Mar 26, 2025

LGTM

Copy link
Contributor

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

/lgtm

Thanks!

@openshift-ci openshift-ci bot added the lgtm label Mar 26, 2025
@openshift-merge-bot openshift-merge-bot bot merged commit d835d7e into containers:main Mar 26, 2025
15 checks passed
@Luap99 Luap99 deleted the copy-err branch March 26, 2025 16:44
_, err := c.copyInternal(ctx, source, destination, &resolvedReference)
if err != nil {
return nil, fmt.Errorf("internal error: unable to copy from source %s: %w", source, err)
return nil, fmt.Errorf("internal error: unable to copy from source %s: %w", transports.ImageName(source), err)
Copy link
Contributor

Choose a reason for hiding this comment

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

@flouthoc Also, this should not say “internal error”. Maybe this should not be wrapping the error at all — copyInternal(…, nil) should, conceptually, be producing a valid error.

Before this PR, I see

Error: internal error: unable to copy from source {{{localhost:5000 pushed} latest} %!s(bool=false)}: initializing source docker://localhost:5000/pushed:latest: pinging container registry localhost:5000: Get "https://localhost:5000/v2/": http: server gave HTTP response to HTTPS client

Copy link
Contributor

Choose a reason for hiding this comment

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

(The http:… part is ~expected on that run, and does not need investigating.)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I will open a followup PR to correct this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants