Skip to content

Commit 35477c5

Browse files
[ND-7015] Stylish output the build settings if any are set and different than the managed resources
Signed-off-by: Aris Buzachis <[email protected]>
1 parent 38618fc commit 35477c5

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

pkg/formatter/stylish.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,38 @@ func tabulateProjectItem(w *tabwriter.Writer, item *sdk.ProjectItem) {
126126
fmt.Fprintf(w, "%v\t %v\n", "OrganizationID", item.GetOrganization())
127127
fmt.Fprintf(w, "%v\t %v\n", "Name", item.GetName())
128128
fmt.Fprintf(w, "%v\t %v\n", "Environments", item.GetTotalEnvironments())
129+
130+
if buildSettings, ok := item.GetBuildSettingsOk(); ok {
131+
tabulateBuildSettings(w, buildSettings)
132+
}
133+
}
134+
135+
func tabulateBuildSettings(w *tabwriter.Writer, item *sdk.BuildSettingsItem) {
136+
buildCluster := ""
137+
if useManagedCluster, ok := item.GetUseManagedClusterOk(); ok && !*useManagedCluster {
138+
if k8sCluster, ok := item.GetKubernetesIntegrationOk(); ok && k8sCluster != nil {
139+
buildCluster = *k8sCluster
140+
} else {
141+
buildCluster = "Project cluster"
142+
}
143+
}
144+
145+
if buildCluster != "" {
146+
fmt.Fprintf(w, "%v\t %v\n", "Build Cluster", buildCluster)
147+
}
148+
149+
registryIntegration := ""
150+
if useManagedRegistry, ok := item.GetUseManagedRegistryOk(); ok && !*useManagedRegistry {
151+
if registry, ok := item.GetRegistryIntegrationOk(); ok && registry != nil {
152+
registryIntegration = *registry
153+
} else {
154+
registryIntegration = "Project registry"
155+
}
156+
}
157+
158+
if registryIntegration != "" {
159+
fmt.Fprintf(w, "%v\t %v\n", "Build Registry", registryIntegration)
160+
}
129161
}
130162

131163
func tabulateEnvironmentCollection(w *tabwriter.Writer, data *sdk.PaginatedEnvironmentCollection) {
@@ -157,6 +189,15 @@ func tabulateEnvironmentItem(w *tabwriter.Writer, item *sdk.EnvironmentItem) {
157189
fmt.Fprintf(w, "\t %v\t %v\n", key, value)
158190
}
159191
}
192+
193+
if buildSettings, ok := item.GetBuildSettingsOk(); ok {
194+
if buildSettings == nil {
195+
fmt.Fprintf(w, "%v\t %v\n", "Build Cluster", "Project cluster")
196+
fmt.Fprintf(w, "%v\t %v\n", "Build Registry", "Project registry")
197+
} else {
198+
tabulateBuildSettings(w, buildSettings)
199+
}
200+
}
160201
}
161202

162203
func tabulateComponentCollection(w *tabwriter.Writer, data *sdk.PaginatedComponentCollection) {

0 commit comments

Comments
 (0)