@@ -12,7 +12,7 @@ import (
12
12
v2Client "github.com/fnproject/fn_go/clientv2"
13
13
)
14
14
15
- func DeploySingle (clientV1 * fnclient.Fn , clientV2 * v2Client.Fn , buildArgs [] string , verbose bool , noBump , isLocal , noCache bool , dir , appName string , appf * common.AppFile ) error {
15
+ func DeploySingle (clientV1 * fnclient.Fn , clientV2 * v2Client.Fn , deployConfig * DeployConfig , dir , appName string , appf * common.AppFile ) error {
16
16
wd := common .GetWd ()
17
17
18
18
err := os .Chdir (dir )
@@ -45,8 +45,7 @@ func DeploySingle(clientV1 *fnclient.Fn, clientV2 *v2Client.Fn, buildArgs []stri
45
45
}
46
46
}
47
47
48
- return DeployFuncV20180708 (clientV1 , clientV2 , buildArgs , verbose , noBump ,
49
- isLocal , noCache , appName , fpath , ff )
48
+ return DeployFuncV20180708 (clientV1 , clientV2 , deployConfig , appName , fpath , ff )
50
49
default :
51
50
fpath , ff , err := common .FindAndParseFuncfile (dir )
52
51
if err != nil {
@@ -65,11 +64,11 @@ func DeploySingle(clientV1 *fnclient.Fn, clientV2 *v2Client.Fn, buildArgs []stri
65
64
}
66
65
}
67
66
68
- return DeployFunc (clientV1 , buildArgs , verbose , noBump , isLocal , noCache , appName , fpath , ff )
67
+ return DeployFunc (clientV1 , deployConfig , appName , fpath , ff )
69
68
}
70
69
}
71
70
72
- func DeployAll (client * fnclient.Fn , buildArgs [] string , verbose bool , noBump , isLocal , noCache bool , appDir , appName string , appf * common.AppFile ) error {
71
+ func DeployAll (client * fnclient.Fn , deployConfig * DeployConfig , appDir , appName string , appf * common.AppFile ) error {
73
72
if appf != nil {
74
73
err := UpdateAppConfig (client , appf )
75
74
if err != nil {
@@ -111,7 +110,7 @@ func DeployAll(client *fnclient.Fn, buildArgs []string, verbose bool, noBump, is
111
110
}
112
111
}
113
112
114
- err = DeployFunc (client , buildArgs , verbose , noBump , isLocal , noCache , appName , path , ff )
113
+ err = DeployFunc (client , deployConfig , appName , path , ff )
115
114
if err != nil {
116
115
return fmt .Errorf ("deploy error on %s: %v" , path , err )
117
116
}
@@ -132,7 +131,7 @@ func DeployAll(client *fnclient.Fn, buildArgs []string, verbose bool, noBump, is
132
131
// Parse func.yaml file, bump version, build image, push to registry, and
133
132
// finally it will update function's route. Optionally,
134
133
// the route can be overriden inside the func.yaml file.
135
- func DeployFunc (client * fnclient.Fn , buildArgs [] string , verbose bool , noBump , isLocal , noCache bool , appName , funcfilePath string , funcfile * common.FuncFile ) error {
134
+ func DeployFunc (client * fnclient.Fn , deployConfig * DeployConfig , appName , funcfilePath string , funcfile * common.FuncFile ) error {
136
135
dir := filepath .Dir (funcfilePath )
137
136
// get name from directory if it's not defined
138
137
if funcfile .Name == "" {
@@ -148,7 +147,7 @@ func DeployFunc(client *fnclient.Fn, buildArgs []string, verbose bool, noBump, i
148
147
}
149
148
150
149
var err error
151
- if ! noBump {
150
+ if ! deployConfig . NoBump {
152
151
funcfile2 , err := common .BumpIt (funcfilePath , common .Patch )
153
152
if err != nil {
154
153
return err
@@ -158,13 +157,13 @@ func DeployFunc(client *fnclient.Fn, buildArgs []string, verbose bool, noBump, i
158
157
}
159
158
160
159
// p.noCache
161
- _ , err = common .BuildFunc (verbose , funcfilePath , funcfile , buildArgs , noCache )
160
+ _ , err = common .BuildFunc (deployConfig . BuildArgs , deployConfig . Verbose , deployConfig . NoCache , funcfilePath , funcfile )
162
161
if err != nil {
163
162
return err
164
163
}
165
164
166
165
// p.local
167
- if ! isLocal {
166
+ if ! deployConfig . IsLocal {
168
167
if err := common .DockerPush (funcfile ); err != nil {
169
168
return err
170
169
}
@@ -173,13 +172,13 @@ func DeployFunc(client *fnclient.Fn, buildArgs []string, verbose bool, noBump, i
173
172
return updateRoute (client , appName , funcfile )
174
173
}
175
174
176
- func DeployFuncV20180708 (clientV1 * fnclient.Fn , clientV2 * v2Client.Fn , buildArgs [] string , verbose bool , noBump , isLocal , noCache bool , appName , funcfilePath string , funcfile * common.FuncFileV20180708 ) error {
175
+ func DeployFuncV20180708 (clientV1 * fnclient.Fn , clientV2 * v2Client.Fn , deployConfig * DeployConfig , appName , funcfilePath string , funcfile * common.FuncFileV20180708 ) error {
177
176
if funcfile .Name == "" {
178
177
funcfile .Name = filepath .Base (filepath .Dir (funcfilePath )) // todo: should probably make a copy of ff before changing it
179
178
}
180
179
181
180
var err error
182
- if ! noBump {
181
+ if ! deployConfig . NoBump {
183
182
funcfile2 , err := common .BumpItV20180708 (funcfilePath , common .Patch )
184
183
if err != nil {
185
184
return err
@@ -188,12 +187,13 @@ func DeployFuncV20180708(clientV1 *fnclient.Fn, clientV2 *v2Client.Fn, buildArgs
188
187
// TODO: this whole funcfile handling needs some love, way too confusing. Only bump makes permanent changes to it.
189
188
}
190
189
191
- _ , err = common .BuildFuncV20180708 (verbose , funcfilePath , funcfile , buildArgs , noCache )
190
+ _ , err = common .BuildFuncV20180708 (deployConfig .BuildArgs , deployConfig .Verbose ,
191
+ deployConfig .NoCache , funcfilePath , funcfile )
192
192
if err != nil {
193
193
return err
194
194
}
195
195
196
- if ! isLocal {
196
+ if ! deployConfig . IsLocal {
197
197
if err := common .DockerPushV20180708 (funcfile ); err != nil {
198
198
return err
199
199
}
0 commit comments