diff --git a/notifications/bridge_test.go b/notifications/bridge_test.go index 7d479f6c..65b09a07 100644 --- a/notifications/bridge_test.go +++ b/notifications/bridge_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/distribution/distribution/v3" - "github.com/distribution/distribution/v3/manifest/schema1" + "github.com/distribution/distribution/v3/manifest/schema1" //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. "github.com/distribution/distribution/v3/reference" v2 "github.com/distribution/distribution/v3/registry/api/v2" "github.com/distribution/distribution/v3/uuid" @@ -27,7 +27,7 @@ var ( Name: "test", } request = RequestRecord{} - layers = []schema1.FSLayer{ + layers = []schema1.FSLayer{ //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. { BlobSum: "asdf", }, @@ -35,13 +35,13 @@ var ( BlobSum: "qwer", }, } - m = schema1.Manifest{ + m = schema1.Manifest{ //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. Name: repo, Tag: "latest", FSLayers: layers, } - sm *schema1.SignedManifest + sm *schema1.SignedManifest //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. payload []byte dgst digest.Digest ) @@ -152,7 +152,7 @@ func createTestEnv(t *testing.T, fn testSinkFn) Listener { t.Fatalf("error generating private key: %v", err) } - sm, err = schema1.Sign(&m, pk) + sm, err = schema1.Sign(&m, pk) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatalf("error signing manifest: %v", err) } diff --git a/notifications/event_test.go b/notifications/event_test.go index 41562717..59a86fd5 100644 --- a/notifications/event_test.go +++ b/notifications/event_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/distribution/distribution/v3/manifest/schema1" + "github.com/distribution/distribution/v3/manifest/schema1" //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. ) // TestEventJSONFormat provides silly test to detect if the event format or @@ -116,7 +116,7 @@ func TestEventEnvelopeJSONFormat(t *testing.T) { manifestPush := prototype manifestPush.ID = "asdf-asdf-asdf-asdf-0" - manifestPush.Target.MediaType = schema1.MediaTypeSignedManifest + manifestPush.Target.MediaType = schema1.MediaTypeSignedManifest //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. manifestPush.Target.Digest = "sha256:0123456789abcdef0" manifestPush.Target.Size = 1 manifestPush.Target.Length = 1 diff --git a/notifications/http_test.go b/notifications/http_test.go index 0d5ec4a5..fdcb6b5c 100644 --- a/notifications/http_test.go +++ b/notifications/http_test.go @@ -13,7 +13,7 @@ import ( "strings" "testing" - "github.com/distribution/distribution/v3/manifest/schema1" + "github.com/distribution/distribution/v3/manifest/schema1" //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. events "github.com/docker/go-events" ) @@ -121,11 +121,11 @@ func TestHTTPSink(t *testing.T) { }{ { statusCode: http.StatusOK, - event: createTestEvent("push", "library/test", schema1.MediaTypeSignedManifest), + event: createTestEvent("push", "library/test", schema1.MediaTypeSignedManifest), //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. }, { statusCode: http.StatusOK, - event: createTestEvent("push", "library/test", schema1.MediaTypeSignedManifest), + event: createTestEvent("push", "library/test", schema1.MediaTypeSignedManifest), //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. }, { statusCode: http.StatusOK, diff --git a/notifications/listener_test.go b/notifications/listener_test.go index cf554b6d..9e588318 100644 --- a/notifications/listener_test.go +++ b/notifications/listener_test.go @@ -8,7 +8,7 @@ import ( "github.com/distribution/distribution/v3" "github.com/distribution/distribution/v3/context" "github.com/distribution/distribution/v3/manifest" - "github.com/distribution/distribution/v3/manifest/schema1" + "github.com/distribution/distribution/v3/manifest/schema1" //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. "github.com/distribution/distribution/v3/reference" "github.com/distribution/distribution/v3/registry/storage" "github.com/distribution/distribution/v3/registry/storage/cache/memory" @@ -125,7 +125,7 @@ func checkExerciseRepository(t *testing.T, repository distribution.Repository, r tag := "thetag" // todo: change this to use Builder - m := schema1.Manifest{ + m := schema1.Manifest{ //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. Versioned: manifest.Versioned{ SchemaVersion: 1, }, @@ -159,10 +159,10 @@ func checkExerciseRepository(t *testing.T, repository distribution.Repository, r t.Fatalf("unexpected error finishing upload: %v", err) } - m.FSLayers = append(m.FSLayers, schema1.FSLayer{ + m.FSLayers = append(m.FSLayers, schema1.FSLayer{ //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. BlobSum: dgst, }) - m.History = append(m.History, schema1.History{ + m.History = append(m.History, schema1.History{ //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. V1Compatibility: "", }) @@ -179,7 +179,7 @@ func checkExerciseRepository(t *testing.T, repository distribution.Repository, r t.Fatalf("unexpected error generating key: %v", err) } - sm, err := schema1.Sign(&m, pk) + sm, err := schema1.Sign(&m, pk) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatalf("unexpected error signing manifest: %v", err) } diff --git a/registry/client/repository_test.go b/registry/client/repository_test.go index 4e926de7..7681bf86 100644 --- a/registry/client/repository_test.go +++ b/registry/client/repository_test.go @@ -19,7 +19,7 @@ import ( "github.com/distribution/distribution/v3" "github.com/distribution/distribution/v3/context" "github.com/distribution/distribution/v3/manifest" - "github.com/distribution/distribution/v3/manifest/schema1" + "github.com/distribution/distribution/v3/manifest/schema1" //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. "github.com/distribution/distribution/v3/reference" "github.com/distribution/distribution/v3/registry/api/errcode" v2 "github.com/distribution/distribution/v3/registry/api/v2" @@ -917,18 +917,18 @@ func TestBlobMount(t *testing.T) { } } -func newRandomSchemaV1Manifest(name reference.Named, tag string, blobCount int) (*schema1.SignedManifest, digest.Digest, []byte) { - blobs := make([]schema1.FSLayer, blobCount) - history := make([]schema1.History, blobCount) +func newRandomSchemaV1Manifest(name reference.Named, tag string, blobCount int) (*schema1.SignedManifest, digest.Digest, []byte) { //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. + blobs := make([]schema1.FSLayer, blobCount) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. + history := make([]schema1.History, blobCount) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. for i := 0; i < blobCount; i++ { dgst, blob := newRandomBlob((i % 5) * 16) - blobs[i] = schema1.FSLayer{BlobSum: dgst} - history[i] = schema1.History{V1Compatibility: fmt.Sprintf("{\"Hex\": \"%x\"}", blob)} + blobs[i] = schema1.FSLayer{BlobSum: dgst} //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. + history[i] = schema1.History{V1Compatibility: fmt.Sprintf("{\"Hex\": \"%x\"}", blob)} //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. } - m := schema1.Manifest{ + m := schema1.Manifest{ //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. Name: name.String(), Tag: tag, Architecture: "x86", @@ -944,7 +944,7 @@ func newRandomSchemaV1Manifest(name reference.Named, tag string, blobCount int) panic(err) } - sm, err := schema1.Sign(&m, pk) + sm, err := schema1.Sign(&m, pk) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { panic(err) } @@ -970,7 +970,7 @@ func addTestManifestWithEtag(repo reference.Named, reference string, content []b Headers: http.Header(map[string][]string{ "Content-Length": {"0"}, "Last-Modified": {time.Now().Add(-1 * time.Second).Format(time.ANSIC)}, - "Content-Type": {schema1.MediaTypeSignedManifest}, + "Content-Type": {schema1.MediaTypeSignedManifest}, //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. }), } } else { @@ -980,7 +980,7 @@ func addTestManifestWithEtag(repo reference.Named, reference string, content []b Headers: http.Header(map[string][]string{ "Content-Length": {fmt.Sprint(len(content))}, "Last-Modified": {time.Now().Add(-1 * time.Second).Format(time.ANSIC)}, - "Content-Type": {schema1.MediaTypeSignedManifest}, + "Content-Type": {schema1.MediaTypeSignedManifest}, //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. }), } } @@ -988,9 +988,9 @@ func addTestManifestWithEtag(repo reference.Named, reference string, content []b } func contentDigestString(mediatype string, content []byte) string { - if mediatype == schema1.MediaTypeSignedManifest { + if mediatype == schema1.MediaTypeSignedManifest { //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. m, _, _ := distribution.UnmarshalManifest(mediatype, content) - content = m.(*schema1.SignedManifest).Canonical + content = m.(*schema1.SignedManifest).Canonical //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. } return digest.Canonical.FromBytes(content).String() } @@ -1061,7 +1061,7 @@ func addTestManifestWithoutDigestHeader(repo reference.Named, reference string, }) } -func checkEqualManifest(m1, m2 *schema1.SignedManifest) error { +func checkEqualManifest(m1, m2 *schema1.SignedManifest) error { //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if m1.Name != m2.Name { return fmt.Errorf("name does not match %q != %q", m1.Name, m2.Name) } @@ -1092,12 +1092,12 @@ func TestV1ManifestFetch(t *testing.T) { repo, _ := reference.WithName("test.example.com/repo") m1, dgst, _ := newRandomSchemaV1Manifest(repo, "latest", 6) var m testutil.RequestResponseMap - _, pl, err := m1.Payload() + _, pl, err := m1.Payload() //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatal(err) } - addTestManifest(repo, dgst.String(), schema1.MediaTypeSignedManifest, pl, &m) - addTestManifest(repo, "latest", schema1.MediaTypeSignedManifest, pl, &m) + addTestManifest(repo, dgst.String(), schema1.MediaTypeSignedManifest, pl, &m) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. + addTestManifest(repo, "latest", schema1.MediaTypeSignedManifest, pl, &m) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. addTestManifest(repo, "badcontenttype", "text/html", pl, &m) e, c := testServer(m) @@ -1124,7 +1124,7 @@ func TestV1ManifestFetch(t *testing.T) { if err != nil { t.Fatal(err) } - v1manifest, ok := manifest.(*schema1.SignedManifest) + v1manifest, ok := manifest.(*schema1.SignedManifest) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if !ok { t.Fatalf("Unexpected manifest type from Get: %T", manifest) } @@ -1138,7 +1138,7 @@ func TestV1ManifestFetch(t *testing.T) { if err != nil { t.Fatal(err) } - v1manifest, ok = manifest.(*schema1.SignedManifest) + v1manifest, ok = manifest.(*schema1.SignedManifest) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if !ok { t.Fatalf("Unexpected manifest type from Get: %T", manifest) } @@ -1155,7 +1155,7 @@ func TestV1ManifestFetch(t *testing.T) { if err != nil { t.Fatal(err) } - v1manifest, ok = manifest.(*schema1.SignedManifest) + v1manifest, ok = manifest.(*schema1.SignedManifest) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if !ok { t.Fatalf("Unexpected manifest type from Get: %T", manifest) } @@ -1298,7 +1298,7 @@ func TestManifestPut(t *testing.T) { repo, _ := reference.WithName("test.example.com/repo/delete") m1, dgst, _ := newRandomSchemaV1Manifest(repo, "other", 6) - _, payload, err := m1.Payload() + _, payload, err := m1.Payload() //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatal(err) } @@ -1506,11 +1506,11 @@ func TestObtainsManifestForTagWithoutHeaders(t *testing.T) { var m testutil.RequestResponseMap m1, dgst, _ := newRandomSchemaV1Manifest(repo, "latest", 6) - _, pl, err := m1.Payload() + _, pl, err := m1.Payload() //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatal(err) } - addTestManifestWithoutDigestHeader(repo, "1.0.0", schema1.MediaTypeSignedManifest, pl, &m) + addTestManifestWithoutDigestHeader(repo, "1.0.0", schema1.MediaTypeSignedManifest, pl, &m) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. e, c := testServer(m) defer c() diff --git a/registry/handlers/api_test.go b/registry/handlers/api_test.go index 07355bb1..ede9952c 100644 --- a/registry/handlers/api_test.go +++ b/registry/handlers/api_test.go @@ -23,7 +23,7 @@ import ( "github.com/distribution/distribution/v3/configuration" "github.com/distribution/distribution/v3/manifest" "github.com/distribution/distribution/v3/manifest/manifestlist" - "github.com/distribution/distribution/v3/manifest/schema1" + "github.com/distribution/distribution/v3/manifest/schema1" //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. "github.com/distribution/distribution/v3/manifest/schema2" "github.com/distribution/distribution/v3/reference" "github.com/distribution/distribution/v3/registry/api/errcode" @@ -1278,13 +1278,13 @@ func testManifestAPISchema1(t *testing.T, env *testEnv, imageName reference.Name // -------------------------------- // Attempt to push unsigned manifest with missing layers - unsignedManifest := &schema1.Manifest{ + unsignedManifest := &schema1.Manifest{ //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. Versioned: manifest.Versioned{ SchemaVersion: 1, }, Name: imageName.Name(), Tag: tag, - FSLayers: []schema1.FSLayer{ + FSLayers: []schema1.FSLayer{ //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. { BlobSum: "asdf", }, @@ -1292,7 +1292,7 @@ func testManifestAPISchema1(t *testing.T, env *testEnv, imageName reference.Name BlobSum: "qwer", }, }, - History: []schema1.History{ + History: []schema1.History{ //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. { V1Compatibility: "", }, @@ -1316,7 +1316,7 @@ func testManifestAPISchema1(t *testing.T, env *testEnv, imageName reference.Name } // sign the manifest and still get some interesting errors. - sm, err := schema1.Sign(unsignedManifest, env.pk) + sm, err := schema1.Sign(unsignedManifest, env.pk) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatalf("error signing manifest: %v", err) } @@ -1358,7 +1358,7 @@ func testManifestAPISchema1(t *testing.T, env *testEnv, imageName reference.Name // ------------------- // Push the signed manifest with all layers pushed. - signedManifest, err := schema1.Sign(unsignedManifest, env.pk) + signedManifest, err := schema1.Sign(unsignedManifest, env.pk) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatalf("unexpected error signing manifest: %v", err) } @@ -1401,7 +1401,7 @@ func testManifestAPISchema1(t *testing.T, env *testEnv, imageName reference.Name "ETag": []string{fmt.Sprintf(`"%s"`, dgst)}, }) - var fetchedManifest schema1.SignedManifest + var fetchedManifest schema1.SignedManifest //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. dec := json.NewDecoder(resp.Body) if err := dec.Decode(&fetchedManifest); err != nil { @@ -1424,7 +1424,7 @@ func testManifestAPISchema1(t *testing.T, env *testEnv, imageName reference.Name "ETag": []string{fmt.Sprintf(`"%s"`, dgst)}, }) - var fetchedManifestByDigest schema1.SignedManifest + var fetchedManifestByDigest schema1.SignedManifest //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. dec = json.NewDecoder(resp.Body) if err := dec.Decode(&fetchedManifestByDigest); err != nil { t.Fatalf("error decoding fetched manifest: %v", err) @@ -1435,7 +1435,7 @@ func testManifestAPISchema1(t *testing.T, env *testEnv, imageName reference.Name } // check signature was roundtripped - signatures, err := fetchedManifestByDigest.Signatures() + signatures, err := fetchedManifestByDigest.Signatures() //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatal(err) } @@ -1445,7 +1445,7 @@ func testManifestAPISchema1(t *testing.T, env *testEnv, imageName reference.Name } // Re-sign, push and pull the same digest - sm2, err := schema1.Sign(&fetchedManifestByDigest.Manifest, env.pk) + sm2, err := schema1.Sign(&fetchedManifestByDigest.Manifest, env.pk) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatal(err) } @@ -1453,7 +1453,7 @@ func testManifestAPISchema1(t *testing.T, env *testEnv, imageName reference.Name // Re-push with a few different Content-Types. The official schema1 // content type should work, as should application/json with/without a // charset. - resp = putManifest(t, "re-putting signed manifest", manifestDigestURL, schema1.MediaTypeSignedManifest, sm2) + resp = putManifest(t, "re-putting signed manifest", manifestDigestURL, schema1.MediaTypeSignedManifest, sm2) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. checkResponse(t, "re-putting signed manifest", resp, http.StatusCreated) resp = putManifest(t, "re-putting signed manifest", manifestDigestURL, "application/json", sm2) checkResponse(t, "re-putting signed manifest", resp, http.StatusCreated) @@ -1476,7 +1476,7 @@ func testManifestAPISchema1(t *testing.T, env *testEnv, imageName reference.Name } // check only 1 signature is returned - signatures, err = fetchedManifestByDigest.Signatures() + signatures, err = fetchedManifestByDigest.Signatures() //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatal(err) } @@ -1542,10 +1542,10 @@ func testManifestAPISchema1(t *testing.T, env *testEnv, imageName reference.Name // Attempt to put a manifest with mismatching FSLayer and History array cardinalities - unsignedManifest.History = append(unsignedManifest.History, schema1.History{ + unsignedManifest.History = append(unsignedManifest.History, schema1.History{ //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. V1Compatibility: "", }) - invalidSigned, err := schema1.Sign(unsignedManifest, env.pk) + invalidSigned, err := schema1.Sign(unsignedManifest, env.pk) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatalf("error signing manifest") } @@ -1863,12 +1863,12 @@ func testManifestAPISchema2(t *testing.T, env *testEnv, imageName reference.Name checkResponse(t, "fetching uploaded manifest as schema1", resp, http.StatusOK) - m, desc, err := distribution.UnmarshalManifest(schema1.MediaTypeManifest, manifestBytes) + m, desc, err := distribution.UnmarshalManifest(schema1.MediaTypeManifest, manifestBytes) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatalf("unexpected error unmarshalling manifest: %v", err) } - fetchedSchema1Manifest, ok := m.(*schema1.SignedManifest) + fetchedSchema1Manifest, ok := m.(*schema1.SignedManifest) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if !ok { t.Fatalf("expecting schema1 manifest") } @@ -1993,7 +1993,7 @@ func testManifestAPIManifestList(t *testing.T, env *testEnv, args manifestArgs) t.Fatalf("Error constructing request: %s", err) } // multiple headers in mixed list format to ensure we parse correctly server-side - req.Header.Set("Accept", fmt.Sprintf(` %s ; q=0.8 , %s ; q=0.5 `, manifestlist.MediaTypeManifestList, schema1.MediaTypeSignedManifest)) + req.Header.Set("Accept", fmt.Sprintf(` %s ; q=0.8 , %s ; q=0.5 `, manifestlist.MediaTypeManifestList, schema1.MediaTypeSignedManifest)) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. req.Header.Add("Accept", schema2.MediaTypeManifest) resp, err = http.DefaultClient.Do(req) if err != nil { @@ -2097,12 +2097,12 @@ func testManifestAPIManifestList(t *testing.T, env *testEnv, args manifestArgs) checkResponse(t, "fetching uploaded manifest list as schema1", resp, http.StatusOK) - m, desc, err := distribution.UnmarshalManifest(schema1.MediaTypeManifest, manifestBytes) + m, desc, err := distribution.UnmarshalManifest(schema1.MediaTypeManifest, manifestBytes) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatalf("unexpected error unmarshalling manifest: %v", err) } - fetchedSchema1Manifest, ok := m.(*schema1.SignedManifest) + fetchedSchema1Manifest, ok := m.(*schema1.SignedManifest) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if !ok { t.Fatalf("expecting schema1 manifest") } @@ -2300,7 +2300,7 @@ func newTestEnvMirror(t *testing.T, deleteEnabled bool) *testEnv { RemoteURL: upstreamEnv.server.URL, }, } - config.Compatibility.Schema1.Enabled = true + config.Compatibility.Schema1.Enabled = true //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. return newTestEnvWithConfig(t, &config) } @@ -2316,7 +2316,7 @@ func newTestEnv(t *testing.T, deleteEnabled bool) *testEnv { }, } - config.Compatibility.Schema1.Enabled = true + config.Compatibility.Schema1.Enabled = true //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. config.HTTP.Headers = headerConfig return newTestEnvWithConfig(t, &config) @@ -2356,8 +2356,8 @@ func putManifest(t *testing.T, msg, url, contentType string, v interface{}) *htt var body []byte switch m := v.(type) { - case *schema1.SignedManifest: - _, pl, err := m.Payload() + case *schema1.SignedManifest: //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. + _, pl, err := m.Payload() //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatalf("error getting payload: %v", err) } @@ -2710,18 +2710,18 @@ func createRepository(env *testEnv, t *testing.T, imageName string, tag string) t.Fatalf("unable to parse reference: %v", err) } - unsignedManifest := &schema1.Manifest{ + unsignedManifest := &schema1.Manifest{ //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. Versioned: manifest.Versioned{ SchemaVersion: 1, }, Name: imageName, Tag: tag, - FSLayers: []schema1.FSLayer{ + FSLayers: []schema1.FSLayer{ //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. { BlobSum: "asdf", }, }, - History: []schema1.History{ + History: []schema1.History{ //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. { V1Compatibility: "", }, @@ -2743,7 +2743,7 @@ func createRepository(env *testEnv, t *testing.T, imageName string, tag string) pushLayer(t, env.builder, imageNameRef, dgst, uploadURLBase, rs) } - signedManifest, err := schema1.Sign(unsignedManifest, env.pk) + signedManifest, err := schema1.Sign(unsignedManifest, env.pk) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatalf("unexpected error signing manifest: %v", err) } @@ -2784,17 +2784,17 @@ func TestRegistryAsCacheMutationAPIs(t *testing.T) { } // Manifest upload - m := &schema1.Manifest{ + m := &schema1.Manifest{ //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. Versioned: manifest.Versioned{ SchemaVersion: 1, }, Name: imageName.Name(), Tag: tag, - FSLayers: []schema1.FSLayer{}, - History: []schema1.History{}, + FSLayers: []schema1.FSLayer{}, //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. + History: []schema1.History{}, //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. } - sm, err := schema1.Sign(m, env.pk) + sm, err := schema1.Sign(m, env.pk) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatalf("error signing manifest: %v", err) } @@ -2836,7 +2836,7 @@ func TestProxyManifestGetByTag(t *testing.T) { }}, }, } - truthConfig.Compatibility.Schema1.Enabled = true + truthConfig.Compatibility.Schema1.Enabled = true //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. truthConfig.HTTP.Headers = headerConfig imageName, _ := reference.WithName("foo/bar") @@ -2855,7 +2855,7 @@ func TestProxyManifestGetByTag(t *testing.T) { RemoteURL: truthEnv.server.URL, }, } - proxyConfig.Compatibility.Schema1.Enabled = true + proxyConfig.Compatibility.Schema1.Enabled = true //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. proxyConfig.HTTP.Headers = headerConfig proxyEnv := newTestEnvWithConfig(t, &proxyConfig) diff --git a/registry/handlers/manifests.go b/registry/handlers/manifests.go index e91fcac0..4434286a 100644 --- a/registry/handlers/manifests.go +++ b/registry/handlers/manifests.go @@ -11,7 +11,7 @@ import ( dcontext "github.com/distribution/distribution/v3/context" "github.com/distribution/distribution/v3/manifest/manifestlist" "github.com/distribution/distribution/v3/manifest/ocischema" - "github.com/distribution/distribution/v3/manifest/schema1" + "github.com/distribution/distribution/v3/manifest/schema1" //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. "github.com/distribution/distribution/v3/manifest/schema2" "github.com/distribution/distribution/v3/reference" "github.com/distribution/distribution/v3/registry/api/errcode" @@ -260,7 +260,7 @@ func (imh *manifestHandler) convertSchema2Manifest(schema2Manifest *schema2.Dese } } - builder := schema1.NewConfigManifestBuilder(imh.Repository.Blobs(imh), imh.Context.App.trustKey, ref, configJSON) + builder := schema1.NewConfigManifestBuilder(imh.Repository.Blobs(imh), imh.Context.App.trustKey, ref, configJSON) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. for _, d := range schema2Manifest.Layers { if err := builder.AppendReference(d); err != nil { imh.Errors = append(imh.Errors, v2.ErrorCodeManifestInvalid.WithDetail(err)) @@ -272,7 +272,7 @@ func (imh *manifestHandler) convertSchema2Manifest(schema2Manifest *schema2.Dese imh.Errors = append(imh.Errors, v2.ErrorCodeManifestInvalid.WithDetail(err)) return nil, err } - imh.Digest = digest.FromBytes(manifest.(*schema1.SignedManifest).Canonical) + imh.Digest = digest.FromBytes(manifest.(*schema1.SignedManifest).Canonical) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. return manifest, nil } @@ -421,7 +421,7 @@ func (imh *manifestHandler) applyResourcePolicy(manifest distribution.Manifest) var class string switch m := manifest.(type) { - case *schema1.SignedManifest: + case *schema1.SignedManifest: //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. class = imageClass case *schema2.DeserializedManifest: switch m.Config.MediaType { diff --git a/registry/proxy/proxymanifeststore_test.go b/registry/proxy/proxymanifeststore_test.go index bd06a49b..2e1bb142 100644 --- a/registry/proxy/proxymanifeststore_test.go +++ b/registry/proxy/proxymanifeststore_test.go @@ -8,7 +8,7 @@ import ( "github.com/distribution/distribution/v3" "github.com/distribution/distribution/v3/manifest" - "github.com/distribution/distribution/v3/manifest/schema1" + "github.com/distribution/distribution/v3/manifest/schema1" //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. "github.com/distribution/distribution/v3/reference" "github.com/distribution/distribution/v3/registry/client/auth" "github.com/distribution/distribution/v3/registry/client/auth/challenge" @@ -151,7 +151,7 @@ func newManifestStoreTestEnv(t *testing.T, name, tag string) *manifestStoreTestE } func populateRepo(ctx context.Context, t *testing.T, repository distribution.Repository, name, tag string) (digest.Digest, error) { - m := schema1.Manifest{ + m := schema1.Manifest{ //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. Versioned: manifest.Versioned{ SchemaVersion: 1, }, @@ -183,7 +183,7 @@ func populateRepo(ctx context.Context, t *testing.T, repository distribution.Rep t.Fatalf("unexpected error generating private key: %v", err) } - sm, err := schema1.Sign(&m, pk) + sm, err := schema1.Sign(&m, pk) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatalf("error signing manifest: %v", err) } diff --git a/registry/storage/catalog_test.go b/registry/storage/catalog_test.go index 1b7bcd8c..14ba4e83 100644 --- a/registry/storage/catalog_test.go +++ b/registry/storage/catalog_test.go @@ -93,7 +93,7 @@ func makeRepo(ctx context.Context, t *testing.T, name string, reg distribution.N return } - manifest, err := testutil.MakeSchema1Manifest(getKeys(layers)) + manifest, err := testutil.MakeSchema1Manifest(getKeys(layers)) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatal(err) } diff --git a/registry/storage/garbagecollect_test.go b/registry/storage/garbagecollect_test.go index 11088083..bdbf9ab2 100644 --- a/registry/storage/garbagecollect_test.go +++ b/registry/storage/garbagecollect_test.go @@ -121,7 +121,7 @@ func uploadRandomSchema1Image(t *testing.T, repository distribution.Repository) digests = append(digests, digest) } - manifest, err := testutil.MakeSchema1Manifest(digests) + manifest, err := testutil.MakeSchema1Manifest(digests) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatalf("%v", err) } @@ -232,12 +232,12 @@ func TestDeleteManifestIfTagNotFound(t *testing.T) { } // Construct manifests - manifest1, err := testutil.MakeSchema1Manifest(getKeys(randomLayers1)) + manifest1, err := testutil.MakeSchema1Manifest(getKeys(randomLayers1)) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatalf("failed to make manifest: %v", err) } - manifest2, err := testutil.MakeSchema1Manifest(getKeys(randomLayers2)) + manifest2, err := testutil.MakeSchema1Manifest(getKeys(randomLayers2)) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatalf("failed to make manifest: %v", err) } @@ -426,7 +426,7 @@ func TestDeletionWithSharedLayer(t *testing.T) { } // Construct manifests - manifest1, err := testutil.MakeSchema1Manifest(getKeys(randomLayers1)) + manifest1, err := testutil.MakeSchema1Manifest(getKeys(randomLayers1)) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatalf("failed to make manifest: %v", err) } diff --git a/registry/storage/manifeststore.go b/registry/storage/manifeststore.go index 0daa92df..6b2f4e58 100644 --- a/registry/storage/manifeststore.go +++ b/registry/storage/manifeststore.go @@ -10,7 +10,7 @@ import ( "github.com/distribution/distribution/v3/manifest" "github.com/distribution/distribution/v3/manifest/manifestlist" "github.com/distribution/distribution/v3/manifest/ocischema" - "github.com/distribution/distribution/v3/manifest/schema1" + "github.com/distribution/distribution/v3/manifest/schema1" //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. "github.com/distribution/distribution/v3/manifest/schema2" "github.com/opencontainers/go-digest" v1 "github.com/opencontainers/image-spec/specs-go/v1" @@ -130,7 +130,7 @@ func (ms *manifestStore) Put(ctx context.Context, manifest distribution.Manifest dcontext.GetLogger(ms.ctx).Debug("(*manifestStore).Put") switch manifest.(type) { - case *schema1.SignedManifest: + case *schema1.SignedManifest: //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. return ms.schema1Handler.Put(ctx, manifest, ms.skipDependencyVerification) case *schema2.DeserializedManifest: return ms.schema2Handler.Put(ctx, manifest, ms.skipDependencyVerification) diff --git a/registry/storage/manifeststore_test.go b/registry/storage/manifeststore_test.go index efcc80b6..0d7a4379 100644 --- a/registry/storage/manifeststore_test.go +++ b/registry/storage/manifeststore_test.go @@ -11,7 +11,7 @@ import ( "github.com/distribution/distribution/v3/manifest" "github.com/distribution/distribution/v3/manifest/manifestlist" "github.com/distribution/distribution/v3/manifest/ocischema" - "github.com/distribution/distribution/v3/manifest/schema1" + "github.com/distribution/distribution/v3/manifest/schema1" //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. "github.com/distribution/distribution/v3/reference" "github.com/distribution/distribution/v3/registry/storage/cache/memory" "github.com/distribution/distribution/v3/registry/storage/driver" @@ -79,7 +79,7 @@ func testManifestStorage(t *testing.T, schema1Enabled bool, options ...RegistryO t.Fatal(err) } - m := schema1.Manifest{ + m := schema1.Manifest{ //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. Versioned: manifest.Versioned{ SchemaVersion: 1, }, @@ -97,10 +97,10 @@ func testManifestStorage(t *testing.T, schema1Enabled bool, options ...RegistryO } testLayers[dgst] = rs - m.FSLayers = append(m.FSLayers, schema1.FSLayer{ + m.FSLayers = append(m.FSLayers, schema1.FSLayer{ //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. BlobSum: dgst, }) - m.History = append(m.History, schema1.History{ + m.History = append(m.History, schema1.History{ //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. V1Compatibility: "", }) @@ -111,7 +111,7 @@ func testManifestStorage(t *testing.T, schema1Enabled bool, options ...RegistryO t.Fatalf("unexpected error generating private key: %v", err) } - sm, merr := schema1.Sign(&m, pk) + sm, merr := schema1.Sign(&m, pk) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if merr != nil { t.Fatalf("error signing manifest: %v", err) } @@ -180,7 +180,7 @@ func testManifestStorage(t *testing.T, schema1Enabled bool, options ...RegistryO t.Fatalf("unexpected error fetching manifest: %v", err) } - fetchedManifest, ok := fromStore.(*schema1.SignedManifest) + fetchedManifest, ok := fromStore.(*schema1.SignedManifest) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if !ok { t.Fatalf("unexpected manifest type from signedstore") } @@ -189,7 +189,7 @@ func testManifestStorage(t *testing.T, schema1Enabled bool, options ...RegistryO t.Fatalf("fetched payload does not match original payload: %q != %q", fetchedManifest.Canonical, sm.Canonical) } - _, pl, err := fetchedManifest.Payload() + _, pl, err := fetchedManifest.Payload() //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatalf("error getting payload %#v", err) } @@ -222,7 +222,7 @@ func testManifestStorage(t *testing.T, schema1Enabled bool, options ...RegistryO t.Fatalf("unexpected error fetching manifest by digest: %v", err) } - byDigestManifest, ok := fetchedByDigest.(*schema1.SignedManifest) + byDigestManifest, ok := fetchedByDigest.(*schema1.SignedManifest) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if !ok { t.Fatalf("unexpected manifest type from signedstore") } @@ -246,11 +246,11 @@ func testManifestStorage(t *testing.T, schema1Enabled bool, options ...RegistryO t.Fatalf("unexpected error generating private key: %v", err) } - sm2, err := schema1.Sign(&m, pk2) + sm2, err := schema1.Sign(&m, pk2) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatalf("unexpected error signing manifest: %v", err) } - _, pl, err = sm2.Payload() + _, pl, err = sm2.Payload() //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatalf("error getting payload %#v", err) } @@ -278,16 +278,16 @@ func testManifestStorage(t *testing.T, schema1Enabled bool, options ...RegistryO t.Fatalf("unexpected error fetching manifest: %v", err) } - fetched, ok := fromStore.(*schema1.SignedManifest) + fetched, ok := fromStore.(*schema1.SignedManifest) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if !ok { t.Fatalf("unexpected type from signed manifeststore : %T", fetched) } - if _, err := schema1.Verify(fetched); err != nil { + if _, err := schema1.Verify(fetched); err != nil { //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. t.Fatalf("unexpected error verifying manifest: %v", err) } - _, pl, err = fetched.Payload() + _, pl, err = fetched.Payload() //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err != nil { t.Fatalf("error getting payload %#v", err) } diff --git a/registry/storage/schema2manifesthandler.go b/registry/storage/schema2manifesthandler.go index cdaa5e20..7716289a 100644 --- a/registry/storage/schema2manifesthandler.go +++ b/registry/storage/schema2manifesthandler.go @@ -8,7 +8,7 @@ import ( "github.com/distribution/distribution/v3" dcontext "github.com/distribution/distribution/v3/context" - "github.com/distribution/distribution/v3/manifest/schema1" + "github.com/distribution/distribution/v3/manifest/schema1" //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. "github.com/distribution/distribution/v3/manifest/schema2" "github.com/opencontainers/go-digest" ) @@ -110,7 +110,7 @@ func (ms *schema2ManifestHandler) verifyManifest(ctx context.Context, mnfst sche break } } - case schema2.MediaTypeManifest, schema1.MediaTypeManifest: + case schema2.MediaTypeManifest, schema1.MediaTypeManifest: //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. var exists bool exists, err = manifestService.Exists(ctx, descriptor.Digest) if err != nil || !exists { diff --git a/registry/storage/signedmanifesthandler.go b/registry/storage/signedmanifesthandler.go index eb5b5742..edb32e07 100644 --- a/registry/storage/signedmanifesthandler.go +++ b/registry/storage/signedmanifesthandler.go @@ -7,7 +7,7 @@ import ( "github.com/distribution/distribution/v3" dcontext "github.com/distribution/distribution/v3/context" - "github.com/distribution/distribution/v3/manifest/schema1" + "github.com/distribution/distribution/v3/manifest/schema1" //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. "github.com/distribution/distribution/v3/reference" "github.com/docker/libtrust" "github.com/opencontainers/go-digest" @@ -49,7 +49,7 @@ func (ms *signedManifestHandler) Unmarshal(ctx context.Context, dgst digest.Dige return nil, err } - var sm schema1.SignedManifest + var sm schema1.SignedManifest //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if err := json.Unmarshal(raw, &sm); err != nil { return nil, err } @@ -59,7 +59,7 @@ func (ms *signedManifestHandler) Unmarshal(ctx context.Context, dgst digest.Dige func (ms *signedManifestHandler) Put(ctx context.Context, manifest distribution.Manifest, skipDependencyVerification bool) (digest.Digest, error) { dcontext.GetLogger(ms.ctx).Debug("(*signedManifestHandler).Put") - sm, ok := manifest.(*schema1.SignedManifest) + sm, ok := manifest.(*schema1.SignedManifest) //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. if !ok { return "", fmt.Errorf("non-schema1 manifest put to signedManifestHandler: %T", manifest) } @@ -68,7 +68,7 @@ func (ms *signedManifestHandler) Put(ctx context.Context, manifest distribution. return "", err } - mt := schema1.MediaTypeManifest + mt := schema1.MediaTypeManifest //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. payload := sm.Canonical revision, err := ms.blobStore.Put(ctx, mt, payload) @@ -84,7 +84,7 @@ func (ms *signedManifestHandler) Put(ctx context.Context, manifest distribution. // perspective of the registry. It ensures that the signature is valid for the // enclosed payload. As a policy, the registry only tries to store valid // content, leaving trust policies of that content up to consumers. -func (ms *signedManifestHandler) verifyManifest(ctx context.Context, mnfst schema1.SignedManifest, skipDependencyVerification bool) error { +func (ms *signedManifestHandler) verifyManifest(ctx context.Context, mnfst schema1.SignedManifest, skipDependencyVerification bool) error { //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. var errs distribution.ErrManifestVerification if len(mnfst.Name) > reference.NameTotalLengthMax { @@ -108,7 +108,7 @@ func (ms *signedManifestHandler) verifyManifest(ctx context.Context, mnfst schem len(mnfst.History), len(mnfst.FSLayers))) } - if _, err := schema1.Verify(&mnfst); err != nil { + if _, err := schema1.Verify(&mnfst); err != nil { //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. switch err { case libtrust.ErrMissingSignatureKey, libtrust.ErrInvalidJSONContent, libtrust.ErrMissingSignatureKey: errs = append(errs, distribution.ErrManifestUnverified{}) @@ -122,7 +122,7 @@ func (ms *signedManifestHandler) verifyManifest(ctx context.Context, mnfst schem } if !skipDependencyVerification { - for _, fsLayer := range mnfst.References() { + for _, fsLayer := range mnfst.References() { //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. _, err := ms.repository.Blobs(ctx).Stat(ctx, fsLayer.Digest) if err != nil { if err != distribution.ErrBlobUnknown { diff --git a/testutil/manifests.go b/testutil/manifests.go index 61890f53..2b421149 100644 --- a/testutil/manifests.go +++ b/testutil/manifests.go @@ -7,7 +7,7 @@ import ( "github.com/distribution/distribution/v3/context" "github.com/distribution/distribution/v3/manifest" "github.com/distribution/distribution/v3/manifest/manifestlist" - "github.com/distribution/distribution/v3/manifest/schema1" + "github.com/distribution/distribution/v3/manifest/schema1" //nolint:staticcheck // Ignore SA1019: "github.com/distribution/distribution/v3/manifest/schema1" is deprecated, as it's used for backward compatibility. "github.com/distribution/distribution/v3/manifest/schema2" "github.com/docker/libtrust" "github.com/opencontainers/go-digest"