From dd1653705b7254116c886074109903433908de99 Mon Sep 17 00:00:00 2001 From: Denis Makogon Date: Sun, 9 Sep 2018 21:14:45 +0300 Subject: [PATCH] Clean-up --- commands/build.go | 11 +++++------ commands/deploy.go | 8 -------- commands/deploy_api.go | 8 ++++++++ 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/commands/build.go b/commands/build.go index 7556da24..aa9aa329 100644 --- a/commands/build.go +++ b/commands/build.go @@ -74,6 +74,9 @@ func (b *buildcmd) build(c *cli.Context) error { return err } + buildArgs := c.StringSlice("build-arg") + verbose := c.GlobalBool("verbose") + switch common.GetFuncYamlVersion(ffV) { case common.LatestYamlVersion: fpath, ff, err := common.FindAndParseFuncFileV20180708(dir) @@ -81,8 +84,7 @@ func (b *buildcmd) build(c *cli.Context) error { return err } - buildArgs := c.StringSlice("build-arg") - ff, err = common.BuildFuncV20180708(buildArgs, c.GlobalBool("verbose"), b.noCache, fpath, ff) + ff, err = common.BuildFuncV20180708(buildArgs, verbose, b.noCache, fpath, ff) if err != nil { return err } @@ -96,10 +98,7 @@ func (b *buildcmd) build(c *cli.Context) error { return err } - buildArgs := c.StringSlice("build-arg") - verbpse := c.GlobalBool("verbose") - - ff, err = common.BuildFunc(buildArgs, verbpse, b.noCache, fpath, ff) + ff, err = common.BuildFunc(buildArgs, verbose, b.noCache, fpath, ff) if err != nil { return err } diff --git a/commands/deploy.go b/commands/deploy.go index fc1e66a0..275de0da 100644 --- a/commands/deploy.go +++ b/commands/deploy.go @@ -155,14 +155,6 @@ func (p *deploycmd) deploy(c *cli.Context) error { return p.deploySingle(c, deployConfig, appName, appf) } -type DeployConfig struct { - BuildArgs []string - Verbose bool - NoBump bool - IsLocal bool - NoCache bool -} - // deploySingle deploys a single function, either the current directory or if in the context // of an app and user provides relative path as the first arg, it will deploy that function. func (p *deploycmd) deploySingle(c *cli.Context, deployConfig *DeployConfig, appName string, appf *common.AppFile) error { diff --git a/commands/deploy_api.go b/commands/deploy_api.go index 3f55e08a..9f9bcd4c 100644 --- a/commands/deploy_api.go +++ b/commands/deploy_api.go @@ -12,6 +12,14 @@ import ( v2Client "github.com/fnproject/fn_go/clientv2" ) +type DeployConfig struct { + BuildArgs []string + Verbose bool + NoBump bool + IsLocal bool + NoCache bool +} + func DeploySingle(clientV1 *fnclient.Fn, clientV2 *v2Client.Fn, deployConfig *DeployConfig, dir, appName string, appf *common.AppFile) error { wd := common.GetWd()