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

remove buildah requirement for the libpod image library #1054

Closed
wants to merge 1 commit into from

Conversation

baude
Copy link
Member

@baude baude commented Jul 6, 2018

if we snip the requirement to use a buildah const in the libpod image library,
we can save something on the order of 85 vendored files in consumers of the
the library.

Signed-off-by: baude bbaude@redhat.com

@mheon
Copy link
Member

mheon commented Jul 6, 2018

LGTM

@@ -83,7 +84,7 @@ func commitCmd(c *cli.Context) error {
return errors.Errorf("messages are only compatible with the docker image format (-f docker)")
}
case "docker":
mimeType = buildah.Dockerv2ImageManifest
mimeType = manifest.DockerV2Schema1MediaType
Copy link
Contributor

Choose a reason for hiding this comment

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

This is changing the value from ...manifest.v2... to ...manifest.v1...:

$ git grep V2S2MediaTypeManifest vendor | grep 'types\.go\|Dockerv2ImageManifest'
vendor/github.com/projectatomic/buildah/docker/types.go:const V2S2MediaTypeManifest = "application/vnd.docker.distribution.manifest.v2+json"
vendor/github.com/projectatomic/buildah/image.go:       Dockerv2ImageManifest = docker.V2S2MediaTypeManifest
$ git grep 'DockerV2Schema1MediaType =' vendor
vendor/github.com/containers/image/manifest/manifest.go:        DockerV2Schema1MediaType = "application/vnd.docker.distribution.manifest.v1+json"

I think you want to use DockerV2Schema2MediaType:

$ git grep 'application/vnd.docker.distribution.manifest.v2' vendor/github.com/containers/image/manifest            
vendor/github.com/containers/image/manifest/manifest.go:        DockerV2Schema2MediaType = "application/vnd.docker.distribution.manifest.v2+json"

(and similarly in the other file).

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch ... fixed ... need caffeine

if we snip the requirement to use a buildah const in the libpod image library,
we can save something on the order of 85 vendored files in consumers of the
the library.

Signed-off-by: baude <bbaude@redhat.com>
@@ -83,7 +84,7 @@ func commitCmd(c *cli.Context) error {
return errors.Errorf("messages are only compatible with the docker image format (-f docker)")
}
case "docker":
mimeType = buildah.Dockerv2ImageManifest
mimeType = manifest.DockerV2Schema1MediaType
Copy link
Member

Choose a reason for hiding this comment

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

I think you want manifest.DockerV2Schema2MediaType here.....

'''
image/manifest/manifest.go
// DockerV2Schema1MediaType MIME type represents Docker manifest schema 1
DockerV2Schema1MediaType = "application/vnd.docker.distribution.manifest.v1+json"
// DockerV2Schema2MediaType MIME type represents Docker manifest schema 2
DockerV2Schema2MediaType = "application/vnd.docker.distribution.manifest.v2+json"

Buildah side
image.go: Dockerv2ImageManifest = docker.V2S2MediaTypeManifest
./docker/types.go:const V2S2MediaTypeManifest = "application/vnd.docker.distribution.manifest.v2+json"

Copy link
Member Author

Choose a reason for hiding this comment

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

yup, @wking pointed this out

@TomSweeneyRedHat
Copy link
Member

Bah! @wking beat me. Change LGTM now. I just wonder if Buildah should also convert to using the constant from container/image too. @nalind any thoughts on that?

@mheon
Copy link
Member

mheon commented Jul 6, 2018

@rh-atomic-bot r+

@rh-atomic-bot
Copy link
Collaborator

📌 Commit 1ce187d has been approved by mheon

@wking
Copy link
Contributor

wking commented Jul 6, 2018

I just wonder if Buildah should also convert to using the constant from container/image too.

Personally, I don't have a problem with hard-coding the media type string wherever it's needed. Zero deps, and not all that many more characters in the Go source. But that is apparently not a popular approach, based on previous discussion in opencontainers/image-spec#320 and opencontainers/image-spec#414 ;).

@rh-atomic-bot
Copy link
Collaborator

⌛ Testing commit 1ce187d with merge 6092955...

@rh-atomic-bot
Copy link
Collaborator

☀️ Test successful - status-papr
Approved by: mheon
Pushing 6092955 to master...

@rhatdan
Copy link
Member

rhatdan commented Jul 7, 2018

@TomSweeneyRedHat Open a PR for buildah to use containers/image as well.

@baude baude deleted the removebuildahreq branch December 22, 2019 19:08
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants