@@ -15,6 +15,7 @@ import (
15
15
"io"
16
16
"net"
17
17
"net/http"
18
+ "net/url"
18
19
"os"
19
20
"path"
20
21
"path/filepath"
@@ -35,6 +36,7 @@ import (
35
36
"github.com/containerd/containerd/remotes/docker"
36
37
"github.com/containerd/containerd/snapshots"
37
38
"github.com/containerd/continuity/fs/fstest"
39
+ "github.com/docker/distribution/reference"
38
40
intoto "github.com/in-toto/in-toto-golang/in_toto"
39
41
controlapi "github.com/moby/buildkit/api/services/control"
40
42
"github.com/moby/buildkit/client/llb"
@@ -53,7 +55,6 @@ import (
53
55
"github.com/moby/buildkit/util/attestation"
54
56
"github.com/moby/buildkit/util/contentutil"
55
57
"github.com/moby/buildkit/util/entitlements"
56
- "github.com/moby/buildkit/util/purl"
57
58
"github.com/moby/buildkit/util/testutil"
58
59
"github.com/moby/buildkit/util/testutil/echoserver"
59
60
"github.com/moby/buildkit/util/testutil/httpserver"
@@ -7564,7 +7565,14 @@ func testExportAttestations(t *testing.T, sb integration.Sandbox) {
7564
7565
7565
7566
purls := map [string ]string {}
7566
7567
for _ , k := range targets {
7567
- p , _ := purl .RefToPURL (k , & ps [i ])
7568
+ named , err := reference .ParseNormalizedNamed (k )
7569
+ require .NoError (t , err )
7570
+ name := reference .FamiliarName (named )
7571
+ version := ""
7572
+ if tagged , ok := named .(reference.Tagged ); ok {
7573
+ version = tagged .Tag ()
7574
+ }
7575
+ p := fmt .Sprintf ("pkg:docker/%s%s@%s?platform=%s" , url .QueryEscape (registry ), strings .TrimPrefix (name , registry ), version , url .PathEscape (platforms .Format (ps [i ])))
7568
7576
purls [k ] = p
7569
7577
}
7570
7578
@@ -7852,8 +7860,7 @@ func testAttestationDefaultSubject(t *testing.T, sb integration.Sandbox) {
7852
7860
require .Equal (t , "https://example.com/attestations/v1.0" , attest .PredicateType )
7853
7861
require .Equal (t , map [string ]interface {}{"success" : true }, attest .Predicate )
7854
7862
7855
- name , _ := purl .RefToPURL (target , & ps [0 ])
7856
-
7863
+ name := fmt .Sprintf ("pkg:docker/%s/buildkit/testattestationsemptysubject@latest?platform=%s" , url .QueryEscape (registry ), url .QueryEscape (platforms .Format (ps [i ])))
7857
7864
subjects := []intoto.Subject {{
7858
7865
Name : name ,
7859
7866
Digest : map [string ]string {
@@ -8004,7 +8011,7 @@ func testAttestationBundle(t *testing.T, sb integration.Sandbox) {
8004
8011
8005
8012
require .Equal (t , "https://example.com/attestations/v1.0" , attest .PredicateType )
8006
8013
require .Equal (t , map [string ]interface {}{"foo" : "1" }, attest .Predicate )
8007
- name , _ := purl . RefToPURL ( target , & ps [i ])
8014
+ name := fmt . Sprintf ( "pkg:docker/%s/buildkit/testattestationsbundle@latest?platform=%s" , url . QueryEscape ( registry ), url . QueryEscape ( platforms . Format ( ps [i ])) )
8008
8015
subjects := []intoto.Subject {{
8009
8016
Name : name ,
8010
8017
Digest : map [string ]string {
0 commit comments