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
|
/functions.exe
|
||||||
bolt.db
|
bolt.db
|
||||||
.glide/
|
.glide/
|
||||||
|
/fnctl
|
||||||
|
|
||||||
private.sh
|
private.sh
|
||||||
.env
|
.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)
|
return fmt.Errorf("error setting endpoint: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ff.Path == nil {
|
if ff.path == nil {
|
||||||
_, path := appNamePath(ff.FullName())
|
_, path := appNamePath(ff.FullName())
|
||||||
ff.Path = &path
|
ff.path = &path
|
||||||
}
|
}
|
||||||
|
|
||||||
if ff.Memory == nil {
|
if ff.Memory == nil {
|
||||||
@@ -152,8 +152,8 @@ func (p *deploycmd) route(path string, ff *funcfile) error {
|
|||||||
if ff.Format == nil {
|
if ff.Format == nil {
|
||||||
ff.Format = new(string)
|
ff.Format = new(string)
|
||||||
}
|
}
|
||||||
if ff.MaxConcurrency == nil {
|
if ff.maxConcurrency == nil {
|
||||||
ff.MaxConcurrency = new(int)
|
ff.maxConcurrency = new(int)
|
||||||
}
|
}
|
||||||
if ff.Timeout == nil {
|
if ff.Timeout == nil {
|
||||||
dur := time.Duration(0)
|
dur := time.Duration(0)
|
||||||
@@ -166,19 +166,19 @@ func (p *deploycmd) route(path string, ff *funcfile) error {
|
|||||||
}
|
}
|
||||||
body := functions.RouteWrapper{
|
body := functions.RouteWrapper{
|
||||||
Route: functions.Route{
|
Route: functions.Route{
|
||||||
Path: *ff.Path,
|
Path: *ff.path,
|
||||||
Image: ff.FullName(),
|
Image: ff.FullName(),
|
||||||
Memory: *ff.Memory,
|
Memory: *ff.Memory,
|
||||||
Type_: *ff.Type,
|
Type_: *ff.Type,
|
||||||
Config: expandEnvConfig(ff.Config),
|
Config: expandEnvConfig(ff.Config),
|
||||||
Headers: headers,
|
Headers: headers,
|
||||||
Format: *ff.Format,
|
Format: *ff.Format,
|
||||||
MaxConcurrency: int32(*ff.MaxConcurrency),
|
MaxConcurrency: int32(*ff.maxConcurrency),
|
||||||
Timeout: int32(ff.Timeout.Seconds()),
|
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)
|
wrapper, resp, err := p.AppsAppRoutesPost(p.appName, body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -36,16 +36,17 @@ type funcfile struct {
|
|||||||
Version string `yaml:"version,omitempty",json:"version,omitempty"`
|
Version string `yaml:"version,omitempty",json:"version,omitempty"`
|
||||||
Runtime *string `yaml:"runtime,omitempty",json:"runtime,omitempty"`
|
Runtime *string `yaml:"runtime,omitempty",json:"runtime,omitempty"`
|
||||||
Entrypoint *string `yaml:"entrypoint,omitempty",json:"entrypoint,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"`
|
Type *string `yaml:"type,omitempty",json:"type,omitempty"`
|
||||||
Memory *int64 `yaml:"memory,omitempty",json:"memory,omitempty"`
|
Memory *int64 `yaml:"memory,omitempty",json:"memory,omitempty"`
|
||||||
Format *string `yaml:"format,omitempty",json:"format,omitempty"`
|
Format *string `yaml:"format,omitempty",json:"format,omitempty"`
|
||||||
Timeout *time.Duration `yaml:"timeout,omitempty",json:"timeout,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"`
|
Headers map[string]string `yaml:"headers,omitempty",json:"headers,omitempty"`
|
||||||
Config map[string]string `yaml:"config,omitempty",json:"config,omitempty"`
|
Config map[string]string `yaml:"config,omitempty",json:"config,omitempty"`
|
||||||
Build []string `yaml:"build,omitempty",json:"build,omitempty"`
|
Build []string `yaml:"build,omitempty",json:"build,omitempty"`
|
||||||
Tests []fftest `yaml:"tests,omitempty",json:"tests,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 {
|
func (ff *funcfile) FullName() string {
|
||||||
|
|||||||
@@ -118,11 +118,11 @@ func (a *initFnCmd) init(c *cli.Context) error {
|
|||||||
Version: initialVersion,
|
Version: initialVersion,
|
||||||
Entrypoint: &a.entrypoint,
|
Entrypoint: &a.entrypoint,
|
||||||
Format: ffmt,
|
Format: ffmt,
|
||||||
MaxConcurrency: &a.maxConcurrency,
|
maxConcurrency: &a.maxConcurrency,
|
||||||
}
|
}
|
||||||
|
|
||||||
_, path := appNamePath(ff.FullName())
|
_, path := appNamePath(ff.FullName())
|
||||||
ff.Path = &path
|
ff.path = &path
|
||||||
|
|
||||||
if err := encodeFuncfileYAML("func.yaml", ff); err != nil {
|
if err := encodeFuncfileYAML("func.yaml", ff); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ func createFunctionYaml(opts createImageOptions) error {
|
|||||||
path := fmt.Sprintf("/%s", strs[1])
|
path := fmt.Sprintf("/%s", strs[1])
|
||||||
funcDesc := &funcfile{
|
funcDesc := &funcfile{
|
||||||
Name: opts.Name,
|
Name: opts.Name,
|
||||||
Path: &path,
|
path: &path,
|
||||||
Config: opts.Config,
|
Config: opts.Config,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -301,14 +301,14 @@ func (a *routesCmd) create(c *cli.Context) error {
|
|||||||
if ff.Format != nil {
|
if ff.Format != nil {
|
||||||
format = *ff.Format
|
format = *ff.Format
|
||||||
}
|
}
|
||||||
if ff.MaxConcurrency != nil {
|
if ff.maxConcurrency != nil {
|
||||||
maxC = *ff.MaxConcurrency
|
maxC = *ff.maxConcurrency
|
||||||
}
|
}
|
||||||
if ff.Timeout != nil {
|
if ff.Timeout != nil {
|
||||||
timeout = *ff.Timeout
|
timeout = *ff.Timeout
|
||||||
}
|
}
|
||||||
if route == "" && ff.Path != nil {
|
if route == "" && ff.path != nil {
|
||||||
route = *ff.Path
|
route = *ff.path
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ func (t *testcmd) test(c *cli.Context) error {
|
|||||||
target := ff.FullName()
|
target := ff.FullName()
|
||||||
runtest := runlocaltest
|
runtest := runlocaltest
|
||||||
if t.remote != "" {
|
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`.")
|
return errors.New("execution of tests on remote server demand that this function to have a `path`.")
|
||||||
}
|
}
|
||||||
if err := resetBasePath(t.Configuration); err != nil {
|
if err := resetBasePath(t.Configuration); err != nil {
|
||||||
@@ -80,7 +80,7 @@ func (t *testcmd) test(c *cli.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
u, err := url.Parse("../")
|
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()
|
target = baseURL.ResolveReference(u).String()
|
||||||
runtest = runremotetest
|
runtest = runremotetest
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
fnctl/fnctl.exe
BIN
fnctl/fnctl.exe
Binary file not shown.
Reference in New Issue
Block a user