Ver código fonte

Implement fix to find source config by name if StableSourceConfigID does not exist

jnfrati 3 anos atrás
pai
commit
be66041708
1 arquivos alterados com 13 adições e 2 exclusões
  1. 13 2
      internal/stacks/helpers.go

+ 13 - 2
internal/stacks/helpers.go

@@ -52,9 +52,20 @@ func CloneAppResources(
 			if prevSourceConfig.UID == appResource.StackSourceConfigUID {
 				// find the corresponding new source config
 				for _, newSourceConfig := range newSourceConfigs {
-					if newSourceConfig.StableSourceConfigID == prevSourceConfig.StableSourceConfigID {
-						linkedSourceConfigUID = newSourceConfig.UID
+
+					// If the source config was created previous to the implemntation of StableSourceConfigID
+					// it means that we should check by the name and not the StableSourceConfigID.
+					// This will happen only once for old source configs.
+					if prevSourceConfig.StableSourceConfigID != "" {
+						if newSourceConfig.StableSourceConfigID == prevSourceConfig.StableSourceConfigID {
+							linkedSourceConfigUID = newSourceConfig.UID
+						}
+					} else {
+						if newSourceConfig.Name == prevSourceConfig.Name {
+							linkedSourceConfigUID = newSourceConfig.UID
+						}
 					}
+
 				}
 			}
 		}