Skip to content

Refactor NewImageSource to add a manifest type abstraction #5743

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

Merged
merged 4 commits into from
May 20, 2025

Conversation

aaronlehmann
Copy link
Contributor

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Currently, NewImageSource creates a Docker schema2 manifest and an OCI manifest at the same time. This precludes functionality that isn't supported by both manifest types, for example zstd compression. Refactoring this to create only the desired manifest type solves this and also cleans up the code by separating manifest-type-specific code into distinct implementations of a "manifest builder".

How to verify it

Existing tests should suffice since this does not change any semantics, it only cleans up the implementation.

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

See discussion in #5452.

Does this PR introduce a user-facing change?

None

@openshift-ci openshift-ci bot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Sep 17, 2024
@aaronlehmann aaronlehmann force-pushed the refactor-manifest-types branch 2 times, most recently from 9f1c553 to 81fea1d Compare September 17, 2024 23:39
@aaronlehmann
Copy link
Contributor Author

@mtrmac: PTAL - thanks!

@aaronlehmann
Copy link
Contributor Author

@rhatdan @mtrmac: Would it be possible to get some eyes on this when you have a moment? I was asked to do this to unblock #5452, so I would really appreciate if we could avoid letting it sit too long.

@aaronlehmann
Copy link
Contributor Author

Any possibility of moving this forward? It's a bit frustrating that I was asked to come back and do this refactor, but the PR is not getting reviewed.

@TomSweeneyRedHat
Copy link
Member

@mtrmac have you had a chance to look at this?

@TomSweeneyRedHat
Copy link
Member

@aaronlehmann sorry for the delay. Many of the maintainers are Red Hat based, and we've all been under a big crunch the past few weeks.

@mtrmac
Copy link
Contributor

mtrmac commented Nov 4, 2024

@Honny1 Do you happen to have the time to take a look?

Copy link

github-actions bot commented Dec 5, 2024

A friendly reminder that this PR had no activity for 30 days.

@aaronlehmann
Copy link
Contributor Author

@TomSweeneyRedHat @mtrmac @Honny1: Would any of you be able to look at this? I've been trying to get this through for a very long time.

@mtrmac
Copy link
Contributor

mtrmac commented Feb 27, 2025

@flouthoc do you happen to have time for this?

@github-actions github-actions bot removed the stale-pr label Feb 28, 2025
@flouthoc
Copy link
Collaborator

I will review this thanks.

@flouthoc flouthoc self-assigned this Feb 28, 2025
@flouthoc
Copy link
Collaborator

@aaronlehmann Could you please rebase this first, just to be sure if every thing is good.

@aaronlehmann aaronlehmann force-pushed the refactor-manifest-types branch from 81fea1d to b962939 Compare February 28, 2025 21:24
@aaronlehmann
Copy link
Contributor Author

Rebased.

@flouthoc flouthoc added the No New Tests Allow PR to proceed without adding regression tests label Feb 28, 2025
@aaronlehmann
Copy link
Contributor Author

Hi @flouthoc, have you had a chance to look at this yet?

Copy link
Collaborator

@flouthoc flouthoc left a comment

Choose a reason for hiding this comment

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

There is some duplication but PR LGTM. Could you please rebase again.

@aaronlehmann aaronlehmann force-pushed the refactor-manifest-types branch from b962939 to 72ea5a8 Compare March 18, 2025 17:47
@aaronlehmann
Copy link
Contributor Author

Rebased again.

@aaronlehmann
Copy link
Contributor Author

@flouthoc: Hoping I can get this merged before it needs yet another rebase 😄

Copy link
Collaborator

@flouthoc flouthoc left a comment

Choose a reason for hiding this comment

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

LGTM @nalind any comments ?

image.go Outdated
@@ -720,187 +1027,19 @@ func (i *containerImageRef) NewImageSource(_ context.Context, _ *types.SystemCon
}
// Add a note in the manifest about the layer. The blobs are identified by their possibly-
// compressed blob digests.
Copy link
Member

Choose a reason for hiding this comment

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

This looks like a comment that addLayer() should have in it, or as part of its godoc.

@aaronlehmann
Copy link
Contributor Author

@nalind: Thanks for the review - updated based on your feedback.

@aaronlehmann aaronlehmann force-pushed the refactor-manifest-types branch from 5686f79 to 7fbdf26 Compare March 19, 2025 19:48
@aaronlehmann
Copy link
Contributor Author

@nalind @flouthoc: Any further comments?

@aaronlehmann
Copy link
Contributor Author

@nalind @flouthoc: Can we please move ahead with merging this? Thanks!

@flouthoc
Copy link
Collaborator

PR LGTM I am waiting for @nalind to ack on his last remarks.

@aaronlehmann
Copy link
Contributor Author

@nalind: Sorry to be so persistent here, but I'd really like to get this merged, since it has been dragging on for so long, and it's hard to keep coming back to this after long pauses.

@aaronlehmann aaronlehmann force-pushed the refactor-manifest-types branch from 7fbdf26 to 8008e9c Compare March 31, 2025 15:37
Copy link
Member

@nalind nalind left a comment

Choose a reason for hiding this comment

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

Minor nits, otherwise LGTM.

Currently, NewImageSource creates a Docker schema2 manifest and an OCI
manifest at the same time. This precludes functionality that isn't
supported by both manifest types, for example zstd compression.
Refactoring this to create only the desired manifest type solves this
and also cleans up the code by separating manifest-type-specific code
into distinct implementations of a "manifest builder".

See discussion in containers#5452.

Signed-off-by: Aaron Lehmann <[email protected]>
Signed-off-by: Aaron Lehmann <[email protected]>
Signed-off-by: Aaron Lehmann <[email protected]>
@aaronlehmann aaronlehmann force-pushed the refactor-manifest-types branch from 8008e9c to 71859d1 Compare April 10, 2025 20:02
@aaronlehmann
Copy link
Contributor Author

Made the changes, thanks!

@aaronlehmann
Copy link
Contributor Author

@nalind: Just checking on this again...

@aaronlehmann
Copy link
Contributor Author

@nalind @flouthoc: I'm grateful for your help moving this forward, but I have to say this has been a very frustrating experience. I'm making one last request for a final review so I can get this merged.

@mtrmac
Copy link
Contributor

mtrmac commented May 20, 2025

I’m afraid I can’t spend much time on this now, and this is probably locally not helpful: I happened to notice parallel #6159 .

@flouthoc
Copy link
Collaborator

@aaronlehmann Apologies for the delay. The PR LGTM, I am rebasing this and getting this merged. This already has 2 LGTM.

Copy link
Collaborator

@flouthoc flouthoc left a comment

Choose a reason for hiding this comment

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

LGTM
/lgtm
/approve
/hold

Copy link
Contributor

openshift-ci bot commented May 20, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aaronlehmann, flouthoc, nalind

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

The pull request process is described here

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

Copy link

Ephemeral COPR build failed. @containers/packit-build please check.

@flouthoc flouthoc merged commit cf4635e into containers:main May 20, 2025
31 of 37 checks passed
@aaronlehmann
Copy link
Contributor Author

Thanks so much @flouthoc, I really appreciate it. This refactor was motivated by #5452, which now becomes a trivial change to the OCI manifest code path. I've rebased that PR - if you could take a look that would be awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm No New Tests Allow PR to proceed without adding regression tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants