Skip to content

Commit

Permalink
[ND-7015] Stylish output the build settings if any are set and differ…
Browse files Browse the repository at this point in the history
…ent than the managed resources

Signed-off-by: Aris Buzachis <[email protected]>
  • Loading branch information
aris-bunnyshell committed Dec 21, 2023
1 parent 38618fc commit 35477c5
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions pkg/formatter/stylish.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,38 @@ func tabulateProjectItem(w *tabwriter.Writer, item *sdk.ProjectItem) {
fmt.Fprintf(w, "%v\t %v\n", "OrganizationID", item.GetOrganization())
fmt.Fprintf(w, "%v\t %v\n", "Name", item.GetName())
fmt.Fprintf(w, "%v\t %v\n", "Environments", item.GetTotalEnvironments())

if buildSettings, ok := item.GetBuildSettingsOk(); ok {

Check failure on line 130 in pkg/formatter/stylish.go

View workflow job for this annotation

GitHub Actions / audit

item.GetBuildSettingsOk undefined (type *sdk.ProjectItem has no field or method GetBuildSettingsOk)
tabulateBuildSettings(w, buildSettings)
}
}

func tabulateBuildSettings(w *tabwriter.Writer, item *sdk.BuildSettingsItem) {

Check failure on line 135 in pkg/formatter/stylish.go

View workflow job for this annotation

GitHub Actions / audit

undefined: sdk.BuildSettingsItem
buildCluster := ""
if useManagedCluster, ok := item.GetUseManagedClusterOk(); ok && !*useManagedCluster {
if k8sCluster, ok := item.GetKubernetesIntegrationOk(); ok && k8sCluster != nil {
buildCluster = *k8sCluster
} else {
buildCluster = "Project cluster"
}
}

if buildCluster != "" {
fmt.Fprintf(w, "%v\t %v\n", "Build Cluster", buildCluster)
}

registryIntegration := ""
if useManagedRegistry, ok := item.GetUseManagedRegistryOk(); ok && !*useManagedRegistry {
if registry, ok := item.GetRegistryIntegrationOk(); ok && registry != nil {
registryIntegration = *registry
} else {
registryIntegration = "Project registry"
}
}

if registryIntegration != "" {
fmt.Fprintf(w, "%v\t %v\n", "Build Registry", registryIntegration)
}
}

func tabulateEnvironmentCollection(w *tabwriter.Writer, data *sdk.PaginatedEnvironmentCollection) {
Expand Down Expand Up @@ -157,6 +189,15 @@ func tabulateEnvironmentItem(w *tabwriter.Writer, item *sdk.EnvironmentItem) {
fmt.Fprintf(w, "\t %v\t %v\n", key, value)
}
}

if buildSettings, ok := item.GetBuildSettingsOk(); ok {
if buildSettings == nil {
fmt.Fprintf(w, "%v\t %v\n", "Build Cluster", "Project cluster")
fmt.Fprintf(w, "%v\t %v\n", "Build Registry", "Project registry")
} else {
tabulateBuildSettings(w, buildSettings)
}
}
}

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

0 comments on commit 35477c5

Please sign in to comment.