Skip to content

Commit

Permalink
Use defined host when not equal to target
Browse files Browse the repository at this point in the history
  • Loading branch information
jpreese committed Jul 27, 2020
1 parent c2e899a commit 41d4db6
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions internal/manifest/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,18 @@ func (m Manifest) Update(images []string) Manifest {
//
// In the event the source cannot be found in the manifest, we must rely on
// trying to find the source registry from the repository the image is sourced from.
//
// This is more of a nice-to-have. The worst case is that we get it wrong and the
// user has to update the host value to the correct one. Once defined in the manifest
// we can continue to use the host that was set.
foundSource, exists := m.findSourceInManifest(updatedImage)
if !exists {
updatedSource.Host = getSourceHostFromRepository(updatedRegistryPath.Repository())

// When the source host and the target host are the same, this means that the
// images that were retrieved are target images.
//
// When the source host and target host are different, we can safely use the
// host found in the image definition as the source.
updatedSource.Host = updatedRegistryPath.Host()
if updatedRegistryPath.Host() == m.Target.Host {
updatedSource.Host = getSourceHostFromRepository(updatedRegistryPath.Repository())
}

updatedRepository := updatedRegistryPath.Repository()
updatedRepository = strings.Replace(updatedRepository, m.Target.Repository, "", 1)
Expand Down

0 comments on commit 41d4db6

Please sign in to comment.