Skip to content

manifest create: add --amend and --replace for non-list images#6676

Open
c-kruse wants to merge 2 commits intocontainers:mainfrom
c-kruse:manifest-create-amend-replace
Open

manifest create: add --amend and --replace for non-list images#6676
c-kruse wants to merge 2 commits intocontainers:mainfrom
c-kruse:manifest-create-amend-replace

Conversation

@c-kruse
Copy link

@c-kruse c-kruse commented Feb 8, 2026

Extend manifest create to handle name conflicts with non-list images:

  • --amend: convert a non-list image into a manifest list with the original image as its first entry.
  • --replace: remove the name from the existing image before creating a new manifest list.

Closes: #6639

What type of PR is this?

/kind feature

Special notes for your reviewer:

Some of the original manifest create --amend logic did not make total sense to me and has been omitted. I suspect there could be tricky edge cases I haven't considered that may warrant some of that debug logging.

Does this PR introduce a user-facing change?

Yes.

manifest create: add --replace
manifest create: update --amend to convert non-list images

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Feb 8, 2026
@Honny1
Copy link
Member

Honny1 commented Feb 9, 2026

@c-kruse Could you please sign your commits? https://github.com/containers/buildah/pull/6676/checks?check_run_id=62867948061

Copy link
Member

@Honny1 Honny1 left a comment

Choose a reason for hiding this comment

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

LGTM

Extend `manifest create` to handle name conflicts with non-list images:
- --amend: convert a non-list image into a manifest list with the
  original image as its first entry.
- --replace: remove the name from the existing image before creating a
  new manifest list.

Closes: containers#6639

Signed-off-by: Christian Kruse <christian@c-kruse.com>
@c-kruse c-kruse force-pushed the manifest-create-amend-replace branch from 89d9abc to 83b1bfd Compare February 9, 2026 16:31
@TomSweeneyRedHat
Copy link
Member

All kinds of test unhappiness, but at least some of it is not related to this PR. Restarting tests.

Co-authored-by: Tom Sweeney <tsweeney@redhat.com>
Signed-off-by: Christian Kruse <christian@c-kruse.com>
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.

Oh, nice, this fixes the rest of https://issues.redhat.com/browse/RUN-2047.
LGTM with one optional suggestion.

img, _, lookupErr := runtime.LookupImage(listImageSpec, &libimage.LookupImageOptions{ManifestList: true})
if lookupErr != nil {
return fmt.Errorf("looking up image to amend %q: %w", listImageSpec, lookupErr)
}
Copy link
Member

Choose a reason for hiding this comment

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

It's not a problem being introduced by this PR, but coming back to it, I think I would have wanted to have a confidence check here that the image that LookupImage() handed back to us did indeed have at least some overlap between its names and the elements of names. But this is definitely an improvement over the earlier version, and that's not a blocker.

Copy link
Author

Choose a reason for hiding this comment

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

Hi @nalind. I was wondering about this, and did do a little dive into ExpandNames + how LookupImage works. I'm not sure I understand it well enough to improve much here.

My impression is that names here (if no err) will always have length == 1, names[0] may not equal listImageSpec, and that it may not be strictly true that runtime.LookupImage/runtime.LookupManifestList will return the same image for names[0] and listImageSpec. I'm not sure if there's a most correct way to resolve an image name between the two, or if like you suggested it's better to just exit with an error when there is a mismatch.

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

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: manifest create --amend or --replace with non-list

4 participants