diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8043348..1403bd6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -25,7 +25,7 @@ on: jobs: lint-and-test: name: Lint and Test - runs-on: ubuntu-latest + runs-on: ubuntu-26.04 steps: - name: Set up Go uses: actions/setup-go@v5 @@ -49,7 +49,7 @@ jobs: strategy: matrix: include: - - os: ubuntu-latest + - os: ubuntu-26.04 target: linux - os: windows-latest target: windows @@ -69,11 +69,11 @@ jobs: - name: Build run: make ${{ matrix.target }} - name: Build Docker Image - if: matrix.os == 'ubuntu-latest' + if: matrix.os == 'ubuntu-26.04' run: make docker build: name: Build - runs-on: ubuntu-latest + runs-on: ubuntu-26.04 needs: - lint-and-test - build-platform @@ -81,4 +81,4 @@ jobs: - name: Check out code into the Go module directory uses: actions/checkout@v4 - name: Result - run: echo "Lint and Test, Build (ubuntu-latest), Build (windows-latest), Build (macos-latest) completed successfully!" + run: echo "Lint and Test, Build (ubuntu-26.04), Build (windows-latest), Build (macos-latest) completed successfully!" diff --git a/.github/workflows/e2e-test.yaml b/.github/workflows/e2e-test.yaml index 7333655..76b1a04 100644 --- a/.github/workflows/e2e-test.yaml +++ b/.github/workflows/e2e-test.yaml @@ -66,5 +66,8 @@ jobs: - name: Run KinD E2E Test run: make e2e-test-kind + - name: Run KinD containerd 1.7 E2E Test + run: make e2e-test-kind-containerd-1.7 + - name: Run KinD Collect-on-Failure E2E Test run: make e2e-test-kind-collect diff --git a/CHANGES.md b/CHANGES.md index bbb60ec..b0331cb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,7 +9,7 @@ Unreleased * Upgrade Go dependencies affected by known security advisories: `golang.org/x/crypto`, `github.com/containerd/containerd/v2`, `google.golang.org/grpc`, `github.com/moby/go-archive`, `github.com/moby/spdystream`, `github.com/moby/buildkit`, and the OpenTelemetry SDK and OTLP trace exporters. * Upgrade `testcontainers-go` to v0.44.0 so Docker Compose no longer imports a BuildKit package removed in the patched release. * Use `github.com/moby/moby/client` for Docker Engine API calls. `github.com/docker/docker` has no patched release for its advisories. -* Fix `setup.kind.import-images` failing with `ctr: content digest ... not found` when Docker uses the containerd image store (the default from Docker 29, e.g. on `ubuntu-26.04` runners). Images are now saved for the kind nodes' platform and loaded with `kind load image-archive`; Docker with the classic image store keeps `kind load docker-image`. +* Fix `setup.kind.import-images` failing when Docker uses the containerd image store (the default from Docker 29, e.g. on `ubuntu-26.04` runners). Images are now saved for the kind nodes' platform, so a multi-platform image no longer fails with `ctr: content digest ... not found`, and the referrers saved beside an image, such as its attestations and their signatures, are removed from the archive's top-level index: a containerd 1.7 node (node images built by kind v0.20 to v0.26) otherwise imports each one as an image and fails with `ctr: mismatched image rootfs and manifest layers`. The archive is loaded with `kind load image-archive`; Docker with the classic image store keeps `kind load docker-image`. 1.4.0 ------------------ diff --git a/Makefile b/Makefile index 141c4d0..9f7b78d 100644 --- a/Makefile +++ b/Makefile @@ -124,6 +124,12 @@ e2e-test-kind: printf 'FROM busybox:1.37.0\n' | docker build -t skywalking-infra-e2e/kind-local:test - ./bin/$(GOOS)/$(PROJECT) run -c ./test/e2e/kind/e2e.yaml +.PHONY: e2e-test-kind-containerd-1.7 +# Run E2E test with KinD on a containerd 1.7 node (kind v0.25's kindest/node:v1.28.15) +e2e-test-kind-containerd-1.7: + $(MAKE) $(GOOS) + ./bin/$(GOOS)/$(PROJECT) run -c ./test/e2e/kind/containerd-1.7/e2e.yaml + .PHONY: e2e-test-kind-collect # Run E2E test with KinD to verify collect-on-failure functionality # This test intentionally fails verification to trigger file collection. diff --git a/go.mod b/go.mod index 070a827..e9891dd 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/containerd/platforms v1.0.0-rc.4 github.com/google/go-cmp v0.7.0 github.com/moby/moby/client v0.5.0 + github.com/opencontainers/go-digest v1.0.0 github.com/opencontainers/image-spec v1.1.1 github.com/pterm/pterm v0.12.45 github.com/sirupsen/logrus v1.9.4 @@ -139,7 +140,6 @@ require ( github.com/morikuni/aec v1.1.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect - github.com/opencontainers/go-digest v1.0.0 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.4.1 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect diff --git a/internal/components/setup/kind_image.go b/internal/components/setup/kind_image.go index 4e5d367..e882be1 100644 --- a/internal/components/setup/kind_image.go +++ b/internal/components/setup/kind_image.go @@ -45,10 +45,11 @@ const ( // loadDockerImage runs `kind load docker-image`: kind saves the whole image // and the nodes import it with `ctr images import --all-platforms`. loadDockerImage imageLoadMode = iota - // loadPlatformArchive saves only the platform of the kind nodes, then runs - // `kind load image-archive`. With docker's containerd image store, a pulled - // multi-platform image only holds the content of the platform it was pulled - // for, so importing all of its platforms fails with + // loadPlatformArchive saves only the platform of the kind nodes, leaves the + // referrers of the image, such as attestations, out of the archive, then + // runs `kind load image-archive`. With docker's containerd image store, a + // pulled multi-platform image only holds the content of the platform it was + // pulled for, so importing all of its platforms fails with // "content digest ... not found" (kubernetes-sigs/kind#3795). loadPlatformArchive ) @@ -145,8 +146,8 @@ func importImages(ctx context.Context, images []string, clusterName string) erro return nil } -// loadImageArchive saves the platform of the image to a temporary archive and -// loads it with `kind load image-archive`. +// loadImageArchive saves the platform of the image to a temporary archive, +// without its referrers, and loads it with `kind load image-archive`. func loadImageArchive(ctx context.Context, cli *docker.Client, image string, platform ocispec.Platform, clusterName string) error { archive, err := os.CreateTemp(util.WorkDir, "kind-image-*.tar") if err != nil { @@ -165,6 +166,13 @@ func loadImageArchive(ctx context.Context, cli *docker.Client, image string, pla if err := archive.Close(); err != nil { return fmt.Errorf("write image archive error: %w", err) } + dropped, err := dropReferrers(archive.Name()) + if err != nil { + return err + } + if dropped > 0 { + logger.Log.Infof("left %d referrer(s) of %s, such as attestations, out of the archive", dropped, image) + } return runKindLoad("load", "image-archive", archive.Name(), "--name", clusterName) } diff --git a/internal/components/setup/kind_image_archive.go b/internal/components/setup/kind_image_archive.go new file mode 100644 index 0000000..7bb885f --- /dev/null +++ b/internal/components/setup/kind_image_archive.go @@ -0,0 +1,187 @@ +// Licensed to Apache Software Foundation (ASF) under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Apache Software Foundation (ASF) licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +package setup + +import ( + "archive/tar" + "bytes" + "encoding/json" + "errors" + "fmt" + "io" + "os" + "path/filepath" + "strings" + + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +const ( + ociIndexFile = "index.json" + // manifestSubjectAnnotation marks a top-level descriptor of an image archive + // as a referrer of another manifest, such as an attestation or a signature. + manifestSubjectAnnotation = "io.containerd.manifest.subject" + imageNameAnnotation = "io.containerd.image.name" +) + +// dropReferrers removes the referrers from the top-level index of an image +// archive saved by docker, and leaves the archive untouched when it has none. +// +// docker's containerd image store saves the referrers of an image, such as its +// attestations and their signatures, beside it in the top-level index, marked +// with manifestSubjectAnnotation. kind imports the archive with `ctr images +// import --all-platforms --digests`: containerd 1.7 (node images built by kind +// v0.20 to v0.26) creates an image for every top-level descriptor and unpacks +// it, and as a referrer has no filesystem layers, the import fails with +// "mismatched image rootfs and manifest layers"; containerd 2 only unpacks +// manifests that have filesystem layers. A descriptor that names an image is +// kept even when marked. The blobs of the referrers stay in the archive, +// unreferenced. +func dropReferrers(path string) (int, error) { + data, err := readArchiveFile(path, ociIndexFile) + if err != nil || data == nil { + return 0, err + } + var index map[string]json.RawMessage + if err := json.Unmarshal(data, &index); err != nil { + return 0, fmt.Errorf("parse %s of the image archive error: %w", ociIndexFile, err) + } + var manifests []json.RawMessage + if raw, ok := index["manifests"]; ok { + if err := json.Unmarshal(raw, &manifests); err != nil { + return 0, fmt.Errorf("parse %s of the image archive error: %w", ociIndexFile, err) + } + } + + // The kept descriptors are copied as saved, so no field of theirs is lost. + kept := make([]json.RawMessage, 0, len(manifests)) + for _, m := range manifests { + var desc struct { + Annotations map[string]string `json:"annotations"` + } + if err := json.Unmarshal(m, &desc); err != nil { + return 0, fmt.Errorf("parse %s of the image archive error: %w", ociIndexFile, err) + } + _, referrer := desc.Annotations[manifestSubjectAnnotation] + _, named := desc.Annotations[imageNameAnnotation] + _, refNamed := desc.Annotations[ocispec.AnnotationRefName] + if !referrer || named || refNamed { + kept = append(kept, m) + } + } + dropped := len(manifests) - len(kept) + if dropped == 0 { + return 0, nil + } + + if index["manifests"], err = json.Marshal(kept); err != nil { + return 0, err + } + newIndex, err := json.Marshal(index) + if err != nil { + return 0, err + } + return dropped, rewriteArchiveFile(path, ociIndexFile, newIndex) +} + +// readArchiveFile returns the content of a file in a tar archive, or nil when +// the archive does not have it. +func readArchiveFile(path, name string) ([]byte, error) { + f, err := os.Open(path) + if err != nil { + return nil, fmt.Errorf("open image archive error: %w", err) + } + defer func() { + _ = f.Close() + }() + tr := tar.NewReader(f) + for { + hdr, err := tr.Next() + if errors.Is(err, io.EOF) { + return nil, nil + } + if err != nil { + return nil, fmt.Errorf("read image archive error: %w", err) + } + if strings.TrimPrefix(hdr.Name, "./") == name { + data, err := io.ReadAll(tr) + if err != nil { + return nil, fmt.Errorf("read %s of the image archive error: %w", name, err) + } + return data, nil + } + } +} + +// rewriteArchiveFile replaces the content of one file of a tar archive, copying +// every other entry as it is. +func rewriteArchiveFile(path, name string, content []byte) error { + dst, err := os.CreateTemp(filepath.Dir(path), filepath.Base(path)+".*") + if err != nil { + return fmt.Errorf("create image archive error: %w", err) + } + err = copyArchive(path, dst, name, content) + if closeErr := dst.Close(); err == nil && closeErr != nil { + err = fmt.Errorf("write image archive error: %w", closeErr) + } + // Both archives are closed by now: Windows cannot replace an open file. + if err == nil { + err = os.Rename(dst.Name(), path) + } + if err != nil { + _ = os.Remove(dst.Name()) + } + return err +} + +func copyArchive(path string, dst io.Writer, name string, content []byte) error { + src, err := os.Open(path) + if err != nil { + return fmt.Errorf("open image archive error: %w", err) + } + defer func() { + _ = src.Close() + }() + tr := tar.NewReader(src) + tw := tar.NewWriter(dst) + for { + hdr, err := tr.Next() + if errors.Is(err, io.EOF) { + break + } + if err != nil { + return fmt.Errorf("read image archive error: %w", err) + } + var body io.Reader = tr + if strings.TrimPrefix(hdr.Name, "./") == name { + hdr.Size = int64(len(content)) + body = bytes.NewReader(content) + } + if err := tw.WriteHeader(hdr); err != nil { + return fmt.Errorf("write image archive error: %w", err) + } + if _, err := io.Copy(tw, body); err != nil { + return fmt.Errorf("write image archive error: %w", err) + } + } + if err := tw.Close(); err != nil { + return fmt.Errorf("write image archive error: %w", err) + } + return nil +} diff --git a/internal/components/setup/kind_image_archive_test.go b/internal/components/setup/kind_image_archive_test.go new file mode 100644 index 0000000..3e7d40e --- /dev/null +++ b/internal/components/setup/kind_image_archive_test.go @@ -0,0 +1,242 @@ +// Licensed to Apache Software Foundation (ASF) under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Apache Software Foundation (ASF) licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +package setup + +import ( + "archive/tar" + "bytes" + "encoding/json" + "errors" + "io" + "os" + "path/filepath" + "strconv" + "testing" + + "github.com/opencontainers/go-digest" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +type archiveEntry struct { + name string + data []byte +} + +func blobEntry(t *testing.T, v any) (archiveEntry, ocispec.Descriptor) { + t.Helper() + data, err := json.Marshal(v) + if err != nil { + t.Fatal(err) + } + d := digest.FromBytes(data) + return archiveEntry{name: "blobs/sha256/" + d.Encoded(), data: data}, + ocispec.Descriptor{MediaType: ocispec.MediaTypeImageManifest, Digest: d, Size: int64(len(data))} +} + +func writeArchive(t *testing.T, entries []archiveEntry) string { + t.Helper() + path := filepath.Join(t.TempDir(), "image.tar") + var buf bytes.Buffer + tw := tar.NewWriter(&buf) + for _, e := range entries { + if err := tw.WriteHeader(&tar.Header{Name: e.name, Mode: 0o644, Size: int64(len(e.data))}); err != nil { + t.Fatal(err) + } + if _, err := tw.Write(e.data); err != nil { + t.Fatal(err) + } + } + if err := tw.Close(); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(path, buf.Bytes(), 0o600); err != nil { + t.Fatal(err) + } + return path +} + +func readArchive(t *testing.T, path string) map[string][]byte { + t.Helper() + f, err := os.Open(path) + if err != nil { + t.Fatal(err) + } + defer f.Close() + files := map[string][]byte{} + tr := tar.NewReader(f) + for { + hdr, err := tr.Next() + if errors.Is(err, io.EOF) { + return files + } + if err != nil { + t.Fatal(err) + } + data, err := io.ReadAll(tr) + if err != nil { + t.Fatal(err) + } + files[hdr.Name] = data + } +} + +// savedImage is an archive shaped like `docker save --platform` writes with the +// containerd image store: the platform manifest, named, then its attestation +// and the attestation's signature, both marked as referrers. +func savedImage(t *testing.T) (path string, image json.RawMessage, entries []archiveEntry) { + t.Helper() + imageBlob, imageDesc := blobEntry(t, ocispec.Manifest{ + MediaType: ocispec.MediaTypeImageManifest, + Layers: []ocispec.Descriptor{{MediaType: ocispec.MediaTypeImageLayerGzip, Digest: digest.FromString("layer"), Size: 5}}, + }) + attestationBlob, attestation := blobEntry(t, ocispec.Manifest{ + MediaType: ocispec.MediaTypeImageManifest, + Layers: []ocispec.Descriptor{{MediaType: "application/vnd.in-toto+json", Digest: digest.FromString("provenance"), Size: 10}}, + }) + attestation.Annotations = map[string]string{manifestSubjectAnnotation: imageDesc.Digest.String()} + signatureBlob, signature := blobEntry(t, ocispec.Manifest{ + MediaType: ocispec.MediaTypeImageManifest, + Layers: []ocispec.Descriptor{{MediaType: "application/vnd.dev.cosign.simplesigning.v1+json", Digest: digest.FromString("payload"), Size: 7}}, + }) + signature.ArtifactType = "application/vnd.dev.cosign.artifact.sig.v1+json" + signature.Annotations = map[string]string{manifestSubjectAnnotation: attestation.Digest.String()} + + // A field ocispec.Descriptor does not know, which must survive the rewrite. + image = json.RawMessage(`{"mediaType":"` + ocispec.MediaTypeImageManifest + `","digest":"` + imageDesc.Digest.String() + + `","size":` + strconv.FormatInt(imageDesc.Size, 10) + `,"annotations":{"` + imageNameAnnotation + `":"ghcr.io/example/app:1",` + + `"` + ocispec.AnnotationRefName + `":"1"},"platform":{"architecture":"amd64","os":"linux"},"x-extension":true}`) + index, err := json.Marshal(map[string]any{ + "schemaVersion": 2, + "mediaType": ocispec.MediaTypeImageIndex, + "manifests": []any{image, attestation, signature}, + }) + if err != nil { + t.Fatal(err) + } + entries = []archiveEntry{ + imageBlob, + attestationBlob, + signatureBlob, + {name: "oci-layout", data: []byte(`{"imageLayoutVersion":"1.0.0"}`)}, + {name: "manifest.json", data: []byte(`[{"Config":"blobs/sha256/x","RepoTags":["ghcr.io/example/app:1"],"Layers":[]}]`)}, + {name: ociIndexFile, data: index}, + } + return writeArchive(t, entries), image, entries +} + +func TestDropReferrers(t *testing.T) { + path, image, entries := savedImage(t) + dropped, err := dropReferrers(path) + if err != nil { + t.Fatal(err) + } + if dropped != 2 { + t.Fatalf("dropped = %d, want 2", dropped) + } + files := readArchive(t, path) + var index map[string]json.RawMessage + if err := json.Unmarshal(files[ociIndexFile], &index); err != nil { + t.Fatal(err) + } + var manifests []json.RawMessage + if err := json.Unmarshal(index["manifests"], &manifests); err != nil { + t.Fatal(err) + } + if len(manifests) != 1 || !bytes.Equal(manifests[0], image) { + t.Fatalf("manifests = %s, want only the image %s", index["manifests"], image) + } + if string(index["schemaVersion"]) != "2" || string(index["mediaType"]) != `"`+ocispec.MediaTypeImageIndex+`"` { + t.Errorf("index fields changed: %s", files[ociIndexFile]) + } + for _, e := range entries { + if e.name == ociIndexFile { + continue + } + if !bytes.Equal(files[e.name], e.data) { + t.Errorf("%s changed", e.name) + } + } + left, err := os.ReadDir(filepath.Dir(path)) + if err != nil { + t.Fatal(err) + } + if len(left) != 1 { + t.Errorf("the rewrite left files behind: %v", left) + } +} + +func TestDropReferrersKeepsNamedImages(t *testing.T) { + subject := digest.FromString("subject").String() + descriptor := func(name string, annotations map[string]string) ocispec.Descriptor { + return ocispec.Descriptor{MediaType: ocispec.MediaTypeImageManifest, Digest: digest.FromString(name), Size: 1, Annotations: annotations} + } + named := descriptor("named", map[string]string{imageNameAnnotation: "ghcr.io/example/app:1", manifestSubjectAnnotation: subject}) + refNamed := descriptor("ref-named", map[string]string{ocispec.AnnotationRefName: "2", manifestSubjectAnnotation: subject}) + referrer := descriptor("referrer", map[string]string{manifestSubjectAnnotation: named.Digest.String()}) + index, err := json.Marshal(ocispec.Index{Manifests: []ocispec.Descriptor{named, refNamed, referrer}}) + if err != nil { + t.Fatal(err) + } + path := writeArchive(t, []archiveEntry{{name: ociIndexFile, data: index}}) + dropped, err := dropReferrers(path) + if err != nil || dropped != 1 { + t.Fatalf("dropReferrers() = %d, %v, want 1, nil", dropped, err) + } + var kept ocispec.Index + if err := json.Unmarshal(readArchive(t, path)[ociIndexFile], &kept); err != nil { + t.Fatal(err) + } + if len(kept.Manifests) != 2 || kept.Manifests[0].Digest != named.Digest || kept.Manifests[1].Digest != refNamed.Digest { + t.Fatalf("manifests = %+v, want the two named ones", kept.Manifests) + } +} + +func TestDropReferrersLeavesOtherArchivesUntouched(t *testing.T) { + imageBlob, image := blobEntry(t, ocispec.Manifest{ + MediaType: ocispec.MediaTypeImageManifest, + Layers: []ocispec.Descriptor{{MediaType: ocispec.MediaTypeImageLayerGzip, Digest: digest.FromString("layer"), Size: 5}}, + }) + index, err := json.Marshal(ocispec.Index{Manifests: []ocispec.Descriptor{image}}) + if err != nil { + t.Fatal(err) + } + for name, entries := range map[string][]archiveEntry{ + "no referrers": {imageBlob, {name: ociIndexFile, data: index}}, + "docker legacy format": {{name: "manifest.json", data: []byte(`[]`)}}, + } { + t.Run(name, func(t *testing.T) { + path := writeArchive(t, entries) + before, err := os.ReadFile(path) + if err != nil { + t.Fatal(err) + } + dropped, err := dropReferrers(path) + if err != nil || dropped != 0 { + t.Fatalf("dropReferrers() = %d, %v, want 0, nil", dropped, err) + } + after, err := os.ReadFile(path) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(before, after) { + t.Error("the archive changed") + } + }) + } +} diff --git a/test/e2e/kind/containerd-1.7/e2e.yaml b/test/e2e/kind/containerd-1.7/e2e.yaml new file mode 100644 index 0000000..db05f50 --- /dev/null +++ b/test/e2e/kind/containerd-1.7/e2e.yaml @@ -0,0 +1,46 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Tests import-images into a containerd 1.7 node with multi-platform images the +# run pulls itself, as projects using infra-e2e do; this failed in real use +# while the test on kind's default node passed. With docker's containerd image +# store, importing every platform of such an image fails with "content digest +# ... not found", and importing its referrers, such as attestations, as images +# fails with "mismatched image rootfs and manifest layers". + +setup: + env: kind + file: kind-cluster.yaml + timeout: 10m + kind: + import-images: + - ghcr.io/apache/skywalking/oap:f34b9c7ef04792fcd48869aaa44c88f2e802ebc4 + - ghcr.io/apache/skywalking-rover/skywalking-rover:79292fe07f17f98f486e0c4471213e1961fb2d1d + # without steps, the setup skips creating the cluster + steps: + - name: list the node + command: kubectl get nodes + +cleanup: + on: always + +verify: + retry: + count: 3 + interval: 5s + cases: + - name: verify the images were imported into the node + query: docker exec containerd17-control-plane crictl images -o json | jq '[.images[].repoTags[]] | map(select(. == "ghcr.io/apache/skywalking/oap:f34b9c7ef04792fcd48869aaa44c88f2e802ebc4" or . == "ghcr.io/apache/skywalking-rover/skywalking-rover:79292fe07f17f98f486e0c4471213e1961fb2d1d")) | length' + expected: expected.yaml diff --git a/test/e2e/kind/containerd-1.7/expected.yaml b/test/e2e/kind/containerd-1.7/expected.yaml new file mode 100644 index 0000000..90debd1 --- /dev/null +++ b/test/e2e/kind/containerd-1.7/expected.yaml @@ -0,0 +1,16 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +2 diff --git a/test/e2e/kind/containerd-1.7/kind-cluster.yaml b/test/e2e/kind/containerd-1.7/kind-cluster.yaml new file mode 100644 index 0000000..bd14b85 --- /dev/null +++ b/test/e2e/kind/containerd-1.7/kind-cluster.yaml @@ -0,0 +1,27 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# kind v0.25's kindest/node:v1.28.15 runs containerd 1.7, as node images built +# by kind v0.20 to v0.26 do. It creates an image for every manifest at the top +# level of an imported archive and unpacks it, referrers such as attestations +# included. kind's default node runs containerd 2, which only unpacks manifests +# that have filesystem layers, so the import test on the default node cannot +# tell. +kind: Cluster +apiVersion: kind.x-k8s.io/v1alpha4 +name: containerd17 +nodes: + - role: control-plane + image: kindest/node:v1.28.15@sha256:a7c05c7ae043a0b8c818f5a06188bc2c4098f6cb59ca7d1856df00375d839251