diff --git a/docs/12-contribute-to-zarf/2-testing.md b/docs/12-contribute-to-zarf/2-testing.md index 024fd6acda..e36f8a9b47 100644 --- a/docs/12-contribute-to-zarf/2-testing.md +++ b/docs/12-contribute-to-zarf/2-testing.md @@ -29,12 +29,17 @@ make test-e2e ARCH="[amd64|arm64]" APPLIANCE_MODE=true make test-e2e ARCH="[amd64|arm64]" # If you already have everything build, you can run this inside this folder. This lets you customize the test run. -go test ./src/test/... -v -failfast +go test ./src/test/... -v -failfast -count=1 # Let's say you only want to run one test. You would run: -go test ./src/test/... -v -failfast -run TestFooBarBaz +go test ./src/test/... -v -failfast -run TestFooBarBaz -count=1 ``` +:::note +The `-count=1` flag is the idiomatic way to disable +test caching explicitly. +::: + :::note The Zarf binary and built packages are required to be stored in the ./build directory. However, if you intend to run tests locally using 'go test ./...', the zarf-init package must also be present in this directory. ::: diff --git a/src/pkg/oci/pull.go b/src/pkg/oci/pull.go index 15c7417cbf..c109f8efd5 100644 --- a/src/pkg/oci/pull.go +++ b/src/pkg/oci/pull.go @@ -15,6 +15,7 @@ import ( "github.com/defenseunicorns/zarf/src/pkg/layout" "github.com/defenseunicorns/zarf/src/pkg/message" + "github.com/defenseunicorns/zarf/src/pkg/transform" "github.com/defenseunicorns/zarf/src/pkg/utils" "github.com/defenseunicorns/zarf/src/pkg/utils/helpers" "github.com/defenseunicorns/zarf/src/types" @@ -121,8 +122,17 @@ func (o *OrasRemote) LayersFromRequestedComponents(requestedComponents []string) return nil, err } for image := range images { + // use docker's transform lib to parse the image ref + // this properly mirrors the logic within create + refInfo, err := transform.ParseImageRef(image) + if err != nil { + return nil, fmt.Errorf("failed to parse image ref %q: %w", image, err) + } + manifestDescriptor := helpers.Find(index.Manifests, func(layer ocispec.Descriptor) bool { - return layer.Annotations[ocispec.AnnotationBaseImageName] == image + return layer.Annotations[ocispec.AnnotationBaseImageName] == refInfo.Reference || + // A backwards compatibility shim for older Zarf versions that would leave docker.io off of image annotations + (layer.Annotations[ocispec.AnnotationBaseImageName] == refInfo.Path+refInfo.TagOrDigest && refInfo.Host == "docker.io") }) // even though these are technically image manifests, we store them as Zarf blobs