Skip to content

Commit a3c84dc

Browse files
musaprgmathetake
andauthored
wasm: packing built binary into OCI-compliant images (#107)
* init Signed-off-by: Kotaro Inoue <[email protected]> * implemented extension push command Signed-off-by: Kotaro Inoue <[email protected]> * fix errors regarding modified definition of istio bootstrap config Signed-off-by: Kotaro Inoue <[email protected]> * add toolchain name option and set its default value Signed-off-by: Kotaro Inoue <[email protected]> * run gofmt Signed-off-by: Kotaro Inoue <[email protected]> * fix not to treat as an error when specifing wasm binary outside workspace Signed-off-by: Kotaro Inoue <[email protected]> * add base files for e2e testing of `extension push` Signed-off-by: Kotaro Inoue <[email protected]> * Add testdata for unit testing of `extension push` Signed-off-by: Kotaro Inoue <[email protected]> * update still WIP test of push command Signed-off-by: Kotaro Inoue <[email protected]> * run goimports Signed-off-by: Kotaro Inoue <[email protected]> * Remove localstack from docker-compose Signed-off-by: Kotaro Inoue <[email protected]> * Replace wasm binary for testing to more smaller one Signed-off-by: Kotaro Inoue <[email protected]> * Remove unused dependencies from Makefile Signed-off-by: Kotaro Inoue <[email protected]> * Fix e2e test for `getenvoy push` Signed-off-by: Kotaro Inoue <[email protected]> * Fix error reporting on wasmimage Signed-off-by: Kotaro Inoue <[email protected]> * Implement puller for testing purpose Signed-off-by: Kotaro Inoue <[email protected]> * Add GoDoc comments Signed-off-by: Kotaro Inoue <[email protected]> * Fix Pusher Signed-off-by: Kotaro Inoue <[email protected]> * Make fields of option private Signed-off-by: Kotaro Inoue <[email protected]> * run gofmt Signed-off-by: Kotaro Inoue <[email protected]> * Add license Signed-off-by: Kotaro Inoue <[email protected]> * Fix ambiguous import error Signed-off-by: Kotaro Inoue <[email protected]> * Fix errors in the test for istio Change configurations for mock istio pilot to catch up with its changes due to some API deprecations. More details see below: - istio/istio#8257 - istio/istio@73e42fb Signed-off-by: Kotaro Inoue <[email protected]> * Fix lint issues Signed-off-by: Kotaro Inoue <[email protected]> * Fix lint issues Signed-off-by: Kotaro Inoue <[email protected]> * Upgrade required go version from 1.13 to 1.15 Signed-off-by: Kotaro Inoue <[email protected]> * Revert "Fix errors in the test for istio" This reverts commit 22f0368. Signed-off-by: Kotaro Inoue <[email protected]> * Revert "fix errors regarding modified definition of istio bootstrap config" This reverts commit 55bf471. Signed-off-by: Kotaro Inoue <[email protected]> * Revert changes to go.mod and re-resolve dependency conflicts Signed-off-by: Kotaro Inoue <[email protected]> * Make WasmImage struct private Signed-off-by: Kotaro Inoue <[email protected]> * Fix to handle error Signed-off-by: Kotaro Inoue <[email protected]> * Run goimports Signed-off-by: Kotaro Inoue <[email protected]> * Fix lint issues Signed-off-by: Kotaro Inoue <[email protected]> * Refactor a bit Signed-off-by: Kotaro Inoue <[email protected]> * Add comment to disable golint in puller's insecure option Signed-off-by: Kotaro Inoue <[email protected]> * Fix to clean passed filepath Signed-off-by: Kotaro Inoue <[email protected]> * Refactor a bit Signed-off-by: Kotaro Inoue <[email protected]> * Changed some variable's names to shorter ones Signed-off-by: Kotaro Inoue <[email protected]> * Remove unused lines in the test of push cmd Signed-off-by: Kotaro Inoue <[email protected]> * Fix tests Signed-off-by: Kotaro Inoue <[email protected]> * Fix linter issues Signed-off-by: Kotaro Inoue <[email protected]> * Refactor a bit Signed-off-by: Kotaro Inoue <[email protected]> * Add license Signed-off-by: Kotaro Inoue <[email protected]> * Fix lint issues Signed-off-by: Kotaro Inoue <[email protected]> * Add CI step to setup remote docker environment Signed-off-by: Kotaro Inoue <[email protected]> * Fix CI config to run tests with local registry Signed-off-by: Kotaro Inoue <[email protected]> * Fix to execute docker-compose in the e2e test Signed-off-by: Kotaro Inoue <[email protected]> * fix e2e Signed-off-by: mathetake <[email protected]> * fix e2e Signed-off-by: mathetake <[email protected]> * Fix permission of install_docker.sh Signed-off-by: Kotaro Inoue <[email protected]> * Fix cask install command to latest style Signed-off-by: Kotaro Inoue <[email protected]> * Revert "Fix cask install command to latest style" This reverts commit f139fe4. Signed-off-by: Kotaro Inoue <[email protected]> * Fix typo Signed-off-by: Kotaro Inoue <[email protected]> * Fix to add the default tag automatically if the tag isn't specified Signed-off-by: Kotaro Inoue <[email protected]> * Fix to ignore the log messages of oras itself Signed-off-by: Kotaro Inoue <[email protected]> * Run goimports and gofmt Signed-off-by: Kotaro Inoue <[email protected]> * Refactor a bit Signed-off-by: Kotaro Inoue <[email protected]> * Fix e2e test to run envoy with pulled image Signed-off-by: Kotaro Inoue <[email protected]> * Collect linter issues Signed-off-by: Kotaro Inoue <[email protected]> * Fix docker-compose Signed-off-by: Kotaro Inoue <[email protected]> * Tiny fixes to collect issues Signed-off-by: Kotaro Inoue <[email protected]> * Fix the order of imports Signed-off-by: Kotaro Inoue <[email protected]> * Remove unused flag Signed-off-by: Kotaro Inoue <[email protected]> * Fix the order of imports Signed-off-by: Kotaro Inoue <[email protected]> * Make mediatypes private Signed-off-by: Kotaro Inoue <[email protected]> * Refactor a bit Signed-off-by: Kotaro Inoue <[email protected]> * Refactor a bit Signed-off-by: Kotaro Inoue <[email protected]> * Refactor a bit Signed-off-by: Kotaro Inoue <[email protected]> * Fix help message Signed-off-by: Kotaro Inoue <[email protected]> * Fix to check magic number for validation Signed-off-by: Kotaro Inoue <[email protected]> * Fix linter issues Signed-off-by: Kotaro Inoue <[email protected]> * Refactor a bit Signed-off-by: Kotaro Inoue <[email protected]> Co-authored-by: mathetake <[email protected]>
1 parent aafa858 commit a3c84dc

File tree

22 files changed

+1107
-38
lines changed

22 files changed

+1107
-38
lines changed

.circleci/config.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ version: 2.1
1717
executors:
1818
builder:
1919
docker:
20-
- image: circleci/golang:1.13.3
20+
- image: circleci/golang:1.15.6
21+
- image: registry:2
2122

2223
jobs:
2324
lint:

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,16 @@ release.dryrun:
9595

9696
.PHONY: test
9797
test: generate
98+
docker-compose up -d
99+
go test $(GO_TEST_OPTS) $(GO_TEST_EXTRA_OPTS) $(TEST_PKG_LIST)
100+
101+
.PHONY: test.ci
102+
test.ci: generate
98103
go test $(GO_TEST_OPTS) $(GO_TEST_EXTRA_OPTS) $(TEST_PKG_LIST)
99104

100105
.PHONY: e2e
101106
e2e: $(call GETENVOY_OUT_PATH,$(GOOS),$(GOARCH)) $(call E2E_OUT_PATH,$(GOOS),$(GOARCH))
107+
docker-compose up -d
102108
E2E_GETENVOY_BINARY=$(PWD)/$(call GETENVOY_OUT_PATH,$(GOOS),$(GOARCH)) $(call E2E_OUT_PATH,$(GOOS),$(GOARCH)) $(GO_TEST_OPTS) $(GO_TEST_EXTRA_OPTS) $(E2E_OPTS) $(E2E_EXTRA_OPTS)
103109

104110
.PHONY: bin

ci/e2e/linux/run_tests.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ export E2E_BUILTIN_TOOLCHAIN_CONTAINER_OPTIONS="${E2E_BUILTIN_TOOLCHAIN_CONTAINE
3232
# restore executable bit that get lost by Github Actions during artifact upload/download
3333
chmod a+x ${WORKSPACE_DIR}/build/bin/linux/amd64/*
3434

35+
# start other containers required in e2e tests
36+
docker-compose up -d
37+
3538
# run e2e tests on a `getenvoy` binary built by the upstream job
3639
export E2E_GETENVOY_BINARY="${WORKSPACE_DIR}/build/bin/linux/amd64/getenvoy"
3740

ci/e2e/macos/run_tests.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ export E2E_BUILTIN_TOOLCHAIN_CONTAINER_OPTIONS="${E2E_BUILTIN_TOOLCHAIN_CONTAINE
3434
# restore executable bit that get lost by Github Actions during artifact upload/download
3535
chmod a+x ${WORKSPACE_DIR}/build/bin/darwin/amd64/*
3636

37+
# start other containers required in e2e tests
38+
docker-compose up -d
39+
3740
# run e2e tests on a `getenvoy` binary built by the upstream job
3841
export E2E_GETENVOY_BINARY="${WORKSPACE_DIR}/build/bin/darwin/amd64/getenvoy"
3942

ci/test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
BASEDIR=$(dirname "$0")
44

5-
make test GO_TEST_EXTRA_OPTS="-timeout 60s" -C "${BASEDIR}/.."
5+
make test.ci GO_TEST_EXTRA_OPTS="-timeout 60s" -C "${BASEDIR}/.."

docker-compose.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2021 Tetrate
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
version: '3'
16+
services:
17+
registry:
18+
image: registry:2
19+
ports:
20+
- "5000:5000"

go.mod

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,27 @@ go 1.13
44

55
require (
66
bitbucket.org/creachadair/shell v0.0.6
7+
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
78
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
9+
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a
10+
github.com/containerd/containerd v1.3.2
11+
github.com/deislabs/oras v0.8.1
812
github.com/docker/distribution v2.7.1+incompatible
913
github.com/envoyproxy/go-control-plane v0.9.5
1014
github.com/ghodss/yaml v1.0.0
11-
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a
1215
github.com/go-ole/go-ole v1.2.4 // indirect
13-
github.com/gogo/protobuf v1.3.0
1416
github.com/golang/protobuf v1.3.5
15-
github.com/hashicorp/go-multierror v1.0.0
17+
github.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect
1618
github.com/manifoldco/promptui v0.0.0-00010101000000-000000000000
1719
github.com/mattn/go-isatty v0.0.12
1820
github.com/mattn/go-shellwords v1.0.10
1921
github.com/mholt/archiver v3.1.1+incompatible
2022
github.com/mitchellh/go-homedir v1.1.0
2123
github.com/onsi/ginkgo v1.12.1
2224
github.com/onsi/gomega v1.10.0
25+
github.com/opencontainers/go-digest v1.0.0-rc1
26+
github.com/opencontainers/image-spec v1.0.1
27+
github.com/opencontainers/selinux v1.8.0 // indirect
2328
github.com/otiai10/copy v1.2.0
2429
github.com/pkg/errors v0.9.1
2530
github.com/rakyll/statik v0.0.0-00010101000000-000000000000
@@ -34,8 +39,15 @@ require (
3439
gotest.tools v2.2.0+incompatible
3540
istio.io/api v0.0.0-20200227213531-891bf31f3c32
3641
istio.io/istio v0.0.0-20200304114959-c3c353285578
42+
rsc.io/letsencrypt v0.0.3 // indirect
3743
)
3844

45+
replace github.com/Azure/go-autorest/autorest => github.com/Azure/go-autorest/autorest v0.11.15
46+
47+
replace github.com/docker/docker => github.com/docker/docker v17.12.1-ce+incompatible
48+
49+
replace github.com/hashicorp/consul => github.com/hashicorp/consul v1.3.1
50+
3951
replace github.com/manifoldco/promptui => github.com/yskopets/promptui v0.7.1-0.20200429230902-361491009c11
4052

4153
replace github.com/rakyll/statik => github.com/yskopets/statik v0.1.8-0.20200501213002-c2d8dcc79889

0 commit comments

Comments
 (0)