fix(ecs): Add validation for empty serviceDiscoveryAssociations
MODIFY
clouddriver-ecs/src/main/java/com/netflix/spinnaker/clouddriver/ecs/deploy/validators/EcsCreateServerGroupDescriptionValidator.java
clouddriver-ecs/src/main/java/com/netflix/spinnaker/clouddriver/ecs/deploy/validators/EcsCreateServerGroupDescriptionValidator.java
@@ -103,6 +103,15 @@ public class EcsCreateServerGroupDescriptionValidator extends CommonValidator {
rejectValue(errors, "ecsClusterName", "not.nullable");
}
+ if (createServerGroupDescription.getServiceDiscoveryAssociations() != null) {
+ for (CreateServerGroupDescription.ServiceDiscoveryAssociation association :
+ createServerGroupDescription.getServiceDiscoveryAssociations()) {
+ if (association.getRegistry() == null) {
+ rejectValue(errors, "serviceDiscoveryAssociations", "item.invalid");
+ }
+ }
+ }
+
boolean hasTargetGroup = StringUtils.isNotBlank(createServerGroupDescription.getTargetGroup());
if (!createServerGroupDescription.isUseTaskDefinitionArtifact()) {

fix(ecs): Add validation for empty serviceDiscoveryAssociations (#4337)