Skip to content
This repository was archived by the owner on Aug 2, 2021. It is now read-only.

Commit 9491c65

Browse files
nonsensenolash
authored andcommitted
cmd/swarm: add flag for application name (swarm or swarm-private) (#18189)
* cmd/swarm: add flag for application name (swarm or swarm-private) * cmd/swarm/swarm-smoke: return correct exit code * cmd/swarm/swarm-smoke: remove colorable * remove swarm/grafana_dashboards
1 parent af44980 commit 9491c65

File tree

5 files changed

+14
-5483
lines changed

5 files changed

+14
-5483
lines changed

cmd/swarm/swarm-smoke/feed_upload_and_sync.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func cliFeedUploadAndSync(c *cli.Context) error {
3333

3434
defer func(now time.Time) { log.Info("total time", "time", time.Since(now), "size (kb)", filesize) }(time.Now())
3535

36-
generateEndpoints(scheme, cluster, from, to)
36+
generateEndpoints(scheme, cluster, appName, from, to)
3737

3838
log.Info("generating and uploading feeds to " + endpoints[0] + " and syncing")
3939

cmd/swarm/swarm-smoke/main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ var (
2929
endpoints []string
3030
includeLocalhost bool
3131
cluster string
32+
appName string
3233
scheme string
3334
filesize int
3435
from int
@@ -49,6 +50,12 @@ func main() {
4950
Usage: "cluster to point to (prod or a given namespace)",
5051
Destination: &cluster,
5152
},
53+
cli.StringFlag{
54+
Name: "app",
55+
Value: "swarm",
56+
Usage: "application to point to (swarm or swarm-private)",
57+
Destination: &appName,
58+
},
5259
cli.IntFlag{
5360
Name: "cluster-from",
5461
Value: 8501,
@@ -107,5 +114,6 @@ func main() {
107114
err := app.Run(os.Args)
108115
if err != nil {
109116
log.Error(err.Error())
117+
os.Exit(1)
110118
}
111119
}

cmd/swarm/swarm-smoke/upload_and_sync.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,19 @@ import (
3333
"time"
3434

3535
"github.com/ethereum/go-ethereum/log"
36-
colorable "github.com/mattn/go-colorable"
3736
"github.com/pborman/uuid"
3837

3938
cli "gopkg.in/urfave/cli.v1"
4039
)
4140

42-
func generateEndpoints(scheme string, cluster string, from int, to int) {
41+
func generateEndpoints(scheme string, cluster string, app string, from int, to int) {
4342
if cluster == "prod" {
4443
for port := from; port <= to; port++ {
4544
endpoints = append(endpoints, fmt.Sprintf("%s://%v.swarm-gateways.net", scheme, port))
4645
}
4746
} else {
4847
for port := from; port <= to; port++ {
49-
endpoints = append(endpoints, fmt.Sprintf("%s://swarm-%v-%s.stg.swarm-gateways.net", scheme, port, cluster))
48+
endpoints = append(endpoints, fmt.Sprintf("%s://%s-%v-%s.stg.swarm-gateways.net", scheme, app, port, cluster))
5049
}
5150
}
5251

@@ -57,11 +56,11 @@ func generateEndpoints(scheme string, cluster string, from int, to int) {
5756

5857
func cliUploadAndSync(c *cli.Context) error {
5958
log.PrintOrigins(true)
60-
log.Root().SetHandler(log.LvlFilterHandler(log.Lvl(verbosity), log.StreamHandler(colorable.NewColorableStderr(), log.TerminalFormat(true))))
59+
log.Root().SetHandler(log.LvlFilterHandler(log.Lvl(verbosity), log.StreamHandler(os.Stdout, log.TerminalFormat(true))))
6160

62-
defer func(now time.Time) { log.Info("total time", "time", time.Since(now), "size (kb)", filesize) }(time.Now())
61+
defer func(now time.Time) { log.Info("total time", "time", time.Since(now), "kb", filesize) }(time.Now())
6362

64-
generateEndpoints(scheme, cluster, from, to)
63+
generateEndpoints(scheme, cluster, appName, from, to)
6564

6665
log.Info("uploading to " + endpoints[0] + " and syncing")
6766

0 commit comments

Comments
 (0)