@@ -29,7 +29,6 @@ import (
2929 "github.com/moby/buildkit/session/auth/authprovider"
3030 "github.com/moby/buildkit/util/entitlements"
3131 "github.com/pkg/errors"
32- "github.com/tonistiigi/go-csvvalue"
3332 "github.com/zclconf/go-cty/cty"
3433 "github.com/zclconf/go-cty/cty/convert"
3534)
@@ -900,7 +899,7 @@ func (t *Target) AddOverrides(overrides map[string]Override, ent *EntitlementCon
900899 case "tags" :
901900 t .Tags = o .ArrValue
902901 case "cache-from" :
903- cacheFrom , err := parseCacheArrValues (o .ArrValue )
902+ cacheFrom , err := buildflags . ParseCacheEntry (o .ArrValue )
904903 if err != nil {
905904 return err
906905 }
@@ -913,7 +912,7 @@ func (t *Target) AddOverrides(overrides map[string]Override, ent *EntitlementCon
913912 }
914913 }
915914 case "cache-to" :
916- cacheTo , err := parseCacheArrValues (o .ArrValue )
915+ cacheTo , err := buildflags . ParseCacheEntry (o .ArrValue )
917916 if err != nil {
918917 return err
919918 }
@@ -1585,37 +1584,3 @@ func parseArrValue[T any, PT arrValue[T]](s []string) ([]*T, error) {
15851584 }
15861585 return outputs , nil
15871586}
1588-
1589- func parseCacheArrValues (s []string ) (buildflags.CacheOptions , error ) {
1590- var outs buildflags.CacheOptions
1591- for _ , in := range s {
1592- if in == "" {
1593- continue
1594- }
1595-
1596- if ! strings .Contains (in , "=" ) {
1597- // This is ref only format. Each field in the CSV is its own entry.
1598- fields , err := csvvalue .Fields (in , nil )
1599- if err != nil {
1600- return nil , err
1601- }
1602-
1603- for _ , field := range fields {
1604- out := buildflags.CacheOptionsEntry {}
1605- if err := out .UnmarshalText ([]byte (field )); err != nil {
1606- return nil , err
1607- }
1608- outs = append (outs , & out )
1609- }
1610- continue
1611- }
1612-
1613- // Normal entry.
1614- out := buildflags.CacheOptionsEntry {}
1615- if err := out .UnmarshalText ([]byte (in )); err != nil {
1616- return nil , err
1617- }
1618- outs = append (outs , & out )
1619- }
1620- return outs , nil
1621- }
0 commit comments