Skip to content

Commit 6812b5c

Browse files
committed
feat(oci): support specifying the manifest digest when pushing it
See opencontainers/distribution-spec#494 and related work Signed-off-by: Andrei Aaron <[email protected]>
1 parent 26be383 commit 6812b5c

File tree

26 files changed

+473
-220
lines changed

26 files changed

+473
-220
lines changed

pkg/api/controller_test.go

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11198,13 +11198,7 @@ func TestSupportedDigestAlgorithms(t *testing.T) {
1119811198

1119911199
client := resty.New()
1120011200

11201-
// The server picks canonical digests when tags are pushed
11202-
// See https://github.com/opencontainers/distribution-spec/issues/494
11203-
// It would be nice to be able to push tags with other digest algorithms and verify those are returned
11204-
// but there is no way to specify a client preference
11205-
// so all we can do is verify the correct algorithm is returned
11206-
11207-
expectedDigestStr := image.DigestForAlgorithm(godigest.Canonical).String()
11201+
expectedDigestStr := image.DigestForAlgorithm(godigest.SHA512).String()
1120811202

1120911203
verifyReturnedManifestDigest(t, client, baseURL, name, tag, expectedDigestStr)
1121011204
verifyReturnedManifestDigest(t, client, baseURL, name, expectedDigestStr, expectedDigestStr)
@@ -11238,13 +11232,7 @@ func TestSupportedDigestAlgorithms(t *testing.T) {
1123811232

1123911233
client := resty.New()
1124011234

11241-
// The server picks canonical digests when tags are pushed
11242-
// See https://github.com/opencontainers/distribution-spec/issues/494
11243-
// It would be nice to be able to push tags with other digest algorithms and verify those are returned
11244-
// but there is no way to specify a client preference
11245-
// so all we can do is verify the correct algorithm is returned
11246-
11247-
expectedDigestStr := image.DigestForAlgorithm(godigest.Canonical).String()
11235+
expectedDigestStr := image.DigestForAlgorithm(godigest.SHA384).String()
1124811236

1124911237
verifyReturnedManifestDigest(t, client, baseURL, name, tag, expectedDigestStr)
1125011238
verifyReturnedManifestDigest(t, client, baseURL, name, expectedDigestStr, expectedDigestStr)
@@ -11266,18 +11254,10 @@ func TestSupportedDigestAlgorithms(t *testing.T) {
1126611254

1126711255
client := resty.New()
1126811256

11269-
// The server picks canonical digests when tags are pushed
11270-
// See https://github.com/opencontainers/distribution-spec/issues/494
11271-
// It would be nice to be able to push tags with other digest algorithms and verify those are returned
11272-
// but there is no way to specify a client preference
11273-
// so all we can do is verify the correct algorithm is returned
11274-
expectedDigestStr := multiarch.DigestForAlgorithm(godigest.Canonical).String()
11257+
expectedDigestStr := multiarch.DigestForAlgorithm(godigest.SHA512).String()
1127511258

1127611259
verifyReturnedManifestDigest(t, client, baseURL, name, tag, expectedDigestStr)
1127711260
verifyReturnedManifestDigest(t, client, baseURL, name, expectedDigestStr, expectedDigestStr)
11278-
11279-
// While the expected multiarch manifest digest is always using the canonical algorithm
11280-
// the sub-imgage manifest digest can use any algorith
1128111261
verifyReturnedManifestDigest(t, client, baseURL, name,
1128211262
subImage1.ManifestDescriptor.Digest.String(), subImage1.ManifestDescriptor.Digest.String())
1128311263
verifyReturnedManifestDigest(t, client, baseURL, name,
@@ -11303,9 +11283,6 @@ func TestSupportedDigestAlgorithms(t *testing.T) {
1130311283

1130411284
expectedDigestStr := multiarch.DigestForAlgorithm(godigest.SHA512).String()
1130511285
verifyReturnedManifestDigest(t, client, baseURL, name, expectedDigestStr, expectedDigestStr)
11306-
11307-
// While the expected multiarch manifest digest is always using the canonical algorithm
11308-
// the sub-imgage manifest digest can use any algorith
1130911286
verifyReturnedManifestDigest(t, client, baseURL, name,
1131011287
subImage1.ManifestDescriptor.Digest.String(), subImage1.ManifestDescriptor.Digest.String())
1131111288
verifyReturnedManifestDigest(t, client, baseURL, name,
@@ -11328,18 +11305,10 @@ func TestSupportedDigestAlgorithms(t *testing.T) {
1132811305

1132911306
client := resty.New()
1133011307

11331-
// The server picks canonical digests when tags are pushed
11332-
// See https://github.com/opencontainers/distribution-spec/issues/494
11333-
// It would be nice to be able to push tags with other digest algorithms and verify those are returned
11334-
// but there is no way to specify a client preference
11335-
// so all we can do is verify the correct algorithm is returned
11336-
expectedDigestStr := multiarch.DigestForAlgorithm(godigest.Canonical).String()
11308+
expectedDigestStr := multiarch.DigestForAlgorithm(godigest.SHA384).String()
1133711309

1133811310
verifyReturnedManifestDigest(t, client, baseURL, name, tag, expectedDigestStr)
1133911311
verifyReturnedManifestDigest(t, client, baseURL, name, expectedDigestStr, expectedDigestStr)
11340-
11341-
// While the expected multiarch manifest digest is always using the canonical algorithm
11342-
// the sub-imgage manifest digest can use any algorith
1134311312
verifyReturnedManifestDigest(t, client, baseURL, name,
1134411313
subImage1.ManifestDescriptor.Digest.String(), subImage1.ManifestDescriptor.Digest.String())
1134511314
verifyReturnedManifestDigest(t, client, baseURL, name,

0 commit comments

Comments
 (0)