Restore original images only if there are no remote manifests
Fixes
@@ -149,7 +149,10 @@ func (k *KubectlDeployer) Cleanup(ctx context.Context, out io.Writer) error {
return errors.Wrap(err, "reading manifests")
}
- // pull remote manifests
+ // revert remote manifests
+ // TODO(dgageot): That seems super dangerous and I don't understand
+ // why we need to update resources just before we delete them.
+ if len(k.RemoteManifests) > 0 {
var rm deploy.ManifestList
for _, m := range k.RemoteManifests {
manifest, err := k.readRemoteManifest(ctx, m)
@@ -165,6 +168,8 @@ func (k *KubectlDeployer) Cleanup(ctx context.Context, out io.Writer) error {
if err := k.kubectl.Apply(ctx, out, upd); err != nil {
return errors.Wrap(err, "apply original")
}
+ }
+
if err := k.kubectl.Delete(ctx, out, manifests); err != nil {
return errors.Wrap(err, "delete")
}
