Przeglądaj źródła

hotfix panic from cli on preview envs

Alexander Belanger 3 lat temu
rodzic
commit
d27d76784d
1 zmienionych plików z 14 dodań i 5 usunięć
  1. 14 5
      cli/cmd/apply.go

+ 14 - 5
cli/cmd/apply.go

@@ -865,10 +865,15 @@ func (t *DeploymentHook) PostApply(populatedData map[string]interface{}) error {
 	}
 
 	for _, res := range t.resourceGroup.Resources {
-		req.SuccessfulResources = append(req.SuccessfulResources, &types.SuccessfullyDeployedResource{
-			ReleaseName: getReleaseName(res),
-			ReleaseType: getReleaseType(res),
-		})
+		releaseType := getReleaseType(res)
+		releaseName := getReleaseName(res)
+
+		if releaseType != "" && releaseName != "" {
+			req.SuccessfulResources = append(req.SuccessfulResources, &types.SuccessfullyDeployedResource{
+				ReleaseName: releaseName,
+				ReleaseType: releaseType,
+			})
+		}
 	}
 
 	// finalize the deployment
@@ -1056,5 +1061,9 @@ func getReleaseType(res *switchboardTypes.Resource) string {
 	// GetSource has alrealy been called and validated previously
 	source, _ := preview.GetSource(res.Source)
 
-	return source.Name
+	if source != nil && source.Name != "" {
+		return source.Name
+	}
+
+	return ""
 }