Skip to content

Commit

Permalink
fix: allow host+subpath as the source registry for registry-override (#…
Browse files Browse the repository at this point in the history
…2135)

Instead of looking for refInfo.Host in the override map loop through the keys and values in i.RegistryOverrides, check if the refInfo.Reference begins with an override key and, if it does, replace that override text with the override value and set it back to actualSrc.

Do not use ImageTransformHostWithoutChecksum since we already have the parsed ref and all the info we need to do the replacement.

default actualSrc to refInfo.Reference

Signed-off-by: Vibhav Bobade <vibhav.bobde@gmail.com>
  • Loading branch information
waveywaves committed Feb 20, 2024
1 parent 84b673e commit addf6d2
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/internal/packager/images/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,9 @@ func (i *ImageConfig) PullAll() ([]ImgInfo, error) {
}

actualSrc := refInfo.Reference
if overrideHost, present := i.RegistryOverrides[refInfo.Host]; present {
var err error
actualSrc, err = transform.ImageTransformHostWithoutChecksum(overrideHost, refInfo.Reference)
if err != nil {
metadataImageConcurrency.ErrorChan <- fmt.Errorf("failed to swap override host %s for %s: %w", overrideHost, refInfo.Reference, err)
return
for k, v := range i.RegistryOverrides {
if strings.HasPrefix(refInfo.Reference, k) {
actualSrc = strings.Replace(refInfo.Reference, k, v, 1)
}
}

Expand Down

0 comments on commit addf6d2

Please sign in to comment.