It's an alias for the OCI-spec type, which was only there for
convenience, but will be deprecated.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -22,11 +22,11 @@ import ( |
| 22 | 22 |
|
| 23 | 23 |
type pushTestCase struct {
|
| 24 | 24 |
name string |
| 25 |
- indexPlatforms []platforms.Platform // all platforms supported by the image |
|
| 26 |
- availablePlatforms []platforms.Platform // platforms available locally |
|
| 27 |
- requestPlatform *platforms.Platform // platform requested by the client (not the platform selected for push!) |
|
| 25 |
+ indexPlatforms []ocispec.Platform // all platforms supported by the image |
|
| 26 |
+ availablePlatforms []ocispec.Platform // platforms available locally |
|
| 27 |
+ requestPlatform *ocispec.Platform // platform requested by the client (not the platform selected for push!) |
|
| 28 | 28 |
check func(t *testing.T, img containerdimages.Image, pushDescriptor ocispec.Descriptor, err error) |
| 29 |
- daemonPlatform *platforms.Platform |
|
| 29 |
+ daemonPlatform *ocispec.Platform |
|
| 30 | 30 |
} |
| 31 | 31 |
|
| 32 | 32 |
func TestImagePushIndex(t *testing.T) {
|
| ... | ... |
@@ -52,29 +52,29 @@ func TestImagePushIndex(t *testing.T) {
|
| 52 | 52 |
{
|
| 53 | 53 |
name: "none requested, all present", |
| 54 | 54 |
|
| 55 |
- indexPlatforms: []platforms.Platform{linuxAmd64, darwinArm64, windowsAmd64},
|
|
| 56 |
- availablePlatforms: []platforms.Platform{linuxAmd64, darwinArm64, windowsAmd64},
|
|
| 55 |
+ indexPlatforms: []ocispec.Platform{linuxAmd64, darwinArm64, windowsAmd64},
|
|
| 56 |
+ availablePlatforms: []ocispec.Platform{linuxAmd64, darwinArm64, windowsAmd64},
|
|
| 57 | 57 |
check: wholeIndexSelected, |
| 58 | 58 |
}, |
| 59 | 59 |
{
|
| 60 | 60 |
name: "none requested, one present", |
| 61 | 61 |
|
| 62 |
- indexPlatforms: []platforms.Platform{linuxAmd64, darwinArm64, windowsAmd64},
|
|
| 63 |
- availablePlatforms: []platforms.Platform{linuxAmd64},
|
|
| 62 |
+ indexPlatforms: []ocispec.Platform{linuxAmd64, darwinArm64, windowsAmd64},
|
|
| 63 |
+ availablePlatforms: []ocispec.Platform{linuxAmd64},
|
|
| 64 | 64 |
check: singleManifestSelected(linuxAmd64), |
| 65 | 65 |
}, |
| 66 | 66 |
{
|
| 67 | 67 |
name: "none requested, two present, daemon platform available", |
| 68 | 68 |
|
| 69 |
- indexPlatforms: []platforms.Platform{linuxAmd64, darwinArm64, windowsAmd64},
|
|
| 70 |
- availablePlatforms: []platforms.Platform{linuxAmd64, darwinArm64},
|
|
| 69 |
+ indexPlatforms: []ocispec.Platform{linuxAmd64, darwinArm64, windowsAmd64},
|
|
| 70 |
+ availablePlatforms: []ocispec.Platform{linuxAmd64, darwinArm64},
|
|
| 71 | 71 |
check: singleManifestSelected(linuxAmd64), |
| 72 | 72 |
}, |
| 73 | 73 |
{
|
| 74 | 74 |
name: "none requested, two present, daemon platform NOT available", |
| 75 | 75 |
|
| 76 |
- indexPlatforms: []platforms.Platform{linuxAmd64, darwinArm64, windowsAmd64},
|
|
| 77 |
- availablePlatforms: []platforms.Platform{darwinArm64, windowsAmd64},
|
|
| 76 |
+ indexPlatforms: []ocispec.Platform{linuxAmd64, darwinArm64, windowsAmd64},
|
|
| 77 |
+ availablePlatforms: []ocispec.Platform{darwinArm64, windowsAmd64},
|
|
| 78 | 78 |
check: multipleCandidates, |
| 79 | 79 |
}, |
| 80 | 80 |
|
| ... | ... |
@@ -82,16 +82,16 @@ func TestImagePushIndex(t *testing.T) {
|
| 82 | 82 |
{
|
| 83 | 83 |
name: "linux/amd64 requested, all present", |
| 84 | 84 |
|
| 85 |
- indexPlatforms: []platforms.Platform{linuxAmd64, darwinArm64, windowsAmd64},
|
|
| 86 |
- availablePlatforms: []platforms.Platform{linuxAmd64, darwinArm64, windowsAmd64},
|
|
| 85 |
+ indexPlatforms: []ocispec.Platform{linuxAmd64, darwinArm64, windowsAmd64},
|
|
| 86 |
+ availablePlatforms: []ocispec.Platform{linuxAmd64, darwinArm64, windowsAmd64},
|
|
| 87 | 87 |
requestPlatform: &linuxAmd64, |
| 88 | 88 |
check: singleManifestSelected(linuxAmd64), |
| 89 | 89 |
}, |
| 90 | 90 |
{
|
| 91 | 91 |
name: "linux/amd64 requested, but not present", |
| 92 | 92 |
|
| 93 |
- indexPlatforms: []platforms.Platform{linuxAmd64, darwinArm64, windowsAmd64},
|
|
| 94 |
- availablePlatforms: []platforms.Platform{darwinArm64, windowsAmd64},
|
|
| 93 |
+ indexPlatforms: []ocispec.Platform{linuxAmd64, darwinArm64, windowsAmd64},
|
|
| 94 |
+ availablePlatforms: []ocispec.Platform{darwinArm64, windowsAmd64},
|
|
| 95 | 95 |
requestPlatform: &linuxAmd64, |
| 96 | 96 |
check: candidateNotFound, |
| 97 | 97 |
}, |
| ... | ... |
@@ -100,32 +100,32 @@ func TestImagePushIndex(t *testing.T) {
|
| 100 | 100 |
{
|
| 101 | 101 |
name: "linux/arm/v5 requested, but not in index", |
| 102 | 102 |
|
| 103 |
- indexPlatforms: []platforms.Platform{linuxAmd64, linuxArmv7},
|
|
| 104 |
- availablePlatforms: []platforms.Platform{linuxAmd64, linuxArmv7},
|
|
| 103 |
+ indexPlatforms: []ocispec.Platform{linuxAmd64, linuxArmv7},
|
|
| 104 |
+ availablePlatforms: []ocispec.Platform{linuxAmd64, linuxArmv7},
|
|
| 105 | 105 |
requestPlatform: &linuxArmv5, |
| 106 | 106 |
check: candidateNotFound, |
| 107 | 107 |
}, |
| 108 | 108 |
{
|
| 109 | 109 |
name: "linux/arm/v5 requested, but not available", |
| 110 | 110 |
|
| 111 |
- indexPlatforms: []platforms.Platform{linuxArm64, linuxArmv7, linuxArmv5},
|
|
| 112 |
- availablePlatforms: []platforms.Platform{linuxArm64, linuxArmv7},
|
|
| 111 |
+ indexPlatforms: []ocispec.Platform{linuxArm64, linuxArmv7, linuxArmv5},
|
|
| 112 |
+ availablePlatforms: []ocispec.Platform{linuxArm64, linuxArmv7},
|
|
| 113 | 113 |
requestPlatform: &linuxArmv5, |
| 114 | 114 |
check: candidateNotFound, |
| 115 | 115 |
}, |
| 116 | 116 |
{
|
| 117 | 117 |
name: "linux/arm/v7 requested, but not available", |
| 118 | 118 |
|
| 119 |
- indexPlatforms: []platforms.Platform{linuxArm64, linuxArmv7, linuxArmv5},
|
|
| 120 |
- availablePlatforms: []platforms.Platform{linuxArm64, linuxArmv5},
|
|
| 119 |
+ indexPlatforms: []ocispec.Platform{linuxArm64, linuxArmv7, linuxArmv5},
|
|
| 120 |
+ availablePlatforms: []ocispec.Platform{linuxArm64, linuxArmv5},
|
|
| 121 | 121 |
requestPlatform: &linuxArmv7, |
| 122 | 122 |
check: candidateNotFound, |
| 123 | 123 |
}, |
| 124 | 124 |
{
|
| 125 | 125 |
name: "linux/arm/v7 requested on v7 daemon, but not available", |
| 126 | 126 |
|
| 127 |
- indexPlatforms: []platforms.Platform{linuxArm64, linuxArmv7, linuxArmv5},
|
|
| 128 |
- availablePlatforms: []platforms.Platform{linuxArm64, linuxArmv5},
|
|
| 127 |
+ indexPlatforms: []ocispec.Platform{linuxArm64, linuxArmv7, linuxArmv5},
|
|
| 128 |
+ availablePlatforms: []ocispec.Platform{linuxArm64, linuxArmv5},
|
|
| 129 | 129 |
daemonPlatform: &linuxArmv7, |
| 130 | 130 |
requestPlatform: &linuxArmv7, |
| 131 | 131 |
check: candidateNotFound, |
| ... | ... |
@@ -133,8 +133,8 @@ func TestImagePushIndex(t *testing.T) {
|
| 133 | 133 |
{
|
| 134 | 134 |
name: "linux/arm/v7 requested on v5 daemon, all available", |
| 135 | 135 |
|
| 136 |
- indexPlatforms: []platforms.Platform{linuxArm64, linuxArmv7, linuxArmv5},
|
|
| 137 |
- availablePlatforms: []platforms.Platform{linuxArm64, linuxArmv7, linuxArmv5},
|
|
| 136 |
+ indexPlatforms: []ocispec.Platform{linuxArm64, linuxArmv7, linuxArmv5},
|
|
| 137 |
+ availablePlatforms: []ocispec.Platform{linuxArm64, linuxArmv7, linuxArmv5},
|
|
| 138 | 138 |
daemonPlatform: &linuxArmv5, |
| 139 | 139 |
requestPlatform: &linuxArmv7, |
| 140 | 140 |
check: singleManifestSelected(linuxArmv7), |
| ... | ... |
@@ -142,8 +142,8 @@ func TestImagePushIndex(t *testing.T) {
|
| 142 | 142 |
{
|
| 143 | 143 |
name: "linux/arm/v5 requested on v7 daemon, all available", |
| 144 | 144 |
|
| 145 |
- indexPlatforms: []platforms.Platform{linuxArm64, linuxArmv7, linuxArmv5},
|
|
| 146 |
- availablePlatforms: []platforms.Platform{linuxArm64, linuxArmv7, linuxArmv5},
|
|
| 145 |
+ indexPlatforms: []ocispec.Platform{linuxArm64, linuxArmv7, linuxArmv5},
|
|
| 146 |
+ availablePlatforms: []ocispec.Platform{linuxArm64, linuxArmv7, linuxArmv5},
|
|
| 147 | 147 |
daemonPlatform: &linuxArmv7, |
| 148 | 148 |
requestPlatform: &linuxArmv5, |
| 149 | 149 |
check: singleManifestSelected(linuxArmv5), |
| ... | ... |
@@ -151,8 +151,8 @@ func TestImagePushIndex(t *testing.T) {
|
| 151 | 151 |
{
|
| 152 | 152 |
name: "none requested on v5 daemon, arm64 not available", |
| 153 | 153 |
|
| 154 |
- indexPlatforms: []platforms.Platform{linuxArm64, linuxArmv7, linuxArmv5},
|
|
| 155 |
- availablePlatforms: []platforms.Platform{linuxArmv7, linuxArmv5},
|
|
| 154 |
+ indexPlatforms: []ocispec.Platform{linuxArm64, linuxArmv7, linuxArmv5},
|
|
| 155 |
+ availablePlatforms: []ocispec.Platform{linuxArmv7, linuxArmv5},
|
|
| 156 | 156 |
daemonPlatform: &linuxArmv5, |
| 157 | 157 |
requestPlatform: nil, |
| 158 | 158 |
check: singleManifestSelected(linuxArmv5), |
| ... | ... |
@@ -160,8 +160,8 @@ func TestImagePushIndex(t *testing.T) {
|
| 160 | 160 |
{
|
| 161 | 161 |
name: "none requested on v7 daemon, arm64 not available", |
| 162 | 162 |
|
| 163 |
- indexPlatforms: []platforms.Platform{linuxArm64, linuxArmv7, linuxArmv5},
|
|
| 164 |
- availablePlatforms: []platforms.Platform{linuxArmv7, linuxArmv5},
|
|
| 163 |
+ indexPlatforms: []ocispec.Platform{linuxArm64, linuxArmv7, linuxArmv5},
|
|
| 164 |
+ availablePlatforms: []ocispec.Platform{linuxArmv7, linuxArmv5},
|
|
| 165 | 165 |
daemonPlatform: &linuxArmv7, |
| 166 | 166 |
requestPlatform: nil, |
| 167 | 167 |
check: singleManifestSelected(linuxArmv7), |
| ... | ... |
@@ -169,8 +169,8 @@ func TestImagePushIndex(t *testing.T) {
|
| 169 | 169 |
{
|
| 170 | 170 |
name: "none requested on v7 daemon, v7 not available", |
| 171 | 171 |
|
| 172 |
- indexPlatforms: []platforms.Platform{linuxArm64, linuxArmv7, linuxArmv5},
|
|
| 173 |
- availablePlatforms: []platforms.Platform{linuxArm64, linuxArmv5},
|
|
| 172 |
+ indexPlatforms: []ocispec.Platform{linuxArm64, linuxArmv7, linuxArmv5},
|
|
| 173 |
+ availablePlatforms: []ocispec.Platform{linuxArm64, linuxArmv5},
|
|
| 174 | 174 |
daemonPlatform: &linuxArmv7, |
| 175 | 175 |
requestPlatform: nil, |
| 176 | 176 |
check: singleManifestSelected(linuxArmv5), // Should it fail, because v5 can't be pushed? |
| ... | ... |
@@ -179,8 +179,8 @@ func TestImagePushIndex(t *testing.T) {
|
| 179 | 179 |
{
|
| 180 | 180 |
name: "none requested on v7 daemon, v5 in index but not v7, all present", |
| 181 | 181 |
|
| 182 |
- indexPlatforms: []platforms.Platform{linuxArm64, linuxArmv5},
|
|
| 183 |
- availablePlatforms: []platforms.Platform{linuxArm64, linuxArmv5},
|
|
| 182 |
+ indexPlatforms: []ocispec.Platform{linuxArm64, linuxArmv5},
|
|
| 183 |
+ availablePlatforms: []ocispec.Platform{linuxArm64, linuxArmv5},
|
|
| 184 | 184 |
daemonPlatform: &linuxArmv7, |
| 185 | 185 |
requestPlatform: nil, |
| 186 | 186 |
check: wholeIndexSelected, |
| ... | ... |
@@ -188,8 +188,8 @@ func TestImagePushIndex(t *testing.T) {
|
| 188 | 188 |
{
|
| 189 | 189 |
name: "none requested on v7 daemon, v5 in index but not v7, v5 present", |
| 190 | 190 |
|
| 191 |
- indexPlatforms: []platforms.Platform{linuxArm64, linuxArmv5},
|
|
| 192 |
- availablePlatforms: []platforms.Platform{linuxArmv5},
|
|
| 191 |
+ indexPlatforms: []ocispec.Platform{linuxArm64, linuxArmv5},
|
|
| 192 |
+ availablePlatforms: []ocispec.Platform{linuxArmv5},
|
|
| 193 | 193 |
daemonPlatform: &linuxArmv7, |
| 194 | 194 |
requestPlatform: nil, |
| 195 | 195 |
check: singleManifestSelected(linuxArmv5), |
| ... | ... |
@@ -228,7 +228,7 @@ func TestImagePushIndex(t *testing.T) {
|
| 228 | 228 |
} |
| 229 | 229 |
} |
| 230 | 230 |
|
| 231 |
-func deletePlatform(ctx context.Context, imgSvc *ImageService, img containerdimages.Image, platform platforms.Platform) error {
|
|
| 231 |
+func deletePlatform(ctx context.Context, imgSvc *ImageService, img containerdimages.Image, platform ocispec.Platform) error {
|
|
| 232 | 232 |
var blobs []ocispec.Descriptor |
| 233 | 233 |
pm := platforms.OnlyStrict(platform) |
| 234 | 234 |
err := imgSvc.walkImageManifests(ctx, img, func(im *ImageManifest) error {
|
| ... | ... |
@@ -7,7 +7,7 @@ import ( |
| 7 | 7 |
ocispec "github.com/opencontainers/image-spec/specs-go/v1" |
| 8 | 8 |
) |
| 9 | 9 |
|
| 10 |
-func MultiPlatform(dir string, imageRef string, imagePlatforms []platforms.Platform) (*ocispec.Index, error) {
|
|
| 10 |
+func MultiPlatform(dir string, imageRef string, imagePlatforms []ocispec.Platform) (*ocispec.Index, error) {
|
|
| 11 | 11 |
ref, err := reference.ParseNormalizedNamed(imageRef) |
| 12 | 12 |
if err != nil {
|
| 13 | 13 |
return nil, err |
| ... | ... |
@@ -40,7 +40,7 @@ type FileInLayer struct {
|
| 40 | 40 |
Content []byte |
| 41 | 41 |
} |
| 42 | 42 |
|
| 43 |
-func oneLayerPlatformManifest(dir string, platform platforms.Platform, f FileInLayer) (ocispec.Descriptor, error) {
|
|
| 43 |
+func oneLayerPlatformManifest(dir string, platform ocispec.Platform, f FileInLayer) (ocispec.Descriptor, error) {
|
|
| 44 | 44 |
layerDesc, err := writeLayerWithOneFile(dir, f.Path, f.Content) |
| 45 | 45 |
if err != nil {
|
| 46 | 46 |
return ocispec.Descriptor{}, err
|