File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,13 +75,18 @@ func (m Manifest) Update(images []string) Manifest {
7575 //
7676 // In the event the source cannot be found in the manifest, we must rely on
7777 // trying to find the source registry from the repository the image is sourced from.
78- //
79- // This is more of a nice-to-have. The worst case is that we get it wrong and the
80- // user has to update the host value to the correct one. Once defined in the manifest
81- // we can continue to use the host that was set.
8278 foundSource , exists := m .findSourceInManifest (updatedImage )
8379 if ! exists {
84- updatedSource .Host = getSourceHostFromRepository (updatedRegistryPath .Repository ())
80+
81+ // When the source host and the target host are the same, this means that the
82+ // images that were retrieved are target images.
83+ //
84+ // When the source host and target host are different, we can safely use the
85+ // host found in the image definition as the source.
86+ updatedSource .Host = updatedRegistryPath .Host ()
87+ if updatedRegistryPath .Host () == m .Target .Host {
88+ updatedSource .Host = getSourceHostFromRepository (updatedRegistryPath .Repository ())
89+ }
8590
8691 updatedRepository := updatedRegistryPath .Repository ()
8792 updatedRepository = strings .Replace (updatedRepository , m .Target .Repository , "" , 1 )
You can’t perform that action at this time.
0 commit comments