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

manifests,push: add support for AddCompression #1585

Conversation

flouthoc
Copy link
Collaborator

c/image recently added support for EnsureCompressionVariantsExist, following PR exposes the feature to c/common manifests so actual users can use it.

Needs: containers/image#1987

@flouthoc
Copy link
Collaborator Author

We need vendor of: containers/image#1987 first.

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.

  • The idea and general approach LGTM
  • I don’t feel strongly about the “replicate” name… it’s fairly imprecise (we are not replicating anything when asking for zstd and the image already is zstd), OTOH it’s nicely short
  • There are several reasons why this doesn’t even compile, so it apparently hasn’t been tried at all…
  • (Vendoring a c/image commit in this PR is fine… now that the c/image PR was merged.)

libimage/manifests/manifests_test.go Outdated Show resolved Hide resolved
@flouthoc
Copy link
Collaborator Author

“replicate” name… it’s fairly imprecise

@mtrmac Yes we need a better name since a similar flag is going to be in CLI as well, do have any names in mind ? I have few EnsureCompression, CloneCompression, CopyWithCompression but not sure if they are good.

@giuseppe @vrothberg @rhatdan Any naming ideas other than replicate

@@ -70,6 +71,7 @@ type PushOptions struct {
RemoveSignatures bool // true to discard signatures in images
ManifestType string // the format to use when saving the list - possible options are oci, v2s1, and v2s2
SourceFilter LookupReferenceFunc // filter the list source
ReplicateWithCompression []string // replicate required imges with requested compression algorithms
Copy link
Member

Choose a reason for hiding this comment

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

CompressionVariants would be ~ consistent with c/image I think.

Copy link
Collaborator

Choose a reason for hiding this comment

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

do have any names in mind

I can’t think of anything clearly better. Something broadly like “ensure has compression”? But using a simpler and shorter word than “ensure” would be nice.


(BTW until c/image tags a release, we can rename the c/image options if we find a good name.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

c/image has option as EnsureCompressionVariantsExist we can name this as same and later CLI can have --ensure-compression

Copy link
Member

Choose a reason for hiding this comment

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

--ensure-compression sounds more like a validation check to me.

@flouthoc flouthoc force-pushed the implement-ensure-compression-exsts branch from 53146f9 to fa665ac Compare July 26, 2023 15:28
Signed-off-by: Aditya R <arajan@redhat.com>
@flouthoc flouthoc force-pushed the implement-ensure-compression-exsts branch 2 times, most recently from 1330fd1 to 7816121 Compare July 26, 2023 15:33
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.

Code LGTM.

I don’t know whether we can improve on the naming. One very reasonable answer is that c/common explicitly does not have a stable API, so we can change our mind at any time in the future, and it is not worth worrying about much in this repo.

OTOH we do need to settle on a name we are happy with for the CLI options, which are presumably going to come immediately after this PR.

libimage/manifests/manifests.go Outdated Show resolved Hide resolved
@flouthoc flouthoc force-pushed the implement-ensure-compression-exsts branch from 7816121 to 93f7f8d Compare July 27, 2023 05:06
@flouthoc
Copy link
Collaborator Author

OTOH we do need to settle on a name we are happy with for the CLI options, which are presumably going to come immediately after this PR.

Yes I agree, lets decide it on the CLI PR, where I am going to add this i.e buildah and later skopeo we can decide it there.

@vrothberg @giuseppe @rhatdan PTAL

@vrothberg
Copy link
Member

Yes I agree, lets decide it on the CLI PR, where I am going to add this i.e buildah and later skopeo we can decide it there.

I think we should decide here, otherwise we're just going to reopen the very same conversation.

--ensure-compression sounds more like a validation check to me. I also do not like ReplicateWithCompression in that context as I want a consistent terminology. It's not nice to have three different terms for the same thing across c/image, c/common and the CLI - although I am OK to embed a more descriptive action in the CLI.

A "replica" to me is a 1:1 copy of an original which is not 100 accurate here I think. I like the term "variant" or "instance".

@flouthoc
Copy link
Collaborator Author

flouthoc commented Jul 27, 2023

--ensure-compression sounds more like a validation check to me

Ah my idea was that flag will ensure that manifest list contains the compression, if it is not there it will create one. How about --compression-variant ?

@vrothberg
Copy link
Member

--ensure-compression sounds more like a validation check to me

Ah my idea was that flag will ensure that manifest list contains the compression, if it is not there it will create one. How about --compression-variant ?

Hm ... there is already a podman push --compress XXX flag. We could allow specifying it more than once such that a --compress gzip --compress zstd would work?

@flouthoc
Copy link
Collaborator Author

flouthoc commented Jul 27, 2023

--ensure-compression sounds more like a validation check to me

Ah my idea was that flag will ensure that manifest list contains the compression, if it is not there it will create one. How about --compression-variant ?

Hm ... there is already a podman push --compress XXX flag. We could allow specifying it more than once such that a --compress gzip --compress zstd would work?

@vrothberg Technically --compress is a different function, it means replacing existing instance with a new compression, it does not means keeping the old compression and adding new in manifest list ( it works with single instance as well not only manifest list ). Changing behavior of --compress sounds like a breaking change. I'd prefer keeping this different from legacy --compression and adding a new command instead.

@flouthoc
Copy link
Collaborator Author

I found a few, does any one of these appeal ?

(--copy-compression, --append-compression , --extend-compression, --add-compression)

@vrothberg
Copy link
Member

Very fair point, @flouthoc. In that case, I really like --add-compression

@flouthoc
Copy link
Collaborator Author

--add-compression is fairly simple and communicates what operation is doing.

@giuseppe @mtrmac @rhatdan WDYT ?

@giuseppe
Copy link
Member

I like --add-compression

`c/image` recently added support for EnsureCompressionVariantsExist,
following PR exposes the feature to `c/common` manifests so actual users
can use it.

Signed-off-by: Aditya R <arajan@redhat.com>
@flouthoc flouthoc force-pushed the implement-ensure-compression-exsts branch from 93f7f8d to 44dacb8 Compare July 27, 2023 08:21
@flouthoc flouthoc changed the title manifests,push: add support for ReplicateWithCompression manifests,push: add support for AddCompression Jul 27, 2023
Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

LGTM

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 27, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: flouthoc, vrothberg

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

@rhatdan
Copy link
Member

rhatdan commented Jul 27, 2023

/lgtm

@openshift-merge-robot openshift-merge-robot merged commit 647ed1d into containers:main Jul 27, 2023
7 checks passed
@flouthoc
Copy link
Collaborator Author

flouthoc commented Jul 27, 2023

@mtrmac Following PR is merged, do we need to change option name in c/image as well ?

@mtrmac
Copy link
Collaborator

mtrmac commented Jul 27, 2023

My first instinct is that --add-compression is a good choice for the CLI, a good compromise between the competing requirements (brevity is quite important) but in the API, with IDE autocompletion, using a more precise name is a bit more valuable.

I don’t feel too strongly about that, though.

@flouthoc
Copy link
Collaborator Author

Fair enough leaving c/image as-is.

flouthoc added a commit to flouthoc/common that referenced this pull request Jul 31, 2023
Podman uses different API for pushing manifest list,
add `AddCompression` to ManifestPushOptions, which is implemented
here: containers#1585

[NO NEW TESTS NEEDED]
Tests are added here: containers#1585

Signed-off-by: Aditya R <arajan@redhat.com>
flouthoc added a commit to flouthoc/common that referenced this pull request Aug 1, 2023
Podman uses different API for pushing manifest list,
add `AddCompression` to ManifestPushOptions, which is implemented
here: containers#1585

[NO NEW TESTS NEEDED]
Tests are added here: containers#1585

Signed-off-by: Aditya R <arajan@redhat.com>
flouthoc added a commit to flouthoc/common that referenced this pull request Aug 1, 2023
Podman uses different API for pushing manifest list,
add `AddCompression` to ManifestPushOptions, which is implemented
here: containers#1585

[NO NEW TESTS NEEDED]
Tests are added here: containers#1585

Signed-off-by: Aditya R <arajan@redhat.com>
flouthoc added a commit to flouthoc/common that referenced this pull request Aug 4, 2023
Podman uses different API for pushing manifest list,
add `AddCompression` to ManifestPushOptions, which is implemented
here: containers#1585

[NO NEW TESTS NEEDED]
Tests are added here: containers#1585

Signed-off-by: Aditya R <arajan@redhat.com>
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.

None yet

6 participants