Skip to content

Commit

Permalink
Merge branch 'main' into renovate/all-minor-patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Racer159 authored Oct 24, 2023
2 parents 3904df4 + f88cccd commit d6da610
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
9 changes: 7 additions & 2 deletions docs/12-contribute-to-zarf/2-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
:::
Expand Down
12 changes: 11 additions & 1 deletion src/pkg/oci/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d6da610

Please sign in to comment.