Skip to content

Conversation

@robbmanes
Copy link

Add optional logging for printing outgoing manifests. This can greatly help in debugging anything that might alter a manifest either on wire or in the use case I just had, verifying a problem in local storage (verifying the outgoing manifests without having to watch pure HTTP calls, etc).

Copy link
Collaborator

@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.

Thanks!

There already is

err := fmt.Errorf("uploading manifest %s to %s: %w", tagOrDigest, d.ref.ref.Name(), rawErr)
, on failure. Is that not sufficient?

On success, it should be possible to read the uploaded manifest from the registry — due to the existence of digest references, the registry does not really have the option to modify the uploaded data.

(My basic concern is that this is fairly noisy… and potentially we might worry about escaping the data, e.g. if it included newlines.)

@Luap99
Copy link
Member

Luap99 commented Feb 11, 2025

One option could be to use the trace level not debug to log this message. We don't make a lot of use of that in podman but I used that myself to trigger trace logging in netavark which dumps netlink message which was useful to me a few times. (podman --log-level trace ...)
That said it looks like skopeo only offers the debug level and not a per level selection like podman or buildah so if c/image starts logging with trace level skopeo would need to support that as well.

If escaping is a concern it could log with %q instead of %s.

@robbmanes
Copy link
Author

In our case here, the specific scenario we were debugging was not a failure scenario; skopeo/podman was uploading layers with a negative size value (-1), which is a different issue altogether I'm filing shortly, but because it didn't fail to upload we couldn't prove sans HTTP dump of the payload what the manifest coming from the client was, or if any of the myriad of proxies/data inspection security devices were interfering with the data on-wire (TLS/SSL termination and data inspection network device which ultimately led to being exonerated by this debug line, as we could see clearly the manifest being pushed was wrong).

And as @Luap99 mentioned (and was exactly right about), this was with skopeo so I initially did Tracef but quickly found out skopeo didn't support anything but Debugf, so I did that instead. I agree it should be trace-level data if we updated skopeo to include such a thing though.

Also agreed with escaping the data if we prefer; I originally did %+v but it just wasn't necessary, and strings worked, but I'm perfectly happy to squash in a %q if you prefer. Thanks!

Signed-off-by: Robb Manes <rmanes@redhat.com>
@robbmanes robbmanes force-pushed the add_manifest_print_trace branch from 010d400 to c6254e7 Compare February 11, 2025 20:01
@robbmanes
Copy link
Author

Cast as string and formatting with %q is squashed in.

@robbmanes
Copy link
Author

This really should be Trace, it's very verbose but still greatly helpful. Tried my hand at adding --log-level to skopeo in containers/skopeo#2514 if we want to wait on that, and then I can squash this into a Tracef.

Copy link
Collaborator

@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.

Good idea, using the trace level makes sense to me. (Also #201 proposes to use trace level, so that would be consistent.)

return nil, fmt.Errorf("committing the finished image: %w", err)
}

logrus.Debugf("Copied manifest(s): %q", string(copiedManifest))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this would be better handled by logging before the PutManifest call in copyMultipleImages; that should record the same data, and avoid logging the same manifest twice in single-architecture copy situations.

@mtrmac mtrmac added the kind/feature A request for, or a PR adding, new functionality label Mar 4, 2025
@jankaluza
Copy link
Member

Hi, and thank you for your contribution!

We’ve recently migrated this repository into a new monorepo: containers/container-libs along with other repositories

As part of this migration, this repository is no longer accepting new Pull-Requests and therefore this Pull-Request is being closed.

Thank you very much for your contribution. We would appreciate your continued help in migrating this PR to the new container-libs repository. Please let us know if you are facing any issues.

You can read more about the migration and the reasoning behind it in our blog post: Upcoming migration of three containers repositories to monorepo.

Thanks again for your work and for supporting the containers ecosystem!

@jankaluza jankaluza closed this Aug 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature A request for, or a PR adding, new functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants