99
1010 "github.com/Masterminds/semver"
1111 "github.com/buildpacks/imgutil"
12+ "github.com/google/go-containerregistry/pkg/v1/types"
1213 "github.com/pkg/errors"
1314 "golang.org/x/text/cases"
1415 "golang.org/x/text/language"
@@ -84,16 +85,16 @@ func (c *Client) CreateBuilder(ctx context.Context, opts CreateBuilderOptions) e
8485
8586 var digests []string
8687 for _ , target := range targets {
87- bldr , err := c .createBaseBuilder (ctx , opts , target , multiArch )
88+ bldr , err := c .createBaseBuilder (ctx , opts , target )
8889 if err != nil {
8990 return errors .Wrap (err , "failed to create builder" )
9091 }
9192
92- if err := c .addBuildpacksToBuilder (ctx , opts , bldr , multiArch ); err != nil {
93+ if err := c .addBuildpacksToBuilder (ctx , opts , bldr ); err != nil {
9394 return errors .Wrap (err , "failed to add buildpacks to builder" )
9495 }
9596
96- if err := c .addExtensionsToBuilder (ctx , opts , bldr , false ); err != nil {
97+ if err := c .addExtensionsToBuilder (ctx , opts , bldr ); err != nil {
9798 return errors .Wrap (err , "failed to add extensions to builder" )
9899 }
99100
@@ -123,9 +124,11 @@ func (c *Client) CreateBuilder(ctx context.Context, opts CreateBuilderOptions) e
123124
124125 if multiArch && len (digests ) > 1 {
125126 return c .CreateManifest (ctx , CreateManifestOptions {
126- ManifestName : opts .BuilderName ,
127- Manifests : digests ,
128- Publish : true ,
127+ IndexRepoName : opts .BuilderName ,
128+ RepoNames : digests ,
129+ Publish : true ,
130+ // TODO: If we do not specify the media type we get an error that can't be empty.
131+ Format : types .OCIImageIndex ,
129132 })
130133 }
131134
@@ -193,8 +196,8 @@ func (c *Client) validateRunImageConfig(ctx context.Context, opts CreateBuilderO
193196 return nil
194197}
195198
196- func (c * Client ) createBaseBuilder (ctx context.Context , opts CreateBuilderOptions , target dist.Target , multiarch bool ) (* builder.Builder , error ) {
197- baseImage , err := c .imageFetcher .Fetch (ctx , opts .Config .Build .Image , image.FetchOptions {Daemon : ! opts .Publish , PullPolicy : opts .PullPolicy , Platform : fmt .Sprintf ("%s/%s" , target .OS , target .Arch ), Target : & target , MultiArch : multiarch })
199+ func (c * Client ) createBaseBuilder (ctx context.Context , opts CreateBuilderOptions , target dist.Target ) (* builder.Builder , error ) {
200+ baseImage , err := c .imageFetcher .Fetch (ctx , opts .Config .Build .Image , image.FetchOptions {Daemon : ! opts .Publish , PullPolicy : opts .PullPolicy , Platform : fmt .Sprintf ("%s/%s" , target .OS , target .Arch ), Target : & target })
198201 if err != nil {
199202 return nil , errors .Wrap (err , "fetch build image" )
200203 }
@@ -289,25 +292,25 @@ func (c *Client) fetchLifecycle(ctx context.Context, config pubbldr.LifecycleCon
289292 return lifecycle , nil
290293}
291294
292- func (c * Client ) addBuildpacksToBuilder (ctx context.Context , opts CreateBuilderOptions , bldr * builder.Builder , multiarch bool ) error {
295+ func (c * Client ) addBuildpacksToBuilder (ctx context.Context , opts CreateBuilderOptions , bldr * builder.Builder ) error {
293296 for _ , b := range opts .Config .Buildpacks {
294- if err := c .addConfig (ctx , buildpack .KindBuildpack , b , opts , bldr , multiarch ); err != nil {
297+ if err := c .addConfig (ctx , buildpack .KindBuildpack , b , opts , bldr ); err != nil {
295298 return err
296299 }
297300 }
298301 return nil
299302}
300303
301- func (c * Client ) addExtensionsToBuilder (ctx context.Context , opts CreateBuilderOptions , bldr * builder.Builder , multiarch bool ) error {
304+ func (c * Client ) addExtensionsToBuilder (ctx context.Context , opts CreateBuilderOptions , bldr * builder.Builder ) error {
302305 for _ , e := range opts .Config .Extensions {
303- if err := c .addConfig (ctx , buildpack .KindExtension , e , opts , bldr , multiarch ); err != nil {
306+ if err := c .addConfig (ctx , buildpack .KindExtension , e , opts , bldr ); err != nil {
304307 return err
305308 }
306309 }
307310 return nil
308311}
309312
310- func (c * Client ) addConfig (ctx context.Context , kind string , config pubbldr.ModuleConfig , opts CreateBuilderOptions , bldr * builder.Builder , multiarch bool ) error {
313+ func (c * Client ) addConfig (ctx context.Context , kind string , config pubbldr.ModuleConfig , opts CreateBuilderOptions , bldr * builder.Builder ) error {
311314 c .logger .Debugf ("Looking up %s %s" , kind , style .Symbol (config .DisplayString ()))
312315
313316 builderOS , err := bldr .Image ().OS ()
@@ -332,7 +335,6 @@ func (c *Client) addConfig(ctx context.Context, kind string, config pubbldr.Modu
332335 RegistryName : opts .Registry ,
333336 RelativeBaseDir : opts .RelativeBaseDir ,
334337 Target : & dist.Target {OS : builderOS , Arch : builderArch },
335- Multiarch : multiarch ,
336338 })
337339 if err != nil {
338340 return errors .Wrapf (err , "downloading %s" , kind )
0 commit comments