From 5efd2286da2deac891968dfeefc006a48fb37714 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Tue, 1 Jul 2025 20:33:42 -0700 Subject: [PATCH] vendor: update buildkit to v0.23.2 Signed-off-by: Tonis Tiigi --- vendor.mod | 4 +- vendor.sum | 8 ++-- .../moby/buildkit/exporter/local/fs.go | 4 +- .../tonistiigi/go-actions-cache/cache.go | 1 + .../tonistiigi/go-actions-cache/cache_v2.go | 47 +++++++++++++++---- vendor/modules.txt | 4 +- 6 files changed, 48 insertions(+), 20 deletions(-) diff --git a/vendor.mod b/vendor.mod index 5ea603eb7b..5007b65a26 100644 --- a/vendor.mod +++ b/vendor.mod @@ -62,7 +62,7 @@ require ( github.com/miekg/dns v1.1.66 github.com/mistifyio/go-zfs/v3 v3.0.1 github.com/mitchellh/copystructure v1.2.0 - github.com/moby/buildkit v0.23.1 + github.com/moby/buildkit v0.23.2 github.com/moby/docker-image-spec v1.3.1 github.com/moby/go-archive v0.1.0 github.com/moby/ipvs v1.1.0 @@ -209,7 +209,7 @@ require ( github.com/tinylib/msgp v1.1.8 // indirect github.com/tonistiigi/dchapes-mode v0.0.0-20250318174251-73d941a28323 // indirect github.com/tonistiigi/fsutil v0.0.0-20250605211040-586307ad452f // indirect - github.com/tonistiigi/go-actions-cache v0.0.0-20250611155157-388a2ec8cdf8 // indirect + github.com/tonistiigi/go-actions-cache v0.0.0-20250626083717-378c5ed1ddd9 // indirect github.com/tonistiigi/go-csvvalue v0.0.0-20240814133006-030d3b2625d0 // indirect github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea // indirect github.com/tonistiigi/vt100 v0.0.0-20240514184818-90bafcd6abab // indirect diff --git a/vendor.sum b/vendor.sum index 3bf2994624..61106a80d5 100644 --- a/vendor.sum +++ b/vendor.sum @@ -384,8 +384,8 @@ github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:F github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mndrix/tap-go v0.0.0-20171203230836-629fa407e90b/go.mod h1:pzzDgJWZ34fGzaAZGFW22KVZDfyrYW+QABMrWnJBnSs= -github.com/moby/buildkit v0.23.1 h1:CZtFmPRF+IFG1C8QfPnktGO1Dzzt5JSwtQ5eDqIh+ag= -github.com/moby/buildkit v0.23.1/go.mod h1:keNXljNmKX1T0AtM0bMObc8OV6mA9cOuquVbPcRpU/Y= +github.com/moby/buildkit v0.23.2 h1:gt/dkfcpgTXKx+B9I310kV767hhVqTvEyxGgI3mqsGQ= +github.com/moby/buildkit v0.23.2/go.mod h1:iEjAfPQKIuO+8y6OcInInvzqTMiKMbb2RdJz1K/95a0= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/moby/go-archive v0.1.0 h1:Kk/5rdW/g+H8NHdJW2gsXyZ7UnzvJNOy6VKJqueWdcQ= @@ -559,8 +559,8 @@ github.com/tonistiigi/dchapes-mode v0.0.0-20250318174251-73d941a28323 h1:r0p7fK5 github.com/tonistiigi/dchapes-mode v0.0.0-20250318174251-73d941a28323/go.mod h1:3Iuxbr0P7D3zUzBMAZB+ois3h/et0shEz0qApgHYGpY= github.com/tonistiigi/fsutil v0.0.0-20250605211040-586307ad452f h1:MoxeMfHAe5Qj/ySSBfL8A7l1V+hxuluj8owsIEEZipI= github.com/tonistiigi/fsutil v0.0.0-20250605211040-586307ad452f/go.mod h1:BKdcez7BiVtBvIcef90ZPc6ebqIWr4JWD7+EvLm6J98= -github.com/tonistiigi/go-actions-cache v0.0.0-20250611155157-388a2ec8cdf8 h1:KbACff2cR+ip6/Kmt8zCzieMlKYyypArQT1ZweFxewQ= -github.com/tonistiigi/go-actions-cache v0.0.0-20250611155157-388a2ec8cdf8/go.mod h1:gJlfrsY8U+1n9RGKSgWryNFfzHRl/b1a99RUVL1L4Qw= +github.com/tonistiigi/go-actions-cache v0.0.0-20250626083717-378c5ed1ddd9 h1:GWuTlpuUQBaK6u0R3HwE+eWaQ2aXwHgo8CaXgqtDQZU= +github.com/tonistiigi/go-actions-cache v0.0.0-20250626083717-378c5ed1ddd9/go.mod h1:cD0SB2270BYw6HYKriFn4H6NRLhGj6ytf48YTpsm8LY= github.com/tonistiigi/go-archvariant v1.0.0 h1:5LC1eDWiBNflnTF1prCiX09yfNHIxDC/aukdhCdTyb0= github.com/tonistiigi/go-archvariant v1.0.0/go.mod h1:TxFmO5VS6vMq2kvs3ht04iPXtu2rUT/erOnGFYfk5Ho= github.com/tonistiigi/go-csvvalue v0.0.0-20240814133006-030d3b2625d0 h1:2f304B10LaZdB8kkVEaoXvAMVan2tl9AiK4G0odjQtE= diff --git a/vendor/github.com/moby/buildkit/exporter/local/fs.go b/vendor/github.com/moby/buildkit/exporter/local/fs.go index 6e68b0aa2a..ccbbf7e646 100644 --- a/vendor/github.com/moby/buildkit/exporter/local/fs.go +++ b/vendor/github.com/moby/buildkit/exporter/local/fs.go @@ -180,7 +180,7 @@ func CreateFS(ctx context.Context, sessionID string, k string, ref cache.Immutab return nil, nil, err } stmtFS := staticfs.NewFS() - split := opt.UsePlatformSplit(isMap) + addPlatformToFilename := isMap && !opt.UsePlatformSplit(isMap) names := map[string]struct{}{} for i, stmt := range stmts { @@ -190,7 +190,7 @@ func CreateFS(ctx context.Context, sessionID string, k string, ref cache.Immutab } name := opt.AttestationPrefix + path.Base(attestations[i].Path) - if !split { + if addPlatformToFilename { nameExt := path.Ext(name) namBase := strings.TrimSuffix(name, nameExt) name = fmt.Sprintf("%s.%s%s", namBase, strings.ReplaceAll(k, "/", "_"), nameExt) diff --git a/vendor/github.com/tonistiigi/go-actions-cache/cache.go b/vendor/github.com/tonistiigi/go-actions-cache/cache.go index 6cdb96619c..68a4ff99a6 100644 --- a/vendor/github.com/tonistiigi/go-actions-cache/cache.go +++ b/vendor/github.com/tonistiigi/go-actions-cache/cache.go @@ -593,6 +593,7 @@ type Entry struct { IsAzureBlob bool `json:"isAzureBlob"` client *http.Client + reload func(context.Context) error } func (ce *Entry) WriteTo(ctx context.Context, w io.Writer) error { diff --git a/vendor/github.com/tonistiigi/go-actions-cache/cache_v2.go b/vendor/github.com/tonistiigi/go-actions-cache/cache_v2.go index a2f5b6af27..e38fb5f274 100644 --- a/vendor/github.com/tonistiigi/go-actions-cache/cache_v2.go +++ b/vendor/github.com/tonistiigi/go-actions-cache/cache_v2.go @@ -5,6 +5,7 @@ import ( "context" "encoding/json" "io" + "net/http" "strings" "time" @@ -76,17 +77,34 @@ func (c *Cache) uploadV2(ctx context.Context, url string, b Blob) error { func (ce *Entry) downloadV2(ctx context.Context) ReaderAtCloser { return toReaderAtCloser(func(offset int64) (io.ReadCloser, error) { - client, err := blockblob.NewClientWithNoCredential(ce.URL, azureOptions) - if err != nil { - return nil, errors.WithStack(err) + var retried bool + for { + client, err := blockblob.NewClientWithNoCredential(ce.URL, azureOptions) + if err != nil { + return nil, errors.WithStack(err) + } + resp, err := client.DownloadStream(ctx, &blob.DownloadStreamOptions{ + Range: blob.HTTPRange{Offset: offset}, + }) + if err != nil { + if !retried { + // the URL might have expired, so we try to load it again + retried = true + var respErr *azcore.ResponseError + if errors.As(err, &respErr) { + if respErr.StatusCode == http.StatusForbidden || respErr.StatusCode == http.StatusUnauthorized { + Log("reload download URL because error %v", err) + if err := ce.reload(ctx); err != nil { + return nil, errors.WithStack(err) + } + continue // retry with the new URL + } + } + } + return nil, errors.WithStack(err) + } + return resp.Body, nil } - resp, err := client.DownloadStream(ctx, &blob.DownloadStreamOptions{ - Range: blob.HTTPRange{Offset: offset}, - }) - if err != nil { - return nil, errors.WithStack(err) - } - return resp.Body, nil }) } @@ -187,6 +205,15 @@ func (c *Cache) loadV2(ctx context.Context, keys ...string) (*Entry, error) { ce.URL = val.SignedDownloadURL ce.IsAzureBlob = true ce.client = c.opt.Client + ce.reload = func(ctx context.Context) error { + v, err := c.loadV2(ctx, keys...) + if err != nil { + return errors.WithStack(err) + } + ce.URL = v.URL + ce.Key = v.Key + return nil + } return &ce, nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index 4c0903ce44..dbf3be581b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -757,7 +757,7 @@ github.com/mitchellh/hashstructure/v2 # github.com/mitchellh/reflectwalk v1.0.2 ## explicit github.com/mitchellh/reflectwalk -# github.com/moby/buildkit v0.23.1 +# github.com/moby/buildkit v0.23.2 ## explicit; go 1.23.0 github.com/moby/buildkit/api/services/control github.com/moby/buildkit/api/types @@ -1190,7 +1190,7 @@ github.com/tonistiigi/dchapes-mode github.com/tonistiigi/fsutil github.com/tonistiigi/fsutil/copy github.com/tonistiigi/fsutil/types -# github.com/tonistiigi/go-actions-cache v0.0.0-20250611155157-388a2ec8cdf8 +# github.com/tonistiigi/go-actions-cache v0.0.0-20250626083717-378c5ed1ddd9 ## explicit; go 1.23.0 github.com/tonistiigi/go-actions-cache # github.com/tonistiigi/go-archvariant v1.0.0