Skip to content

Commit 9a3da54

Browse files
committed
feat: add build data
1 parent 6c91bde commit 9a3da54

8 files changed

+28
-19
lines changed

go/models/create_env_vars_params_body_items.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/models/env_var.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/models/function_config.go

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/models/update_env_var_params_body.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/porcelain/deploy.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -821,11 +821,12 @@ func bundleFromManifest(ctx context.Context, manifestFile *os.File, observer Dep
821821
}
822822
}
823823

824-
if function.DisplayName != "" || function.Generator != "" || len(routes) > 0 {
824+
if function.DisplayName != "" || function.Generator != "" || len(routes) > 0 || len(function.BuildData) > 0 {
825825
functionsConfig[file.Name] = models.FunctionConfig{
826826
DisplayName: function.DisplayName,
827827
Generator: function.Generator,
828828
Routes: routes,
829+
BuildData: function.BuildData,
829830
}
830831
}
831832

go/porcelain/deploy_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,7 @@ func TestBundleWithManifest(t *testing.T) {
639639
"mainFile": "/some/path/hello-js-function-test.js",
640640
"displayName": "Hello Javascript Function",
641641
"generator": "@netlify/[email protected]",
642+
"buildData": { "runtimeAPIVersion": 2 },
642643
"name": "hello-js-function-test",
643644
"schedule": "* * * * *",
644645
"routes": [
@@ -686,6 +687,7 @@ func TestBundleWithManifest(t *testing.T) {
686687
assert.Equal(t, 1, len(functionsConfig))
687688
assert.Equal(t, "Hello Javascript Function", helloJSConfig.DisplayName)
688689
assert.Equal(t, "@netlify/[email protected]", helloJSConfig.Generator)
690+
assert.EqualValues(t, 2, helloJSConfig.BuildData.(map[string]interface{})["runtimeAPIVersion"])
689691

690692
assert.Equal(t, "/products", helloJSConfig.Routes[0].Pattern)
691693
assert.Equal(t, "/products", helloJSConfig.Routes[0].Literal)

go/porcelain/functions_manifest.go

+11-10
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@ type functionsManifest struct {
77
}
88

99
type functionsManifestEntry struct {
10-
MainFile string `json:"mainFile"`
11-
Name string `json:"name"`
12-
Path string `json:"path"`
13-
Runtime string `json:"runtime"`
14-
RuntimeVersion string `json:"runtimeVersion"`
15-
Schedule string `json:"schedule"`
16-
DisplayName string `json:"displayName"`
17-
Generator string `json:"generator"`
18-
InvocationMode string `json:"invocationMode"`
19-
Routes []functionRoute `json:"routes"`
10+
MainFile string `json:"mainFile"`
11+
Name string `json:"name"`
12+
Path string `json:"path"`
13+
Runtime string `json:"runtime"`
14+
RuntimeVersion string `json:"runtimeVersion"`
15+
Schedule string `json:"schedule"`
16+
DisplayName string `json:"displayName"`
17+
Generator string `json:"generator"`
18+
BuildData map[string]interface{} `json:"buildData"`
19+
InvocationMode string `json:"invocationMode"`
20+
Routes []functionRoute `json:"routes"`
2021
}
2122

2223
type functionRoute struct {

swagger.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ paths:
283283
is_secret:
284284
type: boolean
285285
description: >-
286-
Secret values are only readable by code running on Netlify’s systems.
286+
Secret values are only readable by code running on Netlify’s systems.
287287
With secrets, only the local development context values are readable from the UI, API, and CLI.
288288
By default, environment variable values are not secret. (Enterprise plans only)
289289
- name: account_id
@@ -387,7 +387,7 @@ paths:
387387
is_secret:
388388
type: boolean
389389
description: >-
390-
Secret values are only readable by code running on Netlify’s systems.
390+
Secret values are only readable by code running on Netlify’s systems.
391391
With secrets, only the local development context values are readable from the UI, API, and CLI.
392392
By default, environment variable values are not secret. (Enterprise plans only)
393393
- name: site_id
@@ -2738,7 +2738,7 @@ definitions:
27382738
is_secret:
27392739
type: boolean
27402740
description: >-
2741-
Secret values are only readable by code running on Netlify’s systems.
2741+
Secret values are only readable by code running on Netlify’s systems.
27422742
With secrets, only the local development context values are readable from the UI, API, and CLI.
27432743
By default, environment variable values are not secret. (Enterprise plans only)
27442744
updated_at:
@@ -3621,10 +3621,12 @@ definitions:
36213621
type: string
36223622
generator:
36233623
type: string
3624+
build_data:
3625+
type: object
36243626
routes:
36253627
type: array
36263628
items:
3627-
$ref: '#/definitions/functionRoute'
3629+
$ref: '#/definitions/functionRoute'
36283630
functionRoute:
36293631
type: object
36303632
properties:
@@ -3633,7 +3635,7 @@ definitions:
36333635
literal:
36343636
type: string
36353637
expression:
3636-
type: string
3638+
type: string
36373639
methods:
36383640
type: array
36393641
items:

0 commit comments

Comments
 (0)