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

Add builder OCI layout build context #3327

Conversation

austinvazquez
Copy link
Member

@austinvazquez austinvazquez commented Aug 18, 2024

Description

This change adds building images with OCI layout build contexts.

Testing

  • Added unit tests
    • Negative test cases
  • Added integration test (Linux only)
    • Test requires build functionality which excludes Windows platform testing.

Additional references

@austinvazquez austinvazquez marked this pull request as ready for review August 18, 2024 17:53
)

func TestBuildContextWithOCILayout(t *testing.T) {
testutil.DockerIncompatible(t)
Copy link
Member

Choose a reason for hiding this comment

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

Please add a comment to explain this

@austinvazquez austinvazquez force-pushed the feat-add-builder-build-oci-layout-build-context branch from e29ea5c to 36beb7c Compare August 19, 2024 05:34
)

func TestBuildContextWithOCILayout(t *testing.T) {
// Docker driver does not support OCI exporter.
Copy link
Member

Choose a reason for hiding this comment

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

docker buildx build supports it though

Copy link
Member Author

@austinvazquez austinvazquez Aug 19, 2024

Choose a reason for hiding this comment

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

Thanks @AkihiroSuda, that helped me figure out my issue. I needed to setup a docker-container builder in order to be able to build the OCI tarball.

@austinvazquez austinvazquez force-pushed the feat-add-builder-build-oci-layout-build-context branch 2 times, most recently from ade08c6 to f2e337a Compare August 19, 2024 15:46
@austinvazquez
Copy link
Member Author

Looks like my test needs a little more bake time. Looking into it now.

@austinvazquez austinvazquez force-pushed the feat-add-builder-build-oci-layout-build-context branch from f2e337a to a11a63c Compare August 19, 2024 16:37
@austinvazquez
Copy link
Member Author

Got it. Just forgot to tag the image before running. Test now passes on nerdctl and Docker.

@austinvazquez austinvazquez force-pushed the feat-add-builder-build-oci-layout-build-context branch from a11a63c to 669e810 Compare August 19, 2024 17:06
@AkihiroSuda AkihiroSuda added this to the v2.0.0 milestone Aug 20, 2024
pkg/cmd/builder/build.go Outdated Show resolved Hide resolved
pkg/cmd/builder/build.go Outdated Show resolved Hide resolved
@apostasie
Copy link
Contributor

@austinvazquez left a few comments / nits, but otherwise looks fine.

@austinvazquez
Copy link
Member Author

Thanks @apostasie, taking a look now. :)

@austinvazquez austinvazquez force-pushed the feat-add-builder-build-oci-layout-build-context branch 5 times, most recently from bedfd3f to 03fbad3 Compare August 21, 2024 02:46
go.mod Outdated
@@ -34,6 +34,7 @@ require (
github.com/coreos/go-iptables v0.7.0
github.com/coreos/go-systemd/v22 v22.5.0
github.com/cyphar/filepath-securejoin v0.3.1
github.com/distribution/distribution v2.8.3+incompatible
Copy link
Member

Choose a reason for hiding this comment

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

This dependency should not be needed


var digest string
for _, manifest := range ociIndex.Manifests {
if manifest.MediaType == schema2.MediaTypeManifest || manifest.MediaType == ocispec.MediaTypeImageManifest {
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

🙌🏼

Copy link
Member Author

@austinvazquez austinvazquez Aug 21, 2024

Choose a reason for hiding this comment

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

Thanks @AkihiroSuda, pushed the change to use containerd images pkg. Even found a helper function to call in place of the logic I pushed before.

Signed-off-by: Austin Vazquez <macedonv@amazon.com>
@austinvazquez austinvazquez force-pushed the feat-add-builder-build-oci-layout-build-context branch from 03fbad3 to 1201665 Compare August 21, 2024 03:34
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Thanks

@AkihiroSuda AkihiroSuda merged commit de16ae6 into containerd:main Aug 22, 2024
21 checks passed
@austinvazquez austinvazquez deleted the feat-add-builder-build-oci-layout-build-context branch August 22, 2024 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants