Skip to content

Commit 0df5f1e

Browse files
authored
Bump TinyGo and TinyGo proxy wasm SDK (#247)
* Bump TinyGo and TinyGo proxy wasm SDK * Latest tinygo example * Codgen with latest master * Codegen
1 parent dd7a460 commit 0df5f1e

11 files changed

+1928
-1894
lines changed

.github/pull_request_template.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ Users ran into this bug doing ... \ Users needed this feature to ...
1111
# Checklist:
1212

1313
- [ ] I included a concise, user-facing changelog (for details, see https://github.com/solo-io/go-utils/tree/master/changelogutils) which references the issue that is resolved.
14-
- [ ] If I updated APIs (our protos) or helm values, I ran `make install-deps generated-code` from `tools/wasme/cli` to ensure there will be no code diff
14+
- [ ] If I updated APIs (our protos) or helm values, I ran `make install-deps operator-gen generated-code` from `tools/wasme/cli` to ensure there will be no code diff
1515
- [ ] I followed guidelines laid out in the Gloo [contribution guide](https://docs.solo.io/gloo/latest/contributing/)
1616
- [ ] I opened a draft PR or added the work in progress label if my PR is not ready for review
1717
- [ ] I have performed a self-review of my own code
1818
- [ ] I have commented my code, particularly in hard-to-understand areas
1919
- [ ] I have made corresponding changes to the documentation
20-
- [ ] I have added tests that prove my fix is effective or that my feature works
20+
- [ ] I have added tests that prove my fix is effective or that my feature works
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
changelog:
2+
- dependencyOwner: tinygo-org
3+
dependencyRepo: tinygo
4+
dependencyTag: v0.17.0
5+
description: Update TinyGo to v 0.17.0. This fixes several issues, especially around memory management.
6+
issueLink: https://github.com/solo-io/wasm/issues/246
7+
type: DEPENDENCY_BUMP

tools/wasme/cli/builder/Dockerfile

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ RUN apt install expect-dev -y
1010

1111
RUN npm install -g @bazel/bazelisk
1212

13-
# TODO: use the latest stable release package after the WASI supported is officially released
14-
# this corresponds to https://github.com/tinygo-org/tinygo/commit/9a015f4f6441fd68eabe35b3dc9748a5467d5934
15-
RUN wget https://storage.googleapis.com/getenvoy-package/tinygo-nightly-packages/tinygo_amd64.deb
13+
# Release v0.17.0 of tinygo
14+
RUN wget https://github.com/tinygo-org/tinygo/releases/download/v0.17.0/tinygo_0.17.0_amd64.deb -O tinygo_amd64.deb
1615
RUN dpkg -i tinygo_amd64.deb && rm tinygo_amd64.deb
1716

1817
RUN wget https://golang.org/dl/go1.15.2.linux-amd64.tar.gz

tools/wasme/cli/example/tinygo/go.mod

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ module main
22

33
go 1.15
44

5-
require github.com/tetratelabs/proxy-wasm-go-sdk v0.0.8
5+
require (
6+
github.com/tetratelabs/proxy-wasm-go-sdk v0.1.1
7+
)

tools/wasme/cli/example/tinygo/main.go

+15-6
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import (
55
"github.com/tetratelabs/proxy-wasm-go-sdk/proxywasm/types"
66
)
77

8-
// Other examples can be found at https://github.com/tetratelabs/proxy-wasm-go-sdk/tree/v0.0.8/examples
8+
// Other examples can be found at https://github.com/tetratelabs/proxy-wasm-go-sdk/tree/v0.1.1/examples
99

1010
func main() {
11-
proxywasm.SetNewHttpContext(newHttpContext)
11+
proxywasm.SetNewRootContext(newRootContext)
1212
}
1313

1414
type httpHeaders struct {
@@ -17,11 +17,20 @@ type httpHeaders struct {
1717
contextID uint32
1818
}
1919

20-
func newHttpContext(rootContextID, contextID uint32) proxywasm.HttpContext {
20+
type rootContext struct {
21+
// You'd better embed the default root context
22+
// so that you don't need to reimplement all the methods by yourself.
23+
proxywasm.DefaultRootContext
24+
}
25+
26+
func newRootContext(uint32) proxywasm.RootContext { return &rootContext{} }
27+
28+
// Override DefaultRootContext.
29+
func (*rootContext) NewHttpContext(contextID uint32) proxywasm.HttpContext {
2130
return &httpHeaders{contextID: contextID}
2231
}
2332

24-
// override
33+
// Override DefaultHttpContext.
2534
func (ctx *httpHeaders) OnHttpRequestHeaders(numHeaders int, endOfStream bool) types.Action {
2635
hs, err := proxywasm.GetHttpRequestHeaders()
2736
if err != nil {
@@ -34,15 +43,15 @@ func (ctx *httpHeaders) OnHttpRequestHeaders(numHeaders int, endOfStream bool) t
3443
return types.ActionContinue
3544
}
3645

37-
// override
46+
// Override DefaultHttpContext.
3847
func (ctx *httpHeaders) OnHttpResponseHeaders(numHeaders int, endOfStream bool) types.Action {
3948
if err := proxywasm.SetHttpResponseHeader("hello", "world"); err != nil {
4049
proxywasm.LogCriticalf("failed to set response header: %v", err)
4150
}
4251
return types.ActionContinue
4352
}
4453

45-
// override
54+
// Override DefaultHttpContext.
4655
func (ctx *httpHeaders) OnHttpStreamDone() {
4756
proxywasm.LogInfof("%d finished", ctx.contextID)
4857
}

tools/wasme/cli/pkg/cmd/initialize/assemblyscript_archive_2gobytes.go

+150-149
Large diffs are not rendered by default.

tools/wasme/cli/pkg/cmd/initialize/cpp-istio-1.5_archive_2gobytes.go

+465-463
Large diffs are not rendered by default.

tools/wasme/cli/pkg/cmd/initialize/cpp-istio-1.7_archive_2gobytes.go

+471-469
Large diffs are not rendered by default.

tools/wasme/cli/pkg/cmd/initialize/cpp_archive_2gobytes.go

+471-469
Large diffs are not rendered by default.

tools/wasme/cli/pkg/cmd/initialize/rust-istio-1.7_archive_2gobytes.go

+225-223
Large diffs are not rendered by default.

tools/wasme/cli/pkg/cmd/initialize/tinygo_archive_2gobytes.go

+117-109
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)