mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Clean func file (#507)
* remove wrongfully added fnctl * Remove path and max_concurrency from func.yaml generated with `fn init` Fixes: 424
This commit is contained in:
committed by
Pedro Nasser
parent
a949c392c2
commit
c154e0811b
1
.gitignore
vendored
1
.gitignore
vendored
@@ -16,6 +16,7 @@ vendor/
|
||||
/functions.exe
|
||||
bolt.db
|
||||
.glide/
|
||||
/fnctl
|
||||
|
||||
private.sh
|
||||
.env
|
||||
|
||||
14
fn/deploy.go
14
fn/deploy.go
@@ -138,9 +138,9 @@ func (p *deploycmd) route(path string, ff *funcfile) error {
|
||||
return fmt.Errorf("error setting endpoint: %v", err)
|
||||
}
|
||||
|
||||
if ff.Path == nil {
|
||||
if ff.path == nil {
|
||||
_, path := appNamePath(ff.FullName())
|
||||
ff.Path = &path
|
||||
ff.path = &path
|
||||
}
|
||||
|
||||
if ff.Memory == nil {
|
||||
@@ -152,8 +152,8 @@ func (p *deploycmd) route(path string, ff *funcfile) error {
|
||||
if ff.Format == nil {
|
||||
ff.Format = new(string)
|
||||
}
|
||||
if ff.MaxConcurrency == nil {
|
||||
ff.MaxConcurrency = new(int)
|
||||
if ff.maxConcurrency == nil {
|
||||
ff.maxConcurrency = new(int)
|
||||
}
|
||||
if ff.Timeout == nil {
|
||||
dur := time.Duration(0)
|
||||
@@ -166,19 +166,19 @@ func (p *deploycmd) route(path string, ff *funcfile) error {
|
||||
}
|
||||
body := functions.RouteWrapper{
|
||||
Route: functions.Route{
|
||||
Path: *ff.Path,
|
||||
Path: *ff.path,
|
||||
Image: ff.FullName(),
|
||||
Memory: *ff.Memory,
|
||||
Type_: *ff.Type,
|
||||
Config: expandEnvConfig(ff.Config),
|
||||
Headers: headers,
|
||||
Format: *ff.Format,
|
||||
MaxConcurrency: int32(*ff.MaxConcurrency),
|
||||
MaxConcurrency: int32(*ff.maxConcurrency),
|
||||
Timeout: int32(ff.Timeout.Seconds()),
|
||||
},
|
||||
}
|
||||
|
||||
fmt.Fprintf(p.verbwriter, "updating API with app: %s route: %s name: %s \n", p.appName, *ff.Path, ff.Name)
|
||||
fmt.Fprintf(p.verbwriter, "updating API with app: %s route: %s name: %s \n", p.appName, *ff.path, ff.Name)
|
||||
|
||||
wrapper, resp, err := p.AppsAppRoutesPost(p.appName, body)
|
||||
if err != nil {
|
||||
|
||||
@@ -36,16 +36,17 @@ type funcfile struct {
|
||||
Version string `yaml:"version,omitempty",json:"version,omitempty"`
|
||||
Runtime *string `yaml:"runtime,omitempty",json:"runtime,omitempty"`
|
||||
Entrypoint *string `yaml:"entrypoint,omitempty",json:"entrypoint,omitempty"`
|
||||
Path *string `yaml:"path,omitempty",json:"path,omitempty"`
|
||||
Type *string `yaml:"type,omitempty",json:"type,omitempty"`
|
||||
Memory *int64 `yaml:"memory,omitempty",json:"memory,omitempty"`
|
||||
Format *string `yaml:"format,omitempty",json:"format,omitempty"`
|
||||
Timeout *time.Duration `yaml:"timeout,omitempty",json:"timeout,omitempty"`
|
||||
MaxConcurrency *int `yaml:"max_concurrency,omitempty",json:"max_concurrency,omitempty"`
|
||||
Headers map[string]string `yaml:"headers,omitempty",json:"headers,omitempty"`
|
||||
Config map[string]string `yaml:"config,omitempty",json:"config,omitempty"`
|
||||
Build []string `yaml:"build,omitempty",json:"build,omitempty"`
|
||||
Tests []fftest `yaml:"tests,omitempty",json:"tests,omitempty"`
|
||||
|
||||
path *string `yaml:"path,omitempty",json:"path,omitempty"`
|
||||
maxConcurrency *int `yaml:"max_concurrency,omitempty",json:"max_concurrency,omitempty"`
|
||||
}
|
||||
|
||||
func (ff *funcfile) FullName() string {
|
||||
|
||||
@@ -118,11 +118,11 @@ func (a *initFnCmd) init(c *cli.Context) error {
|
||||
Version: initialVersion,
|
||||
Entrypoint: &a.entrypoint,
|
||||
Format: ffmt,
|
||||
MaxConcurrency: &a.maxConcurrency,
|
||||
maxConcurrency: &a.maxConcurrency,
|
||||
}
|
||||
|
||||
_, path := appNamePath(ff.FullName())
|
||||
ff.Path = &path
|
||||
ff.path = &path
|
||||
|
||||
if err := encodeFuncfileYAML("func.yaml", ff); err != nil {
|
||||
return err
|
||||
|
||||
@@ -279,7 +279,7 @@ func createFunctionYaml(opts createImageOptions) error {
|
||||
path := fmt.Sprintf("/%s", strs[1])
|
||||
funcDesc := &funcfile{
|
||||
Name: opts.Name,
|
||||
Path: &path,
|
||||
path: &path,
|
||||
Config: opts.Config,
|
||||
}
|
||||
|
||||
|
||||
@@ -301,14 +301,14 @@ func (a *routesCmd) create(c *cli.Context) error {
|
||||
if ff.Format != nil {
|
||||
format = *ff.Format
|
||||
}
|
||||
if ff.MaxConcurrency != nil {
|
||||
maxC = *ff.MaxConcurrency
|
||||
if ff.maxConcurrency != nil {
|
||||
maxC = *ff.maxConcurrency
|
||||
}
|
||||
if ff.Timeout != nil {
|
||||
timeout = *ff.Timeout
|
||||
}
|
||||
if route == "" && ff.Path != nil {
|
||||
route = *ff.Path
|
||||
if route == "" && ff.path != nil {
|
||||
route = *ff.path
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ func (t *testcmd) test(c *cli.Context) error {
|
||||
target := ff.FullName()
|
||||
runtest := runlocaltest
|
||||
if t.remote != "" {
|
||||
if ff.Path == nil || *ff.Path == "" {
|
||||
if ff.path == nil || *ff.path == "" {
|
||||
return errors.New("execution of tests on remote server demand that this function to have a `path`.")
|
||||
}
|
||||
if err := resetBasePath(t.Configuration); err != nil {
|
||||
@@ -80,7 +80,7 @@ func (t *testcmd) test(c *cli.Context) error {
|
||||
}
|
||||
|
||||
u, err := url.Parse("../")
|
||||
u.Path = path.Join(u.Path, "r", t.remote, *ff.Path)
|
||||
u.Path = path.Join(u.Path, "r", t.remote, *ff.path)
|
||||
target = baseURL.ResolveReference(u).String()
|
||||
runtest = runremotetest
|
||||
}
|
||||
|
||||
BIN
fnctl/fnctl.exe
BIN
fnctl/fnctl.exe
Binary file not shown.
Reference in New Issue
Block a user