bump stereoscope to include functional options (#823)

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
Alex Goodman
2022-02-14 20:40:51 -05:00
committed by GitHub
parent e1e9ccb401
commit 51c6eb30f5
6 changed files with 25 additions and 6 deletions
+7 -2
View File
@@ -90,7 +90,12 @@ func parseScheme(userInput string) string {
func getImageWithRetryStrategy(userInput, location string, imageSource image.Source, registryOptions *image.RegistryOptions) (*image.Image, func(), error) {
ctx := context.TODO()
img, err := stereoscope.GetImageFromSource(ctx, location, imageSource, registryOptions)
var opts []stereoscope.Option
if registryOptions != nil {
opts = append(opts, stereoscope.WithRegistryOptions(*registryOptions))
}
img, err := stereoscope.GetImageFromSource(ctx, location, imageSource, opts...)
if err == nil {
// Success on the first try!
return img, stereoscope.Cleanup, nil
@@ -120,7 +125,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(ctx, userInput, imageSource, registryOptions)
img, err = stereoscope.GetImageFromSource(ctx, userInput, imageSource, opts...)
if err != nil {
return nil, nil, err
}