Skip to content

Commit ca7738f

Browse files
authored
Merge pull request #172 from StackVista/renovate/ci-tools
Update CI tools
2 parents 79c345a + 403e2dc commit ca7738f

43 files changed

Lines changed: 162 additions & 102 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
# Require: The version of golangci-lint to use.
6363
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
6464
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
65-
version: v2.9.0
65+
version: v2.15.0
6666

6767
check-license:
6868
name: License scan
@@ -115,7 +115,7 @@ jobs:
115115
# either 'goreleaser' (default) or 'goreleaser-pro'
116116
distribution: goreleaser
117117
# 'latest', 'nightly', or a semver
118-
version: v1.25.1
118+
version: v1.26.2
119119
args: check
120120

121121
test:
@@ -187,7 +187,7 @@ jobs:
187187
# either 'goreleaser' (default) or 'goreleaser-pro'
188188
distribution: goreleaser
189189
# 'latest', 'nightly', or a semver
190-
version: v1.25.1
190+
version: v1.26.2
191191
args: release
192192
- name: Write latest version to file
193193
run: mkdir -p dist && printf '%s\n' "${TAG}" > dist/LATEST_VERSION

‎.golangci.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ linters:
6060
allow-unused: true
6161
exclusions:
6262
generated: lax
63+
rules:
64+
- path: '(_test|test_helper)\.go$'
65+
linters:
66+
- goconst
6367
presets:
6468
- comments
6569
- common-false-positives

‎cmd/context/context_save.go‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import (
1212
)
1313

1414
const (
15-
APIPathFlag = "api-path"
15+
currentContextKey = "current-context"
16+
APIPathFlag = "api-path"
1617
)
1718

1819
type SaveArgs struct {
@@ -112,7 +113,7 @@ func RunContextSaveCommand(args *SaveArgs) func(cli *di.Deps, cmd *cobra.Command
112113

113114
if cli.IsJson() {
114115
cli.Printer.PrintJson(map[string]interface{}{
115-
"current-context": cfg.CurrentContext,
116+
currentContextKey: cfg.CurrentContext,
116117
"context": namedCtx.Context,
117118
})
118119
} else {

‎cmd/context/context_set.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func RunContextSetCommand(args *SetArgs, cli *di.Deps) func(cli *di.Deps, cmd *c
4747

4848
if cli.IsJson() {
4949
cli.Printer.PrintJson(map[string]interface{}{
50-
"current-context": args.Name,
50+
currentContextKey: args.Name,
5151
})
5252
} else {
5353
cli.Printer.PrintLn(fmt.Sprintf("Current context set to %s", args.Name))

‎cmd/context/context_show.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func RunContextShowCommand(cli *di.Deps, cmd *cobra.Command, cfg *config.Config)
3131

3232
if cli.IsJson() {
3333
cli.Printer.PrintJson(map[string]interface{}{
34-
"current-context": ctx.Context,
34+
currentContextKey: ctx.Context,
3535
"name": cfg.CurrentContext,
3636
})
3737
} else {

‎cmd/dashboard/dashboard_apply.go‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ import (
1313
"sigs.k8s.io/kustomize/kyaml/yaml"
1414
)
1515

16+
const (
17+
dashboardKey = "dashboard"
18+
)
19+
1620
// ApplyArgs contains arguments for dashboard apply command
1721
type ApplyArgs struct {
1822
File string
@@ -93,7 +97,7 @@ func createDashboard(cli *di.Deps, api *stackstate_api.APIClient, fileBytes []by
9397

9498
if cli.IsJson() {
9599
cli.Printer.PrintJson(map[string]interface{}{
96-
"dashboard": dashboard,
100+
dashboardKey: dashboard,
97101
})
98102
} else {
99103
cli.Printer.Success(fmt.Sprintf("Dashboard created successfully! ID: %d, Name: %s", dashboard.GetId(), dashboard.GetName()))
@@ -118,7 +122,7 @@ func updateDashboard(cli *di.Deps, api *stackstate_api.APIClient, dashboardId st
118122
patchSchema.SetScope(*scope)
119123
}
120124
}
121-
if dashboardContent, ok := dashboardData["dashboard"]; ok {
125+
if dashboardContent, ok := dashboardData[dashboardKey]; ok {
122126
// Convert dashboard content to PersesDashboard
123127
dashboardBytes, err := yaml.Marshal(dashboardContent)
124128
if err == nil {
@@ -137,7 +141,7 @@ func updateDashboard(cli *di.Deps, api *stackstate_api.APIClient, dashboardId st
137141

138142
if cli.IsJson() {
139143
cli.Printer.PrintJson(map[string]interface{}{
140-
"dashboard": dashboard,
144+
dashboardKey: dashboard,
141145
})
142146
} else {
143147
cli.Printer.Success(fmt.Sprintf("Dashboard updated successfully! ID: %d, Name: %s", dashboard.GetId(), dashboard.GetName()))

‎cmd/dashboard/dashboard_clone.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func RunDashboardCloneCommand(args *CloneArgs) di.CmdWithApiFn {
8585

8686
if cli.IsJson() {
8787
cli.Printer.PrintJson(map[string]interface{}{
88-
"dashboard": clonedDashboard,
88+
dashboardKey: clonedDashboard,
8989
})
9090
} else {
9191
cli.Printer.Success(fmt.Sprintf("Dashboard cloned successfully! New dashboard ID: %d, Name: %s", clonedDashboard.GetId(), clonedDashboard.GetName()))

‎cmd/dashboard/dashboard_edit.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func RunDashboardEditCommand(args *EditArgs) di.CmdWithApiFn {
9999
patchSchema.SetScope(*scope)
100100
}
101101
}
102-
if dashboardContent, ok := editedDashboard["dashboard"]; ok {
102+
if dashboardContent, ok := editedDashboard[dashboardKey]; ok {
103103
// Convert dashboard content to PersesDashboard
104104
dashboardBytes, err := json.Marshal(dashboardContent)
105105
if err == nil {
@@ -118,7 +118,7 @@ func RunDashboardEditCommand(args *EditArgs) di.CmdWithApiFn {
118118

119119
if cli.IsJson() {
120120
cli.Printer.PrintJson(map[string]interface{}{
121-
"dashboard": updatedDashboard,
121+
dashboardKey: updatedDashboard,
122122
})
123123
} else {
124124
cli.Printer.Success(fmt.Sprintf("Dashboard updated successfully! ID: %d, Name: %s", updatedDashboard.GetId(), updatedDashboard.GetName()))

‎cmd/health/health_status.go‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ import (
1111
"github.com/stackvista/stackstate-cli/internal/printer"
1212
)
1313

14+
const (
15+
metricsKey = "metrics"
16+
errorsKey = "errors"
17+
)
18+
1419
type StatusArgs struct {
1520
Urn string
1621
SubStream string
@@ -105,8 +110,8 @@ func RunStreamStatus(cli *di.Deps, api *stackstate_api.APIClient, args *StatusAr
105110
if cli.IsJson() {
106111
json := map[string]interface{}{
107112
"consistency-model": status.ConsistencyModel,
108-
"metrics": streamMetricsToJson(status.AggregateMetrics),
109-
"errors": streamErrorsToJson(status.GlobalErrors),
113+
metricsKey: streamMetricsToJson(status.AggregateMetrics),
114+
errorsKey: streamErrorsToJson(status.GlobalErrors),
110115
}
111116
if status.HasMainStreamStatus() {
112117
json["main-stream"] = subStreamStatusToJson(*status.MainStreamStatus)
@@ -148,7 +153,7 @@ func streamMetricsToTable(metrics stackstate_api.HealthStreamMetrics) printer.Ta
148153
printer.MetricBucketToRow("updates per seconds", metrics.UpdatesPerSecond),
149154
printer.MetricBucketToRow("deletes per seconds", metrics.DeletesPerSecond),
150155
},
151-
MissingTableDataMsg: printer.NotFoundMsg{Types: "metrics"},
156+
MissingTableDataMsg: printer.NotFoundMsg{Types: metricsKey},
152157
}
153158
}
154159

@@ -174,7 +179,7 @@ func streamErrorsToTable(errors []stackstate_api.HealthStreamError) printer.Tabl
174179
return printer.TableData{
175180
Header: []string{"Message", "Count"},
176181
Data: data,
177-
MissingTableDataMsg: printer.NotFoundMsg{Types: "errors"},
182+
MissingTableDataMsg: printer.NotFoundMsg{Types: errorsKey},
178183
}
179184
}
180185

@@ -233,7 +238,7 @@ func streamConsistencyStateToTable(state stackstate_api.HealthSubStreamConsisten
233238
Data: [][]interface{}{
234239
{repeatInterval, expiryInterval, snapshotRepeatInterval, snapshotExpiryInterval, checkpointOffset, checkpointBatchIndex},
235240
},
236-
MissingTableDataMsg: printer.NotFoundMsg{Types: "errors"},
241+
MissingTableDataMsg: printer.NotFoundMsg{Types: errorsKey},
237242
}
238243
}
239244

@@ -251,8 +256,8 @@ func subStreamStatusToJson(status stackstate_api.HealthSubStreamStatus) map[stri
251256
return map[string]interface{}{
252257
"check-state-count": status.CheckStateCount,
253258
"consistency-state": streamConsistencyStateToJson(status.SubStreamState),
254-
"metrics": streamMetricsToJson(status.Metrics),
255-
"errors": streamErrorsToJson(status.Errors),
259+
metricsKey: streamMetricsToJson(status.Metrics),
260+
errorsKey: streamErrorsToJson(status.Errors),
256261
}
257262
}
258263

‎cmd/license/common.go‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,22 @@ import (
55
"github.com/stackvista/stackstate-cli/internal/printer"
66
)
77

8+
const (
9+
stateKey = "state"
10+
)
11+
812
func subscriptionAsTable(subscription *stackstate_api.SubscriptionState) printer.TableData {
913
var header []string
1014
data := make([][]interface{}, 0)
1115
switch l := subscription.GetActualInstance().(type) {
1216
case *stackstate_api.ExpiredSubscription:
13-
header = []string{"state", "tenant", "expiration", "plan"}
17+
header = []string{stateKey, "tenant", "expiration", "plan"}
1418
data = append(data, []interface{}{"expired", l.Subscription.Tenant, expiration(l.Subscription.ExpiryTimestampMs), l.Subscription.Plan})
1519
case *stackstate_api.LicensedSubscription:
16-
header = []string{"state", "tenant", "expiration", "plan"}
20+
header = []string{stateKey, "tenant", "expiration", "plan"}
1721
data = append(data, []interface{}{"valid", l.Subscription.Tenant, expiration(l.Subscription.ExpiryTimestampMs), l.Subscription.Plan})
1822
case *stackstate_api.UnlicensedSubscription:
19-
header = []string{"state", "reason"}
23+
header = []string{stateKey, "reason"}
2024
data = append(data, []interface{}{"unlicensed", l.Reason})
2125
}
2226

0 commit comments

Comments
 (0)