@@ -290,6 +290,55 @@ func GetUseDeployReport(cmdData *CmdData) bool {
290290 return * cmdData .UseDeployReport
291291}
292292
293+ func SetupNetworkParallelism (cmdData * CmdData , cmd * cobra.Command ) {
294+ cmdData .NetworkParallelism = new (int )
295+
296+ fallbackVal := 30
297+
298+ var defVal int
299+ if val , err := util .GetIntEnvVar ("WERF_NETWORK_PARALLELISM" ); err != nil {
300+ TerminateWithError (fmt .Sprintf ("bad WERF_NETWORK_PARALLELISM value: %s" , err ), 1 )
301+ } else if val != nil {
302+ defVal = int (* val )
303+ } else {
304+ defVal = fallbackVal
305+ }
306+
307+ cmd .Flags ().IntVarP (
308+ cmdData .NetworkParallelism ,
309+ "network-parallelism" ,
310+ "" ,
311+ defVal ,
312+ fmt .Sprintf ("Parallelize some network operations (default $WERF_NETWORK_PARALLELISM or %d)" , fallbackVal ),
313+ )
314+ }
315+
316+ func GetNetworkParallelism (cmdData * CmdData ) int {
317+ if * cmdData .NetworkParallelism < 1 {
318+ TerminateWithError (fmt .Sprintf ("bad network parallelism value: %d (should be >= 1)" , * cmdData .NetworkParallelism ), 1 )
319+ }
320+
321+ return * cmdData .NetworkParallelism
322+ }
323+
324+ func SetupDeployGraphPath (cmdData * CmdData , cmd * cobra.Command ) {
325+ cmdData .DeployGraphPath = new (string )
326+
327+ cmd .Flags ().StringVarP (cmdData .DeployGraphPath , "deploy-graph-path" , "" , os .Getenv ("WERF_DEPLOY_GRAPH_PATH" ), "Save deploy graph path to the specified file (by default $WERF_DEPLOY_GRAPH_PATH). Extension must be .dot or not specified. If extension not specified, then .dot is used" )
328+ }
329+
330+ func GetDeployGraphPath (cmdData * CmdData ) string {
331+ switch ext := filepath .Ext (* cmdData .DeployGraphPath ); ext {
332+ case ".dot" :
333+ return * cmdData .DeployGraphPath
334+ case "" :
335+ return * cmdData .DeployGraphPath + ".dot"
336+ default :
337+ TerminateWithError (fmt .Sprintf ("invalid --deploy-graph-path %q: extension must be either .dot or unspecified" , * cmdData .DeployGraphPath ), 1 )
338+ return ""
339+ }
340+ }
341+
293342func SetupWithoutKube (cmdData * CmdData , cmd * cobra.Command ) {
294343 cmdData .WithoutKube = new (bool )
295344 cmd .Flags ().BoolVarP (cmdData .WithoutKube , "without-kube" , "" , util .GetBoolEnvironmentDefaultFalse ("WERF_WITHOUT_KUBE" ), "Do not skip deployed Kubernetes images (default $WERF_WITHOUT_KUBE)" )
0 commit comments