Skip to content

Commit

Permalink
Bump TinyGo and TinyGo proxy wasm SDK (#247)
Browse files Browse the repository at this point in the history
* Bump TinyGo and TinyGo proxy wasm SDK

* Latest tinygo example

* Codgen with latest master

* Codegen
  • Loading branch information
Sodman authored Mar 31, 2021
1 parent dd7a460 commit 0df5f1e
Show file tree
Hide file tree
Showing 11 changed files with 1,928 additions and 1,894 deletions.
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ Users ran into this bug doing ... \ Users needed this feature to ...
# Checklist:

- [ ] 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.
- [ ] 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
- [ ] 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
- [ ] I followed guidelines laid out in the Gloo [contribution guide](https://docs.solo.io/gloo/latest/contributing/)
- [ ] I opened a draft PR or added the work in progress label if my PR is not ready for review
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added tests that prove my fix is effective or that my feature works
7 changes: 7 additions & 0 deletions tools/wasme/changelog/v0.0.33/bump-tinygo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
changelog:
- dependencyOwner: tinygo-org
dependencyRepo: tinygo
dependencyTag: v0.17.0
description: Update TinyGo to v 0.17.0. This fixes several issues, especially around memory management.
issueLink: https://github.com/solo-io/wasm/issues/246
type: DEPENDENCY_BUMP
5 changes: 2 additions & 3 deletions tools/wasme/cli/builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ RUN apt install expect-dev -y

RUN npm install -g @bazel/bazelisk

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

RUN wget https://golang.org/dl/go1.15.2.linux-amd64.tar.gz
Expand Down
4 changes: 3 additions & 1 deletion tools/wasme/cli/example/tinygo/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ module main

go 1.15

require github.com/tetratelabs/proxy-wasm-go-sdk v0.0.8
require (
github.com/tetratelabs/proxy-wasm-go-sdk v0.1.1
)
21 changes: 15 additions & 6 deletions tools/wasme/cli/example/tinygo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"github.com/tetratelabs/proxy-wasm-go-sdk/proxywasm/types"
)

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

func main() {
proxywasm.SetNewHttpContext(newHttpContext)
proxywasm.SetNewRootContext(newRootContext)
}

type httpHeaders struct {
Expand All @@ -17,11 +17,20 @@ type httpHeaders struct {
contextID uint32
}

func newHttpContext(rootContextID, contextID uint32) proxywasm.HttpContext {
type rootContext struct {
// You'd better embed the default root context
// so that you don't need to reimplement all the methods by yourself.
proxywasm.DefaultRootContext
}

func newRootContext(uint32) proxywasm.RootContext { return &rootContext{} }

// Override DefaultRootContext.
func (*rootContext) NewHttpContext(contextID uint32) proxywasm.HttpContext {
return &httpHeaders{contextID: contextID}
}

// override
// Override DefaultHttpContext.
func (ctx *httpHeaders) OnHttpRequestHeaders(numHeaders int, endOfStream bool) types.Action {
hs, err := proxywasm.GetHttpRequestHeaders()
if err != nil {
Expand All @@ -34,15 +43,15 @@ func (ctx *httpHeaders) OnHttpRequestHeaders(numHeaders int, endOfStream bool) t
return types.ActionContinue
}

// override
// Override DefaultHttpContext.
func (ctx *httpHeaders) OnHttpResponseHeaders(numHeaders int, endOfStream bool) types.Action {
if err := proxywasm.SetHttpResponseHeader("hello", "world"); err != nil {
proxywasm.LogCriticalf("failed to set response header: %v", err)
}
return types.ActionContinue
}

// override
// Override DefaultHttpContext.
func (ctx *httpHeaders) OnHttpStreamDone() {
proxywasm.LogInfof("%d finished", ctx.contextID)
}
299 changes: 150 additions & 149 deletions tools/wasme/cli/pkg/cmd/initialize/assemblyscript_archive_2gobytes.go

Large diffs are not rendered by default.

928 changes: 465 additions & 463 deletions tools/wasme/cli/pkg/cmd/initialize/cpp-istio-1.5_archive_2gobytes.go

Large diffs are not rendered by default.

940 changes: 471 additions & 469 deletions tools/wasme/cli/pkg/cmd/initialize/cpp-istio-1.7_archive_2gobytes.go

Large diffs are not rendered by default.

940 changes: 471 additions & 469 deletions tools/wasme/cli/pkg/cmd/initialize/cpp_archive_2gobytes.go

Large diffs are not rendered by default.

448 changes: 225 additions & 223 deletions tools/wasme/cli/pkg/cmd/initialize/rust-istio-1.7_archive_2gobytes.go

Large diffs are not rendered by default.

226 changes: 117 additions & 109 deletions tools/wasme/cli/pkg/cmd/initialize/tinygo_archive_2gobytes.go

Large diffs are not rendered by default.

0 comments on commit 0df5f1e

Please sign in to comment.