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

[Bug]: Error uploading OCI artifact to AWS ECR #2907

Closed
1 task done
thepabloaguilar opened this issue Mar 27, 2024 · 3 comments · Fixed by #2908
Closed
1 task done

[Bug]: Error uploading OCI artifact to AWS ECR #2907

thepabloaguilar opened this issue Mar 27, 2024 · 3 comments · Fixed by #2908
Labels

Comments

@thepabloaguilar
Copy link
Contributor

Bug Description

The bug is happening because when sending the artifact using flitp bundle push ... oras-go is setting the media type to application/vnd.oci.image.manifest.v1+json even flipt putting the value to application/vnd.io.flipt.features.v1 when creating the bundle artifact!

And the problem is, AWS will reject the bundle because it'll not be compliant with a Docker image as they states here:

The [OCI artifact specification](https://github.com/opencontainers/artifacts/blob/master/artifact-authors.md) defines artifact types, akin to file extensions, represented by the config.mediaType field of a manifest. For example, an OCI image, that is, something that you can use in Amazon EKS or Amazon ECS, would have a value of application/vnd.oci.image.config.v1+json. Custom types can also be defined, following the format:

Source: OCI Artifact Support In Amazon ECR

Looking at the Oras documentation we can also see this problem can happen with Azure Container Registry too because AWS and Azure are the only ones where the examples explicit says to provide the --artifact-type option!

Source: Compatible OCI Registries

Version Info

The latest, I'm using the current commit from the main 😄

Search

  • I searched for other open and closed issues before opening this

Steps to Reproduce

flipt bundle local:version
flipt push local: local aws_account_id.dkr.ecr.us-west-2.amazonaws.com/local:version
# Error: PUT "https://aws_account_id.dkr.ecr/.us-west-2.[amazonaws.com/v2/local/manifests/version](https://amazonaws.com/v2/local/manifests/version)": response status code 405: unsupported: Invalid parameter at 'ImageManifest' failed to satisfy constraint: 'Invalid JSON syntax'

Expected Behavior

No error when using AWS ECR or Azure Container Registry! For that we must also set the media type when sending the artifact to any OCI registry.

Additional Context

I'm already working on a fix for this!

@thepabloaguilar
Copy link
Contributor Author

Btw, I've discovered the value for the media type by changing the Store.Copy method to use a custom CopyOptions!

desc, err := oras.Copy(
	ctx,
	srcTarget,
	src.Reference.Reference,
	dstTarget,
	dst.Reference.Reference,
	oras.CopyOptions{
		CopyGraphOptions: oras.DefaultCopyGraphOptions,
		MapRoot: func(ctx context.Context, src content.ReadOnlyStorage, root v1.Descriptor) (v1.Descriptor, error) {
			fmt.Println(root.MediaType)
			return root, nil
		},
	},
)

@thepabloaguilar
Copy link
Contributor Author

Ok, that's not the error! The real error is, AWS ECR does not support the Manifest 1.1 only the 1.0!

@GeorgeMac
Copy link
Contributor

Great investigation @thepabloaguilar ! Checking out your PR now.

@kodiakhq kodiakhq bot closed this as completed in #2908 Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants