Skip to content

Commit c16f4a1

Browse files
authored
Merge branch 'master' into pa/document-purge-api
2 parents a381e8f + dc32672 commit c16f4a1

File tree

7 files changed

+38
-9
lines changed

7 files changed

+38
-9
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
99

10+
## [2.23.1](https://github.com/netlify/open-api/compare/v2.23.0...v2.23.1) (2023-10-13)
11+
12+
13+
### Bug Fixes
14+
15+
* Document functions_region for sites ([a22226f](https://github.com/netlify/open-api/commit/a22226f821278d96fbacf4871bd86b2df49a7e0f))
16+
* skip executable check on windows ([d8dcf44](https://github.com/netlify/open-api/commit/d8dcf44430fcb6a87e562a90aaebc56ee5f2deda))
17+
* trigger al2 via runtimeVersion field ([b2b8227](https://github.com/netlify/open-api/commit/b2b822776a89212467ebc45b0d7199bbe8e93e81))
18+
1019
## [2.23.0](https://github.com/netlify/open-api/compare/v2.22.0...v2.23.0) (2023-09-28)
1120

1221

9.03 MB
Binary file not shown.

go/porcelain/deploy.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"io/ioutil"
1616
"os"
1717
"path/filepath"
18+
"runtime"
1819
"strconv"
1920
"strings"
2021
"sync"
@@ -31,8 +32,9 @@ import (
3132
)
3233

3334
const (
34-
jsRuntime = "js"
35-
goRuntime = "go"
35+
jsRuntime = "js"
36+
goRuntime = "go"
37+
amazonLinux2 = "provided.al2"
3638

3739
preProcessingTimeout = time.Minute * 5
3840

@@ -933,7 +935,7 @@ func jsFile(i os.FileInfo) bool {
933935
func goFile(filePath string, i os.FileInfo, observer DeployObserver) bool {
934936
warner, hasWarner := observer.(DeployWarner)
935937

936-
if m := i.Mode(); m&0111 == 0 { // check if it's an executable file
938+
if m := i.Mode(); m&0111 == 0 && runtime.GOOS != "windows" { // check if it's an executable file. skip on windows, since it doesn't have that mode
937939
if hasWarner {
938940
warner.OnWalkWarning(filePath, "Go binary does not have executable permissions")
939941
}
@@ -980,6 +982,13 @@ func createHeader(archive *zip.Writer, i os.FileInfo, runtime string) (io.Writer
980982
Name: i.Name(),
981983
Method: zip.Deflate,
982984
})
985+
} else if runtime == amazonLinux2 {
986+
return archive.CreateHeader(&zip.FileHeader{
987+
CreatorVersion: 3 << 8, // indicates Unix
988+
ExternalAttrs: 0777 << 16, // -rwxrwxrwx file permissions
989+
Name: "bootstrap",
990+
Method: zip.Deflate,
991+
})
983992
}
984993
return archive.Create(i.Name())
985994
}

go/porcelain/deploy_test.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -612,24 +612,27 @@ func TestBundle(t *testing.T) {
612612
functions, schedules, functionsConfig, err := bundle(gocontext.Background(), "../internal/data", mockObserver{})
613613

614614
assert.Nil(t, err)
615-
assert.Equal(t, 3, len(functions.Files))
615+
assert.Equal(t, 4, len(functions.Files))
616616
assert.Empty(t, schedules)
617617
assert.Nil(t, functionsConfig)
618618

619619
jsFunction := functions.Files["hello-js-function-test"]
620620
pyFunction := functions.Files["hello-py-function-test"]
621621
rsFunction := functions.Files["hello-rs-function-test"]
622+
goFunction := functions.Files["hello-go-binary-function"]
622623

623624
assert.Equal(t, "js", jsFunction.Runtime)
624625
assert.Equal(t, "py", pyFunction.Runtime)
625626
assert.Equal(t, "rs", rsFunction.Runtime)
627+
assert.Equal(t, "go", goFunction.Runtime)
626628
}
627629

628630
func TestBundleWithManifest(t *testing.T) {
629631
cwd, _ := os.Getwd()
630632
basePath := path.Join(filepath.Dir(cwd), "internal", "data")
631633
jsFunctionPath := strings.Replace(filepath.Join(basePath, "hello-js-function-test.zip"), "\\", "/", -1)
632634
pyFunctionPath := strings.Replace(filepath.Join(basePath, "hello-py-function-test.zip"), "\\", "/", -1)
635+
goFunctionPath := strings.Replace(filepath.Join(basePath, "hello-go-binary-function"), "\\", "/", -1)
633636
manifestPath := path.Join(basePath, "manifest.json")
634637
manifestFile := fmt.Sprintf(`{
635638
"functions": [
@@ -660,10 +663,16 @@ func TestBundleWithManifest(t *testing.T) {
660663
"mainFile": "/some/path/hello-py-function-test",
661664
"name": "hello-py-function-test",
662665
"invocationMode": "stream"
666+
},
667+
{
668+
"path": "%s",
669+
"runtime": "go",
670+
"runtimeVersion": "provided.al2",
671+
"name": "hello-go-binary-function"
663672
}
664673
],
665674
"version": 1
666-
}`, jsFunctionPath, pyFunctionPath)
675+
}`, jsFunctionPath, pyFunctionPath, goFunctionPath)
667676

668677
err := ioutil.WriteFile(manifestPath, []byte(manifestFile), 0644)
669678
defer os.Remove(manifestPath)
@@ -676,11 +685,13 @@ func TestBundleWithManifest(t *testing.T) {
676685
assert.Equal(t, "hello-js-function-test", schedules[0].Name)
677686
assert.Equal(t, "* * * * *", schedules[0].Cron)
678687

679-
assert.Equal(t, 2, len(functions.Files))
688+
assert.Equal(t, 3, len(functions.Files))
680689
assert.Equal(t, "a-runtime", functions.Files["hello-js-function-test"].Runtime)
681690
assert.Empty(t, functions.Files["hello-js-function-test"].FunctionMetadata.InvocationMode)
682691
assert.Equal(t, "some-other-runtime", functions.Files["hello-py-function-test"].Runtime)
683692
assert.Equal(t, "stream", functions.Files["hello-py-function-test"].FunctionMetadata.InvocationMode)
693+
assert.Equal(t, "provided.al2", functions.Files["hello-go-binary-function"].Runtime)
694+
assert.Empty(t, functions.Files["hello-go-binary-function"].FunctionMetadata.InvocationMode)
684695

685696
helloJSConfig := functionsConfig["hello-js-function-test"]
686697

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@netlify/open-api",
33
"description": "Netlify's open-api definition as a module",
4-
"version": "2.23.0",
4+
"version": "2.23.1",
55
"author": "Netlify",
66
"ava": {
77
"files": [

swagger.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
swagger: '2.0'
22
info:
3-
version: 2.23.0
3+
version: 2.23.1
44
title: Netlify's API documentation
55
description: >-
66
Netlify is a hosting service for the programmable web. It understands your

0 commit comments

Comments
 (0)