From 6f034408085fd3383f8e9c1ada588ff43bc8988b Mon Sep 17 00:00:00 2001 From: Yousef Haggy Date: Tue, 6 Jul 2021 08:54:45 -0400 Subject: [PATCH] add comments and formatting to create_builder Signed-off-by: Yousef Haggy --- create_builder.go | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/create_builder.go b/create_builder.go index f92fbe0e58..86e24839a4 100644 --- a/create_builder.go +++ b/create_builder.go @@ -203,16 +203,22 @@ func (c *Client) fetchLifecycle(ctx context.Context, config pubbldr.LifecycleCon return lifecycle, nil } -// TODO: Any way to reduce the number of options here? type DownloadBuildpackOptions struct { - RegistryName string + RegistryName string + + // The base directory to use to resolve relative assets RelativeBaseDir string - ImageOS string - Downloader Downloader - Logger logging.Logger - ImageFetcher ImageFetcher - FetchOptions image.FetchOptions - ImageName string + + // The OS of the builder image + ImageOS string + + Downloader Downloader + Logger logging.Logger + ImageFetcher ImageFetcher + FetchOptions image.FetchOptions + + // Deprecated, the older alternative to buildpack URI + ImageName string } func DownloadBuildpack(ctx context.Context, buildpackURI string, opts DownloadBuildpackOptions) (dist.Buildpack, []dist.Buildpack, error) { @@ -274,7 +280,6 @@ func DownloadBuildpack(ctx context.Context, buildpackURI string, opts DownloadBu } default: return nil, nil, fmt.Errorf("error reading %s: invalid locator: %s", buildpackURI, locatorType) - } return mainBP, depBPs, nil } @@ -297,6 +302,9 @@ func (c *Client) addBuildpacksToBuilder(ctx context.Context, opts CreateBuilderO FetchOptions: image.FetchOptions{Daemon: !opts.Publish, PullPolicy: opts.PullPolicy}, ImageName: b.ImageName, }) + if err != nil { + return errors.Wrap(err, "downloading buildpack") + } err = validateBuildpack(mainBP, b.URI, b.ID, b.Version) if err != nil {