Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions client/client_export_metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,13 +426,13 @@ func testExportAnnotations(t *testing.T, sb integration.Sandbox) {
"name": target,
"push": "true",
"annotation-index.gio": "generic index opt",
"annotation-index." + ocispecs.AnnotationCreated: created,
"annotation-manifest.gmo": "generic manifest opt",
"annotation-manifest-descriptor.gmdo": "generic manifest descriptor opt",
"annotation-manifest[linux/amd64].mo": "amd64 manifest opt",
"annotation-manifest-descriptor[linux/amd64].mdo": "amd64 manifest descriptor opt",
"annotation-manifest[linux/arm64].mo": "arm64 manifest opt",
"annotation-manifest-descriptor[linux/arm64].mdo": "arm64 manifest descriptor opt",
"annotation-index." + ocispecs.AnnotationCreated: created,
"annotation-manifest.gmo": "generic manifest opt",
"annotation-manifest-descriptor.gmdo": "generic manifest descriptor opt",
"annotation-manifest[linux/amd64].mo": "amd64 manifest opt",
"annotation-manifest-descriptor[linux/amd64].mdo": "amd64 manifest descriptor opt",
"annotation-manifest[linux/arm64/v8].mo": "arm64 manifest opt",
"annotation-manifest-descriptor[linux/arm64/v8].mdo": "arm64 manifest descriptor opt",
},
},
},
Expand Down Expand Up @@ -498,8 +498,8 @@ func testExportAnnotations(t *testing.T, sb integration.Sandbox) {
"annotation-manifest-descriptor.gmdo": "generic manifest descriptor opt",
"annotation-manifest[linux/amd64].mo": "amd64 manifest opt",
"annotation-manifest-descriptor[linux/amd64].mdo": "amd64 manifest descriptor opt",
"annotation-manifest[linux/arm64].mo": "arm64 manifest opt",
"annotation-manifest-descriptor[linux/arm64].mdo": "arm64 manifest descriptor opt",
"annotation-manifest[linux/arm64/v8].mo": "arm64 manifest opt",
"annotation-manifest-descriptor[linux/arm64/v8].mdo": "arm64 manifest descriptor opt",
},
},
},
Expand Down
1 change: 1 addition & 0 deletions exporter/containerimage/exptypes/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func ParseAnnotationKey(result string) (AnnotationKey, bool, error) {
if err != nil {
return AnnotationKey{}, true, err
}
p = platforms.Normalize(p)
ociPlatform = &p
}

Expand Down
32 changes: 32 additions & 0 deletions exporter/containerimage/exptypes/annotations_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package exptypes

import (
"testing"

ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/stretchr/testify/require"
)

func TestParseAnnotationKeyPlatform(t *testing.T) {
for _, tc := range []struct {
platform string
want ocispecs.Platform
}{
{"linux/arm64", ocispecs.Platform{OS: "linux", Architecture: "arm64"}},
{"linux/arm64/v8", ocispecs.Platform{OS: "linux", Architecture: "arm64"}},
{"linux/arm64/8", ocispecs.Platform{OS: "linux", Architecture: "arm64"}},
{"linux/arm64/v9", ocispecs.Platform{OS: "linux", Architecture: "arm64", Variant: "v9"}},
{"linux/arm", ocispecs.Platform{OS: "linux", Architecture: "arm", Variant: "v7"}},
{"linux/arm/v6", ocispecs.Platform{OS: "linux", Architecture: "arm", Variant: "v6"}},
{"linux/arm/v7", ocispecs.Platform{OS: "linux", Architecture: "arm", Variant: "v7"}},
} {
for _, typ := range []string{AnnotationManifest, AnnotationManifestDescriptor} {
t.Run(typ+"/"+tc.platform, func(t *testing.T) {
key, ok, err := ParseAnnotationKey("annotation-" + typ + "[" + tc.platform + "].example")
require.NoError(t, err)
require.True(t, ok)
require.Equal(t, AnnotationKey{Type: typ, Platform: &tc.want, Key: "example"}, key)
})
}
}
}
Loading