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

oci/client: pull any artifact #653

Merged
merged 3 commits into from
Sep 27, 2023

Conversation

errordeveloper
Copy link
Contributor

@errordeveloper errordeveloper commented Sep 22, 2023

Allow flux pull artifact to retrieve any kind of OCI artifact without an index, e.g. a Helm chart for debugging.

@stefanprodan stefanprodan added the area/oci OCI related issues and pull requests label Sep 22, 2023
@errordeveloper errordeveloper force-pushed the pull-any-artifact branch 2 times, most recently from b70d673 to 9018b11 Compare September 22, 2023 13:37
oci/client/client.go Outdated Show resolved Hide resolved
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

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

Can we have a test that proves "pull any artifact"? Maybe push something with crane in tests, no annotations from empty base and test pull.

@errordeveloper errordeveloper force-pushed the pull-any-artifact branch 2 times, most recently from e8e8ee9 to ff2d0b6 Compare September 26, 2023 12:44
@errordeveloper
Copy link
Contributor Author

@stefanprodan I added a simple test, PTAL :)

This is in order to allow `flux pull artifact` to retrieve any kind
of OCI artifact, e.g. a Helm chart for debugging.

Signed-off-by: Ilya Dmitrichenko <errordeveloper@gmail.com>
In OCI terms having platform `flux/flux/v2` implies that the image
is runnable on some OS called "flux" on architecture called "flux".
In reality there is no such platform and there is no good reason
for Flux to pretend. OCI 1.1 (albeit still and RC at the moment),
doesn't mandate artifact to define a platform at all.

When client is constructed with a platform selector, many functions
will apply the selector, which is often undesirable.

The `flux/flux/v2` platform was only defined in client options, so
it wasn't set on any images and is safe to drop; source-controller
doesn't use `DefaultOptions`, so there is no concern.

Another inconvenient behaviour of GGCR is that some functions will pick
just the very first element that matches the platform and ignore any
additional elements, e.g. elements with same platform, but different
media type. That behaviour prevents searching for artefacts by media
type.

Signed-off-by: Ilya Dmitrichenko <errordeveloper@gmail.com>
Signed-off-by: Ilya Dmitrichenko <errordeveloper@gmail.com>
Copy link
Member

@stefanprodan stefanprodan 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 @errordeveloper 🏅

@stefanprodan stefanprodan merged commit 4f69e78 into fluxcd:main Sep 27, 2023
13 checks passed
@errordeveloper errordeveloper deleted the pull-any-artifact branch September 27, 2023 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/oci OCI related issues and pull requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants