Skip to content

Commit

Permalink
wasm: packing built binary into OCI-compliant images (#107)
Browse files Browse the repository at this point in the history
* init

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* implemented extension push command

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* fix errors regarding modified definition of istio bootstrap config

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* add toolchain name option and set its default value

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* run gofmt

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* fix not to treat as an error when specifing wasm binary outside workspace

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* add base files for e2e testing of `extension push`

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Add testdata for unit testing of `extension push`

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* update still WIP test of push command

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* run goimports

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Remove localstack from docker-compose

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Replace wasm binary for testing to more smaller one

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Remove unused dependencies from Makefile

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix e2e test for `getenvoy push`

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix error reporting on wasmimage

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Implement puller for testing purpose

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Add GoDoc comments

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix Pusher

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Make fields of option private

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* run gofmt

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Add license

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix ambiguous import error

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* 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 <k.musaino@gmail.com>

* Fix lint issues

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix lint issues

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Upgrade required go version from 1.13 to 1.15

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Revert "Fix errors in the test for istio"

This reverts commit 22f0368.

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Revert "fix errors regarding modified definition of istio bootstrap config"

This reverts commit 55bf471.

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Revert changes to go.mod and re-resolve dependency conflicts

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Make WasmImage struct private

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix to handle error

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Run goimports

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix lint issues

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Refactor a bit

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Add comment to disable golint in puller's insecure option

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix to clean passed filepath

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Refactor a bit

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Changed some variable's names to shorter ones

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Remove unused lines in the test of push cmd

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix tests

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix linter issues

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Refactor a bit

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Add license

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix lint issues

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Add CI step to setup remote docker environment

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix CI config to run tests with local registry

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix to execute docker-compose in the e2e test

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* fix e2e

Signed-off-by: mathetake <takeshi@tetrate.io>

* fix e2e

Signed-off-by: mathetake <takeshi@tetrate.io>

* Fix permission of install_docker.sh

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix cask install command to latest style

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Revert "Fix cask install command to latest style"

This reverts commit f139fe4.

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix typo

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix to add the default tag automatically if the tag isn't specified

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix to ignore the log messages of oras itself

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Run goimports and gofmt

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Refactor a bit

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix e2e test to run envoy with pulled image

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Collect linter issues

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix docker-compose

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Tiny fixes to collect issues

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix the order of imports

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Remove unused flag

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix the order of imports

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Make mediatypes private

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Refactor a bit

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Refactor a bit

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Refactor a bit

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix help message

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix to check magic number for validation

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Fix linter issues

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

* Refactor a bit

Signed-off-by: Kotaro Inoue <k.musaino@gmail.com>

Co-authored-by: mathetake <takeshi@tetrate.io>
  • Loading branch information
musaprg and mathetake authored Jan 30, 2021
1 parent aafa858 commit a3c84dc
Show file tree
Hide file tree
Showing 22 changed files with 1,107 additions and 38 deletions.
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ version: 2.1
executors:
builder:
docker:
- image: circleci/golang:1.13.3
- image: circleci/golang:1.15.6
- image: registry:2

jobs:
lint:
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,16 @@ release.dryrun:

.PHONY: test
test: generate
docker-compose up -d
go test $(GO_TEST_OPTS) $(GO_TEST_EXTRA_OPTS) $(TEST_PKG_LIST)

.PHONY: test.ci
test.ci: generate
go test $(GO_TEST_OPTS) $(GO_TEST_EXTRA_OPTS) $(TEST_PKG_LIST)

.PHONY: e2e
e2e: $(call GETENVOY_OUT_PATH,$(GOOS),$(GOARCH)) $(call E2E_OUT_PATH,$(GOOS),$(GOARCH))
docker-compose up -d
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)

.PHONY: bin
Expand Down
3 changes: 3 additions & 0 deletions ci/e2e/linux/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ export E2E_BUILTIN_TOOLCHAIN_CONTAINER_OPTIONS="${E2E_BUILTIN_TOOLCHAIN_CONTAINE
# restore executable bit that get lost by Github Actions during artifact upload/download
chmod a+x ${WORKSPACE_DIR}/build/bin/linux/amd64/*

# start other containers required in e2e tests
docker-compose up -d

# run e2e tests on a `getenvoy` binary built by the upstream job
export E2E_GETENVOY_BINARY="${WORKSPACE_DIR}/build/bin/linux/amd64/getenvoy"

Expand Down
3 changes: 3 additions & 0 deletions ci/e2e/macos/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export E2E_BUILTIN_TOOLCHAIN_CONTAINER_OPTIONS="${E2E_BUILTIN_TOOLCHAIN_CONTAINE
# restore executable bit that get lost by Github Actions during artifact upload/download
chmod a+x ${WORKSPACE_DIR}/build/bin/darwin/amd64/*

# start other containers required in e2e tests
docker-compose up -d

# run e2e tests on a `getenvoy` binary built by the upstream job
export E2E_GETENVOY_BINARY="${WORKSPACE_DIR}/build/bin/darwin/amd64/getenvoy"

Expand Down
2 changes: 1 addition & 1 deletion ci/test
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

BASEDIR=$(dirname "$0")

make test GO_TEST_EXTRA_OPTS="-timeout 60s" -C "${BASEDIR}/.."
make test.ci GO_TEST_EXTRA_OPTS="-timeout 60s" -C "${BASEDIR}/.."
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2021 Tetrate
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

version: '3'
services:
registry:
image: registry:2
ports:
- "5000:5000"
18 changes: 15 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,27 @@ go 1.13

require (
bitbucket.org/creachadair/shell v0.0.6
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a
github.com/containerd/containerd v1.3.2
github.com/deislabs/oras v0.8.1
github.com/docker/distribution v2.7.1+incompatible
github.com/envoyproxy/go-control-plane v0.9.5
github.com/ghodss/yaml v1.0.0
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/gogo/protobuf v1.3.0
github.com/golang/protobuf v1.3.5
github.com/hashicorp/go-multierror v1.0.0
github.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect
github.com/manifoldco/promptui v0.0.0-00010101000000-000000000000
github.com/mattn/go-isatty v0.0.12
github.com/mattn/go-shellwords v1.0.10
github.com/mholt/archiver v3.1.1+incompatible
github.com/mitchellh/go-homedir v1.1.0
github.com/onsi/ginkgo v1.12.1
github.com/onsi/gomega v1.10.0
github.com/opencontainers/go-digest v1.0.0-rc1
github.com/opencontainers/image-spec v1.0.1
github.com/opencontainers/selinux v1.8.0 // indirect
github.com/otiai10/copy v1.2.0
github.com/pkg/errors v0.9.1
github.com/rakyll/statik v0.0.0-00010101000000-000000000000
Expand All @@ -34,8 +39,15 @@ require (
gotest.tools v2.2.0+incompatible
istio.io/api v0.0.0-20200227213531-891bf31f3c32
istio.io/istio v0.0.0-20200304114959-c3c353285578
rsc.io/letsencrypt v0.0.3 // indirect
)

replace github.com/Azure/go-autorest/autorest => github.com/Azure/go-autorest/autorest v0.11.15

replace github.com/docker/docker => github.com/docker/docker v17.12.1-ce+incompatible

replace github.com/hashicorp/consul => github.com/hashicorp/consul v1.3.1

replace github.com/manifoldco/promptui => github.com/yskopets/promptui v0.7.1-0.20200429230902-361491009c11

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

0 comments on commit a3c84dc

Please sign in to comment.