Skip to content

Commit ab46d0a

Browse files
yskopetslizanmusaprgcpakulski
authored
wasm: merge Wasm support into the upstream getenvoy repo (#98)
* extension: add `extension init` command Signed-off-by: Yaroslav Skopets <[email protected]> * Kick CI Signed-off-by: Yaroslav Skopets <[email protected]> * code review: fix typo Signed-off-by: Yaroslav Skopets <[email protected]> * code review: rework parsing options Signed-off-by: Yaroslav Skopets <[email protected]> * code review: avoid `os.Getwd()` unless absolutely necessary Signed-off-by: Yaroslav Skopets <[email protected]> * refactoring: move reusable code into `pkg/util` Signed-off-by: Yaroslav Skopets <[email protected]> * ci: fix failing build Signed-off-by: Yaroslav Skopets <[email protected]> * add minimal progress bar Signed-off-by: Yaroslav Skopets <[email protected]> * code review: improve error message Signed-off-by: Yaroslav Skopets <[email protected]> * code review: remove auto-generated code from source control Signed-off-by: Yaroslav Skopets <[email protected]> * cleanup: simplify Signed-off-by: Yaroslav Skopets <[email protected]> * cleanup: reuse utility code Signed-off-by: Yaroslav Skopets <[email protected]> * ci: add `.licenserignore` files to skip license checks on template code Signed-off-by: Yaroslav Skopets <[email protected]> * cleanup: avoid double error message Signed-off-by: Yaroslav Skopets <[email protected]> * cmd: format errors consistently (#2) * cmd: format errors consistently * ci: add unit tests Signed-off-by: Yaroslav Skopets <[email protected]> * cleanup: refactoring Signed-off-by: Yaroslav Skopets <[email protected]> * extension: add interactive mode to `getenvoy extension init` Signed-off-by: Yaroslav Skopets <[email protected]> * refactoring: use struct type to represent supported options Signed-off-by: Yaroslav Skopets <[email protected]> * refactoring: improve user interface Signed-off-by: Yaroslav Skopets <[email protected]> * cmd: support `--no-prompt` and `--no-color` options Signed-off-by: Yaroslav Skopets <[email protected]> * cleanup: better progress messages Signed-off-by: Yaroslav Skopets <[email protected]> * refactoring: refactor out `feedback` Signed-off-by: Yaroslav Skopets <[email protected]> * cleanup: simplify Signed-off-by: Yaroslav Skopets <[email protected]> * cleanup: docs Signed-off-by: Yaroslav Skopets <[email protected]> * extension: add `extension init` command (#1) * extension: add `extension init` command * Kick CI Signed-off-by: Yaroslav Skopets <[email protected]> * code review: fix typo * code review: rework parsing options * code review: avoid `os.Getwd()` unless absolutely necessary * refactoring: move reusable code into `pkg/util` * ci: fix failing build * add minimal progress bar * code review: improve error message * code review: remove auto-generated code from source control * cleanup: simplify * cleanup: reuse utility code * ci: add `.licenserignore` files to skip license checks on template code * cleanup: avoid double error message * cleanup: refactoring * refactoring: use struct type to represent supported options * cleanup: Makefile * cleanup: package name * refactoring: refactor progress handler Signed-off-by: Yaroslav Skopets <[email protected]> * ci: add unit tests Signed-off-by: Yaroslav Skopets <[email protected]> * ci: add unit tests Signed-off-by: Yaroslav Skopets <[email protected]> * ci: add unit tests Signed-off-by: Yaroslav Skopets <[email protected]> * ci: add unit tests Signed-off-by: Yaroslav Skopets <[email protected]> * ci: cleanup Signed-off-by: Yaroslav Skopets <[email protected]> * ci: add unit tests Signed-off-by: Yaroslav Skopets <[email protected]> * ci: collect test coverage (#4) * ci: collect test coverage * ci: exclude `-race` flag from `go test` * ci: revert changes to `ci/test` * ci: measure test coverage * code review: add links to related GitHub issues * code review: split into `make test` and `make coverage` * cleanup Signed-off-by: Yaroslav Skopets <[email protected]> * code review: in `--no-colors` mode icons should render into plain text Signed-off-by: Yaroslav Skopets <[email protected]> * code review: colors mode should require both `stdout` and `stderr` to be terminals Signed-off-by: Yaroslav Skopets <[email protected]> * ci: fix lint Signed-off-by: Yaroslav Skopets <[email protected]> * extension: add interactive mode to `getenvoy extension init` (#3) * extension: add `extension init` command * Kick CI Signed-off-by: Yaroslav Skopets <[email protected]> * code review: fix typo * code review: rework parsing options * code review: avoid `os.Getwd()` unless absolutely necessary * refactoring: move reusable code into `pkg/util` * ci: fix failing build * add minimal progress bar * code review: improve error message * code review: remove auto-generated code from source control * cleanup: simplify * cleanup: reuse utility code * ci: add `.licenserignore` files to skip license checks on template code * cleanup: avoid double error message * cleanup: refactoring * extension: add interactive mode to `getenvoy extension init` * refactoring: use struct type to represent supported options * refactoring: improve user interface * cmd: support `--no-prompt` and `--no-color` options * cleanup: better progress messages * refactoring: refactor out `feedback` * cleanup: simplify * cleanup: docs * ci: add unit tests * ci: add unit tests * ci: add unit tests * ci: add unit tests * ci: cleanup * ci: add unit tests * code review: in `--no-colors` mode icons should render into plain text * code review: colors mode should require both `stdout` and `stderr` to be terminals * ci: fix lint Signed-off-by: Yaroslav Skopets <[email protected]> * extension: add extension templates in Rust (#5) * extension: add extension templates in Rust * code review: remove `--release` option * cleanup: try different git attributes * refactoring: update `envoy.filters.http` template * refactoring: update `envoy.filters.network` template * refactoring: update `envoy.access_loggers` template * code review: remove `--tests` option * cleanup: update comments * code review: remove Cargo setting `git-fetch-with-cli = true` * code review: remove Cargo.lock from Rust templates * cleanup: add .gitignore files to Rust templates * code review: change initital version to `0.1.0` * code review: add caret * code review: add link to https://forge.rust-lang.org/infra/other-installation-methods.html\#standalone * code review: document lifecycle of a WebAssembly module instance Signed-off-by: Yaroslav Skopets <[email protected]> * development: allow to configure `--log-*` options (#9) * development: allow to configure `--log-*` options * code review: rename `ChainPersistentPreRunE` * code review: rename `GETENVOY_EXPERIMENTAL_LOGGING` * code review: add TODO * code review: comments * cleanup Signed-off-by: Yaroslav Skopets <[email protected]> * version: refactor version info to make it re-usable in other contexts (#11) Signed-off-by: Yaroslav Skopets <[email protected]> * extension: add utility code to handle shutdown signals (#13) * extension: add utility code to handle shutdown signals * ci: fix test flake Signed-off-by: Yaroslav Skopets <[email protected]> * add code review guidelines Signed-off-by: Lizan Zhou <[email protected]> Signed-off-by: Yaroslav Skopets <[email protected]> * extension: introduce utility code to run external commands (#12) Signed-off-by: Yaroslav Skopets <[email protected]> * ci: check formatting of shell scripts (#17) Signed-off-by: Yaroslav Skopets <[email protected]> * extension: add `extension build` and `extension test` commands (#10) Signed-off-by: Yaroslav Skopets <[email protected]> * ci: limit parallelism to avoid `/usr/local/go/pkg/tool/linux_amd64/link: signal: killed` (#20) Signed-off-by: Yaroslav Skopets <[email protected]> * extension: pin extensions generated by `extension init` to a version of Envoy they were prepared for (#22) Signed-off-by: Yaroslav Skopets <[email protected]> * extension: builder image should be able to generate *.wasm file at a given location (#23) Signed-off-by: Yaroslav Skopets <[email protected]> * extension: built-in toolchain should generate `*.wasm` file at a configurable output path (#24) Signed-off-by: Yaroslav Skopets <[email protected]> * refactoring: make `getenvoy run` reusable (#26) Signed-off-by: Yaroslav Skopets <[email protected]> * dependencies: upgrade to istio v1.5.0 and go-control-plane v0.9.4 (#30) Signed-off-by: Yaroslav Skopets <[email protected]> * extension: introduce extension name (#29) Signed-off-by: Yaroslav Skopets <[email protected]> * extension: refactor `getenvoy extension build|test|clean` commands (#27) Signed-off-by: Yaroslav Skopets <[email protected]> * extension: introduce `Example` concept (#28) Signed-off-by: Yaroslav Skopets <[email protected]> * ci: add setup for e2e tests (#34) Signed-off-by: Yaroslav Skopets <[email protected]> * e2e: add tests for `getenvoy extension build | test` (#36) Signed-off-by: Yaroslav Skopets <[email protected]> * extension: go generate with -f (#40) Signed-off-by: Lizan Zhou <[email protected]> Signed-off-by: Yaroslav Skopets <[email protected]> * extension: implement `getenvoy extension run` (#19) Signed-off-by: Yaroslav Skopets <[email protected]> * extension: cache state of a builder image between invocations (#33) Signed-off-by: Yaroslav Skopets <[email protected]> * e2e: add setup on MacOS (#37) Signed-off-by: Yaroslav Skopets <[email protected]> * e2e: add tests for `getenvoy extension run` (#39) Signed-off-by: Yaroslav Skopets <[email protected]> * push builders to dockerhub (#41) Signed-off-by: Lizan Zhou <[email protected]> Co-authored-by: Yaroslav Skopets <[email protected]> Signed-off-by: Yaroslav Skopets <[email protected]> * rust: update templates to use released versions of libraries (#42) Signed-off-by: Yaroslav Skopets <[email protected]> * ci: fix Rust templates (#55) Signed-off-by: Yaroslav Skopets <[email protected]> * examples: upgrade Envoy configs to avoid deprecation warnings in the log (#54) Signed-off-by: Yaroslav Skopets <[email protected]> * rust: update templates (#43) Signed-off-by: Yaroslav Skopets <[email protected]> * init: interpolate extension name in the source files (#56) Signed-off-by: Yaroslav Skopets <[email protected]> * rust: update templates (#53) Signed-off-by: Yaroslav Skopets <[email protected]> * extension: add `getenvoy extension examples` command (#58) Signed-off-by: Yaroslav Skopets <[email protected]> * e2e: increase timeouts in the test of `getenvoy extension run` (#63) Signed-off-by: Yaroslav Skopets <[email protected]> * fix: version in the compiler options had no effect when built on Linux (#62) Signed-off-by: Yaroslav Skopets <[email protected]> * extension: add `--name` flag into a usage hint generated by `getenvoy extension init` (#59) Signed-off-by: Yaroslav Skopets <[email protected]> * ci: configure Release build on GitHub Actions (#61) Signed-off-by: Yaroslav Skopets <[email protected]> * merge upstream (#67) * Add user-agent on requesting external url (#90) This patch will add user-agent on requesting external endpoint such as fetching envoy binary or manifest. This enables us to know which version users use and make it easier to support GetEnvoy users. The format of user-agent is `GetEnvoy/{Version}`. Signed-off-by: Kotaro Inoue [email protected] * Add postgres experience (#95) * Initial implementation of flavors template registry. Signed-off-by: Christoph Pakulski <[email protected]> * Moved logic producing config from individual flavor to generic flavor package. Signed-off-by: Christoph Pakulski <[email protected]> * Added InPort listening port to template parameters. Signed-off-by: Christoph Pakulski <[email protected]> * Added comments and corrected formatting. Signed-off-by: Christoph Pakulski <[email protected]> * Format and style changes for linter and go format checker. Signed-off-by: Christoph Pakulski <[email protected]> * Code corrections for linter. Signed-off-by: Christoph Pakulski <[email protected]> * Reduced gocycle complexity in NewRunCmd. Signed-off-by: Christoph Pakulski <[email protected]> * Changes after code review. Signed-off-by: Christoph Pakulski <[email protected]> * Fixed crash when template args are specified and getnevoy args point directly to Envoy image. Signed-off-by: Christoph Pakulski <[email protected]> * Added logic to create static or strict_dns type of cluster based on comma separated list of endpoints. Signed-off-by: Christoph Pakulski <[email protected]> * Added error checking when template.Execute functions are run when postgres specific config is created out of templates. Signed-off-by: Christoph Pakulski <[email protected]> * Renamed template argument from endpoint to endpoints. Signed-off-by: Christoph Pakulski <[email protected]> * Corrected methods' comments. Small refactoring of unit tests. Signed-off-by: Christoph Pakulski <[email protected]> * Removed checking for user specified config params. Signed-off-by: Christoph Pakulski <[email protected]> Co-authored-by: Kotaro Inoue <[email protected]> Co-authored-by: Christoph Pakulski <[email protected]> Signed-off-by: Yaroslav Skopets <[email protected]> * update exension templates for `wasm:1.15` (#68) Signed-off-by: Yaroslav Skopets <[email protected]> * ci: rename `getenvoy-wasm` into `getenvoy` Signed-off-by: Yaroslav Skopets <[email protected]> * ci: add GitHub Actions badge Signed-off-by: Yaroslav Skopets <[email protected]> * ci: fix configuration of `goreleaser` Signed-off-by: Yaroslav Skopets <[email protected]> * fix: DEPRECATED warning in `goreleaser` configuration Signed-off-by: Yaroslav Skopets <[email protected]> Co-authored-by: Lizan Zhou <[email protected]> Co-authored-by: Kotaro Inoue <[email protected]> Co-authored-by: Christoph Pakulski <[email protected]>
1 parent 308ea63 commit ab46d0a

File tree

352 files changed

+19647
-431
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

352 files changed

+19647
-431
lines changed

.circleci/config.yml

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,52 +12,47 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
version: 2.0
15+
version: 2.1
1616

17-
jobs:
18-
lint:
17+
executors:
18+
builder:
1919
docker:
2020
- image: circleci/golang:1.13.3
21+
22+
jobs:
23+
lint:
24+
executor: builder
25+
resource_class: medium+
2126
environment:
2227
# Run garbage collection more aggresively to avoid getting OOMed during the lint phase.
2328
GOGC: "20"
2429
# Circle CI executor has many cores (> 30) but throttles CPU and RAM. If we don't limit
2530
# this to the number of allocated cores, the job is likely to get OOMed and killed.
26-
GOMAXPROCS: "2"
31+
GOMAXPROCS: "3"
2732
steps:
2833
- checkout
34+
- run: make init
2935
- run: ./ci/install-lint
3036
- run: ./ci/lint
3137

3238
test:
33-
resource_class: small
34-
docker:
35-
- image: circleci/golang:1.13.3
39+
executor: builder
40+
resource_class: medium+
3641
steps:
3742
- checkout
43+
- run: make init
3844
- run: ./ci/install-envoy
3945
- run: ./ci/test
40-
41-
release:
42-
docker:
43-
- image: circleci/golang:1.13.3
44-
steps:
45-
- checkout
46-
- setup_remote_docker
47-
- run: echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
48-
- run: curl -sL https://git.io/goreleaser | bash
46+
- run:
47+
name: "Measure test coverage (for now, on a subset of tests)"
48+
command: make coverage GO_COVERAGE_EXTRA_OPTS="-p 1"
49+
- store_artifacts:
50+
path: build/coverage
51+
destination: /coverage
4952

5053
workflows:
5154
version: 2
52-
all:
55+
commit:
5356
jobs:
5457
- lint
5558
- test
56-
release:
57-
jobs:
58-
- release:
59-
filters:
60-
branches:
61-
ignore: /.*/
62-
tags:
63-
only: /v[0-9]+(\.[0-9]+)*(-.*)*/

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/build/
2+
!/build/bin/linux/amd64/getenvoy
3+
/dist/

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# see https://github.com/mvdan/sh#shfmt
2+
[*.sh]
3+
indent_style = tab
4+
5+
shell_variant = bash
6+
binary_next_line = true # like -bn
7+
switch_case_indent = true # like -ci
8+
space_redirects = true # like -sr
9+
keep_padding = true # like -kp
10+
11+
[godownloader.sh]
12+
# auto-generated file
13+
ignore = true

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#
2+
# Exclude extension template code from the repository's language statistics.
3+
#
4+
# See https://github.com/github/linguist/#detectable
5+
#
6+
/data/extension/init/templates/** -linguist-detectable

.github/workflows/builders.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: builders
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
paths:
7+
- images/extension-builders/**
8+
pull_request:
9+
branches: [ master ]
10+
paths:
11+
- images/extension-builders/**
12+
13+
jobs:
14+
builders:
15+
runs-on: ubuntu-18.04
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Build the Docker image
21+
run: make builders BUILDERS_TAG=${{ github.sha }}
22+
23+
- uses: azure/docker-login@v1
24+
with:
25+
username: ${{ secrets.DOCKERHUB_USERNAME }}
26+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
27+
if: github.event_name == 'push'
28+
29+
- name: Push the Docker image
30+
run: make builders.push BUILDERS_TAG=${{ github.sha }}
31+
if: github.event_name == 'push'
32+
33+
- name: Mark the Docker image latest
34+
run: make builders.push BUILDERS_TAG=latest
35+
if: github.ref == 'refs/heads/master' && github.event_name == 'push'

.github/workflows/commit.yaml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# `name` value will appear "as is" in the badge.
2+
# See https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#adding-a-workflow-status-badge-to-your-repository
3+
name: "build"
4+
5+
on:
6+
push:
7+
branches:
8+
- master
9+
pull_request:
10+
branches:
11+
- '**'
12+
13+
jobs:
14+
bin:
15+
name: "Build `getenvoy` and `e2e` binaries for use in e2e tests"
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: "Checkout"
19+
uses: actions/checkout@v2
20+
21+
- name: "Install Go"
22+
uses: actions/setup-go@v2
23+
with:
24+
go-version: '1.13.3'
25+
26+
- name: "Init on first use"
27+
run: make init
28+
29+
- name: "Build `getenvoy` and `e2e` binaries"
30+
run: make bin
31+
32+
- name: "Share `getenvoy` and `e2e` binaries with the downstream jobs"
33+
uses: actions/upload-artifact@v2
34+
with:
35+
name: bin
36+
path: build/bin
37+
38+
e2e_linux:
39+
name: "Run e2e tests on Linux"
40+
needs:
41+
- bin
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: "Checkout"
45+
uses: actions/checkout@v2
46+
47+
- name: "Re-use `getenvoy` and `e2e` binaries pre-built by the upstream job"
48+
uses: actions/download-artifact@v2
49+
with:
50+
name: bin
51+
path: build/bin
52+
53+
- name: "Build language-specific Docker build images"
54+
run: make builders
55+
56+
- name: "Run e2e tests using `getenvoy` and `e2e` binaries built by the upstream job"
57+
env:
58+
# Allow extension templates to have dependecies on private GitHub repositories.
59+
E2E_ALLOW_PRIVATE_DEPENDENCIES: 'yes'
60+
# Key of a GitHub "machine user" that has access to all private repositories needed by e2e tests:
61+
# user: https://github.com/getenvoy-ci
62+
# key fingeprint: MD5:ae:8d:18:6a:1b:44:17:dc:b8:c8:0f:a9:48:44:be:2b
63+
#
64+
# See https://developer.github.com/v3/guides/managing-deploy-keys/#machine-users
65+
E2E_GITHUB_MACHINE_USER_KEY: ${{ secrets.E2E_GITHUB_MACHINE_USER_KEY }}
66+
run: ./ci/e2e/linux/run_tests.sh
67+
68+
e2e_macos:
69+
name: "Run e2e tests on MacOS"
70+
needs:
71+
- bin
72+
runs-on: macos-latest
73+
steps:
74+
- name: "Checkout"
75+
uses: actions/checkout@v2
76+
77+
- name: "Re-use `getenvoy` and `e2e` binaries pre-built by the upstream job"
78+
uses: actions/download-artifact@v2
79+
with:
80+
name: bin
81+
path: build/bin
82+
83+
- name: "Install 'Docker for Mac' (an older version that can be installed in CI environment)"
84+
run: ./ci/e2e/macos/install_docker.sh
85+
86+
- name: "Build language-specific Docker build images"
87+
env:
88+
# don't use `DOCKER_BUILDKIT=1`, `--build-arg BUILDKIT_INLINE_CACHE=1` and `--cache-from`
89+
# options when using `Docker for Mac` in CI environment
90+
USE_DOCKER_BUILDKIT_CACHE: 'no'
91+
run: make builders
92+
93+
- name: "Run e2e tests using `getenvoy` and `e2e` binaries built by the upstream job"
94+
env:
95+
# Allow extension templates to have dependecies on private GitHub repositories.
96+
E2E_ALLOW_PRIVATE_DEPENDENCIES: 'yes'
97+
# Key of a GitHub "machine user" that has access to all private repositories needed by e2e tests:
98+
# user: https://github.com/getenvoy-ci
99+
# key fingeprint: MD5:ae:8d:18:6a:1b:44:17:dc:b8:c8:0f:a9:48:44:be:2b
100+
#
101+
# See https://developer.github.com/v3/guides/managing-deploy-keys/#machine-users
102+
E2E_GITHUB_MACHINE_USER_KEY: ${{ secrets.E2E_GITHUB_MACHINE_USER_KEY }}
103+
run: ./ci/e2e/macos/run_tests.sh

0 commit comments

Comments
 (0)