From a04fa68539b98c238f46b31f789aaeb924ad4f97 Mon Sep 17 00:00:00 2001 From: Jonas Xavier Date: Wed, 9 Feb 2022 11:23:58 -0800 Subject: [PATCH] Ensure completion of UI progress bar (#810) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * update stereoscope fetches latest fixes for UI Signed-off-by: Jonas Galvão Xavier * use context when getting image Signed-off-by: Jonas Galvão Xavier --- go.mod | 2 +- go.sum | 4 ++-- syft/source/source.go | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 75dfa6cd58f5..340e2e66688e 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/anchore/go-testutils v0.0.0-20200925183923-d5f45b0d3c04 github.com/anchore/go-version v1.2.2-0.20200701162849-18adb9c92b9b github.com/anchore/packageurl-go v0.0.0-20210922164639-b3fa992ebd29 - github.com/anchore/stereoscope v0.0.0-20220201190559-f162f1e96f45 + github.com/anchore/stereoscope v0.0.0-20220209160132-2e595043fa19 github.com/antihax/optional v1.0.0 github.com/bmatcuk/doublestar/v4 v4.0.2 github.com/docker/docker v20.10.12+incompatible diff --git a/go.sum b/go.sum index c815d2e1e361..a3ded79203f0 100644 --- a/go.sum +++ b/go.sum @@ -111,8 +111,8 @@ github.com/anchore/go-version v1.2.2-0.20200701162849-18adb9c92b9b h1:e1bmaoJfZV github.com/anchore/go-version v1.2.2-0.20200701162849-18adb9c92b9b/go.mod h1:Bkc+JYWjMCF8OyZ340IMSIi2Ebf3uwByOk6ho4wne1E= github.com/anchore/packageurl-go v0.0.0-20210922164639-b3fa992ebd29 h1:K9LfnxwhqvihqU0+MF325FNy7fsKV9EGaUxdfR4gnWk= github.com/anchore/packageurl-go v0.0.0-20210922164639-b3fa992ebd29/go.mod h1:Oc1UkGaJwY6ND6vtAqPSlYrptKRJngHwkwB6W7l1uP0= -github.com/anchore/stereoscope v0.0.0-20220201190559-f162f1e96f45 h1:GYwI1qXcGh7fmyUWLK41suUXYfmrvGWWKGh0cw+k6ug= -github.com/anchore/stereoscope v0.0.0-20220201190559-f162f1e96f45/go.mod h1:QpDHHV2h1NNfu7klzU75XC8RvSlaPK6HHgi0dy8A6sk= +github.com/anchore/stereoscope v0.0.0-20220209160132-2e595043fa19 h1:INJWzjqSo4uF5NrYISnIfIpnmgV+nfYwbrL8nnmIz7g= +github.com/anchore/stereoscope v0.0.0-20220209160132-2e595043fa19/go.mod h1:QpDHHV2h1NNfu7klzU75XC8RvSlaPK6HHgi0dy8A6sk= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= diff --git a/syft/source/source.go b/syft/source/source.go index 2f3ab8e80791..91d754e65ae5 100644 --- a/syft/source/source.go +++ b/syft/source/source.go @@ -6,6 +6,7 @@ within this package. package source import ( + "context" "fmt" "io/ioutil" "os" @@ -87,7 +88,9 @@ func parseScheme(userInput string) string { } func getImageWithRetryStrategy(userInput, location string, imageSource image.Source, registryOptions *image.RegistryOptions) (*image.Image, func(), error) { - img, err := stereoscope.GetImageFromSource(location, imageSource, registryOptions) + ctx := context.TODO() + + img, err := stereoscope.GetImageFromSource(ctx, location, imageSource, registryOptions) if err == nil { // Success on the first try! return img, stereoscope.Cleanup, nil @@ -117,7 +120,7 @@ func getImageWithRetryStrategy(userInput, location string, imageSource image.Sou // We need to determine the image source again, such that this determination // doesn't take scheme parsing into account. imageSource = image.DetermineImagePullSource(userInput) - img, err = stereoscope.GetImageFromSource(userInput, imageSource, registryOptions) + img, err = stereoscope.GetImageFromSource(ctx, userInput, imageSource, registryOptions) if err != nil { return nil, nil, err }