diff options
author | Anton Evangelatov <anton.evangelatov@gmail.com> | 2018-11-30 00:43:15 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-11-30 00:43:15 +0800 |
commit | 7e7781ffaa5c5486c5e7b66dea4986e063524f63 (patch) | |
tree | e872b76d139caebc9a115dd46a7388c23235edba /cmd | |
parent | 01371469e60ead5c442cefb71351583aabb1fc82 (diff) | |
download | go-tangerine-7e7781ffaa5c5486c5e7b66dea4986e063524f63.tar.gz go-tangerine-7e7781ffaa5c5486c5e7b66dea4986e063524f63.tar.zst go-tangerine-7e7781ffaa5c5486c5e7b66dea4986e063524f63.zip |
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
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/swarm/swarm-smoke/feed_upload_and_sync.go | 2 | ||||
-rw-r--r-- | cmd/swarm/swarm-smoke/main.go | 8 | ||||
-rw-r--r-- | cmd/swarm/swarm-smoke/upload_and_sync.go | 11 |
3 files changed, 14 insertions, 7 deletions
diff --git a/cmd/swarm/swarm-smoke/feed_upload_and_sync.go b/cmd/swarm/swarm-smoke/feed_upload_and_sync.go index 0328d656f..7ec152826 100644 --- a/cmd/swarm/swarm-smoke/feed_upload_and_sync.go +++ b/cmd/swarm/swarm-smoke/feed_upload_and_sync.go @@ -33,7 +33,7 @@ func cliFeedUploadAndSync(c *cli.Context) error { defer func(now time.Time) { log.Info("total time", "time", time.Since(now), "size (kb)", filesize) }(time.Now()) - generateEndpoints(scheme, cluster, from, to) + generateEndpoints(scheme, cluster, appName, from, to) log.Info("generating and uploading feeds to " + endpoints[0] + " and syncing") diff --git a/cmd/swarm/swarm-smoke/main.go b/cmd/swarm/swarm-smoke/main.go index 4ff17fd5b..845998dc1 100644 --- a/cmd/swarm/swarm-smoke/main.go +++ b/cmd/swarm/swarm-smoke/main.go @@ -29,6 +29,7 @@ var ( endpoints []string includeLocalhost bool cluster string + appName string scheme string filesize int from int @@ -49,6 +50,12 @@ func main() { Usage: "cluster to point to (prod or a given namespace)", Destination: &cluster, }, + cli.StringFlag{ + Name: "app", + Value: "swarm", + Usage: "application to point to (swarm or swarm-private)", + Destination: &appName, + }, cli.IntFlag{ Name: "cluster-from", Value: 8501, @@ -107,5 +114,6 @@ func main() { err := app.Run(os.Args) if err != nil { log.Error(err.Error()) + os.Exit(1) } } diff --git a/cmd/swarm/swarm-smoke/upload_and_sync.go b/cmd/swarm/swarm-smoke/upload_and_sync.go index 7872421d3..3843457dc 100644 --- a/cmd/swarm/swarm-smoke/upload_and_sync.go +++ b/cmd/swarm/swarm-smoke/upload_and_sync.go @@ -33,20 +33,19 @@ import ( "time" "github.com/ethereum/go-ethereum/log" - colorable "github.com/mattn/go-colorable" "github.com/pborman/uuid" cli "gopkg.in/urfave/cli.v1" ) -func generateEndpoints(scheme string, cluster string, from int, to int) { +func generateEndpoints(scheme string, cluster string, app string, from int, to int) { if cluster == "prod" { for port := from; port <= to; port++ { endpoints = append(endpoints, fmt.Sprintf("%s://%v.swarm-gateways.net", scheme, port)) } } else { for port := from; port <= to; port++ { - endpoints = append(endpoints, fmt.Sprintf("%s://swarm-%v-%s.stg.swarm-gateways.net", scheme, port, cluster)) + endpoints = append(endpoints, fmt.Sprintf("%s://%s-%v-%s.stg.swarm-gateways.net", scheme, app, port, cluster)) } } @@ -57,11 +56,11 @@ func generateEndpoints(scheme string, cluster string, from int, to int) { func cliUploadAndSync(c *cli.Context) error { log.PrintOrigins(true) - log.Root().SetHandler(log.LvlFilterHandler(log.Lvl(verbosity), log.StreamHandler(colorable.NewColorableStderr(), log.TerminalFormat(true)))) + log.Root().SetHandler(log.LvlFilterHandler(log.Lvl(verbosity), log.StreamHandler(os.Stdout, log.TerminalFormat(true)))) - defer func(now time.Time) { log.Info("total time", "time", time.Since(now), "size (kb)", filesize) }(time.Now()) + defer func(now time.Time) { log.Info("total time", "time", time.Since(now), "kb", filesize) }(time.Now()) - generateEndpoints(scheme, cluster, from, to) + generateEndpoints(scheme, cluster, appName, from, to) log.Info("uploading to " + endpoints[0] + " and syncing") |