Skip to content

Commit

Permalink
Image: pass image uri to pull the bundle image
Browse files Browse the repository at this point in the history
It will be consumed when user specify the container image to pull.
  • Loading branch information
praveenkumar committed Sep 19, 2022
1 parent 9510982 commit c9c2aaf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions pkg/crc/image/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type imageHandler struct {
imageURI string
}

func uri(preset crcpreset.Preset) string {
func defaultURI(preset crcpreset.Preset) string {
return fmt.Sprintf("//%s/%s:%s", constants.RegistryURI, getImageName(preset), version.GetCRCVersion())
}

Expand Down Expand Up @@ -95,9 +95,12 @@ func getImageName(preset crcpreset.Preset) string {
}
}

func PullBundle(preset crcpreset.Preset) error {
func PullBundle(preset crcpreset.Preset, imageURI string) error {
if imageURI == "" {
imageURI = defaultURI(preset)
}
imgHandler := imageHandler{
imageURI: uri(preset),
imageURI: strings.TrimPrefix(imageURI, "docker:"),
}
destDir, err := os.MkdirTemp(constants.MachineCacheDir, "tmpBundleImage")
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/crc/preflight/preflight_checks_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func fixBundleExtracted(bundlePath string, preset crcpreset.Preset) func() error
// In case of OKD or podman bundle then pull the bundle image from quay
// otherwise use mirror location to download the bundle.
if preset == crcpreset.OKD || preset == crcpreset.Podman {
if err := image.PullBundle(preset); err != nil {
if err := image.PullBundle(preset, ""); err != nil {
return err
}
} else {
Expand Down

0 comments on commit c9c2aaf

Please sign in to comment.