Skip to content

fix: al2 uploads need to have function name in SHA #509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
9 changes: 7 additions & 2 deletions go/porcelain/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -981,8 +981,13 @@ func createHeader(archive *zip.Writer, i os.FileInfo, runtime string) (io.Writer
return archive.CreateHeader(&zip.FileHeader{
CreatorVersion: 3 << 8, // indicates Unix
ExternalAttrs: 0777 << 16, // -rwxrwxrwx file permissions
Name: "bootstrap",
Method: zip.Deflate,

// we need to make sure we don't have two ZIP files with the exact same contents - otherwise, our upload deduplication mechanism will do weird things.
// adding in the function name as a comment ensures that every function ZIP is unique
Comment: i.Name(),

Name: "bootstrap",
Method: zip.Deflate,
})
}
return archive.Create(i.Name())
Expand Down
6 changes: 5 additions & 1 deletion go/porcelain/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,19 +612,23 @@ func TestBundle(t *testing.T) {
functions, schedules, functionsConfig, err := bundle(gocontext.Background(), "../internal/data", mockObserver{})

assert.Nil(t, err)
assert.Equal(t, 4, len(functions.Files))
assert.Equal(t, 5, len(functions.Files))
assert.Empty(t, schedules)
assert.Nil(t, functionsConfig)

jsFunction := functions.Files["hello-js-function-test"]
pyFunction := functions.Files["hello-py-function-test"]
rsFunction := functions.Files["hello-rs-function-test"]
goFunction := functions.Files["hello-go-binary-function"]
goBackgroundFunction := functions.Files["hello-go-binary-function-background"]

assert.Equal(t, "js", jsFunction.Runtime)
assert.Equal(t, "py", pyFunction.Runtime)
assert.Equal(t, "rs", rsFunction.Runtime)
assert.Equal(t, "provided.al2", goFunction.Runtime)
assert.Equal(t, "provided.al2", goBackgroundFunction.Runtime)

assert.NotEqual(t, goFunction.Sum, goBackgroundFunction.Sum)
}

func TestBundleWithManifest(t *testing.T) {
Expand Down