diff --git a/acceptance/testdata/pack_fixtures/report_output.txt b/acceptance/testdata/pack_fixtures/report_output.txt index 6161c9216f..88a36e2e2c 100644 --- a/acceptance/testdata/pack_fixtures/report_output.txt +++ b/acceptance/testdata/pack_fixtures/report_output.txt @@ -2,7 +2,7 @@ Pack: Version: {{ .Version }} OS/Arch: {{ .OS }}/{{ .Arch }} -Default Lifecycle Version: 0.19.3 +Default Lifecycle Version: 0.19.6 Supported Platform APIs: 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.10, 0.11, 0.12, 0.13 diff --git a/go.mod b/go.mod index c6c80f0340..12d3c8f7be 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/Microsoft/go-winio v0.6.2 github.com/apex/log v1.9.0 github.com/buildpacks/imgutil v0.0.0-20240507132533-9f7b96c3d09d - github.com/buildpacks/lifecycle v0.19.4 + github.com/buildpacks/lifecycle v0.19.6 github.com/docker/cli v26.1.1+incompatible github.com/docker/docker v26.1.1+incompatible github.com/docker/go-connections v0.5.0 diff --git a/go.sum b/go.sum index a7219f09ea..4fe11ffdee 100644 --- a/go.sum +++ b/go.sum @@ -93,8 +93,8 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/buildpacks/imgutil v0.0.0-20240507132533-9f7b96c3d09d h1:GVRuY/C8j4pjOddeeZelbKKLMMX+dYR3TlxE4L1hECU= github.com/buildpacks/imgutil v0.0.0-20240507132533-9f7b96c3d09d/go.mod h1:n2R6VRuWsAX3cyHCp/u0Z4WJcixny0gYg075J39owrk= -github.com/buildpacks/lifecycle v0.19.4 h1:lATTWyMs4m4+3+n6PgvmB0lBgut2+b8eZ+iu/wXwhrI= -github.com/buildpacks/lifecycle v0.19.4/go.mod h1:sWrBJzf/7dWrcHrWiV/P2+3jS8G8Ki5tczq8jO3XVRQ= +github.com/buildpacks/lifecycle v0.19.6 h1:/bmfMs35aSkxyzYDF+iHl9VnYmUBBbHBmnvo8XNEINk= +github.com/buildpacks/lifecycle v0.19.6/go.mod h1:sWrBJzf/7dWrcHrWiV/P2+3jS8G8Ki5tczq8jO3XVRQ= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= diff --git a/internal/builder/lifecycle.go b/internal/builder/lifecycle.go index c41799198e..92c860ae9d 100644 --- a/internal/builder/lifecycle.go +++ b/internal/builder/lifecycle.go @@ -14,7 +14,7 @@ import ( // A snapshot of the latest tested lifecycle version values const ( - DefaultLifecycleVersion = "0.19.3" + DefaultLifecycleVersion = "0.19.6" DefaultBuildpackAPIVersion = "0.2" ) diff --git a/pkg/blob/downloader.go b/pkg/blob/downloader.go index 9e00d97c1e..53c46e5a99 100644 --- a/pkg/blob/downloader.go +++ b/pkg/blob/downloader.go @@ -28,6 +28,14 @@ type Logger interface { Writer() io.Writer } +type DownloaderOption func(d *downloader) + +func WithClient(client *http.Client) DownloaderOption { + return func(d *downloader) { + d.client = client + } +} + type Downloader interface { Download(ctx context.Context, pathOrURI string) (Blob, error) } @@ -35,13 +43,21 @@ type Downloader interface { type downloader struct { logger Logger baseCacheDir string + client *http.Client } -func NewDownloader(logger Logger, baseCacheDir string) Downloader { - return &downloader{ +func NewDownloader(logger Logger, baseCacheDir string, opts ...DownloaderOption) Downloader { + d := &downloader{ logger: logger, baseCacheDir: baseCacheDir, + client: http.DefaultClient, } + + for _, opt := range opts { + opt(d) + } + + return d } func (d *downloader) Download(ctx context.Context, pathOrURI string) (Blob, error) { @@ -146,7 +162,7 @@ func (d *downloader) downloadAsStream(ctx context.Context, uri string, etag stri req.Header.Set("If-None-Match", etag) } - resp, err := (&http.Client{}).Do(req) //nolint:bodyclose + resp, err := d.client.Do(req) //nolint:bodyclose if err != nil { return nil, "", err }