Skip to content

Commit

Permalink
Fix building extensions as WebAssembly modules (again). (istio#2528)
Browse files Browse the repository at this point in the history
* Fix building extensions as WebAssembly modules (again).

Those WebAssembly modules are not built as part of the CI yet,
because we cannot run Docker-in-Docker.

Signed-off-by: Piotr Sikora <[email protected]>

* review: propagate build failures.

Signed-off-by: Piotr Sikora <[email protected]>
  • Loading branch information
PiotrSikora authored and istio-testing committed Nov 7, 2019
1 parent c3fda9c commit c56a27e
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ docker/envoy
*.iml
*.test
/artifacts
**/plugin.wasm
3 changes: 3 additions & 0 deletions Makefile.core.mk
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ build:
build_envoy:
export PATH=$(PATH) CC=$(CC) CXX=$(CXX) && bazel $(BAZEL_STARTUP_ARGS) build $(BAZEL_BUILD_ARGS) $(BAZEL_CONFIG_REL) //src/envoy:envoy

build_wasm:
$(foreach file, $(shell find extensions -name build_wasm.sh), cd $(TOP)/$(shell dirname $(file)) && bash ./build_wasm.sh &&) true

clean:
@bazel clean

Expand Down
5 changes: 4 additions & 1 deletion extensions/common/node_info_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@

#include "extensions/common/node_info_cache.h"

#include "absl/strings/str_cat.h"
#include "extensions/common/context.h"
#include "google/protobuf/util/json_util.h"

using google::protobuf::util::Status;

#ifdef NULL_PLUGIN

using Envoy::Extensions::Common::Wasm::Null::Plugin::getStringValue;
using Envoy::Extensions::Common::Wasm::Null::Plugin::getStructValue;
using Envoy::Extensions::Common::Wasm::Null::Plugin::logDebug;
using Envoy::Extensions::Common::Wasm::Null::Plugin::logInfo;
using google::protobuf::util::Status;

#endif // NULL_PLUGIN

Expand Down
2 changes: 2 additions & 0 deletions extensions/metadata_exchange/build_wasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

docker run -e uid="$(id -u)" -e gid="$(id -g)" -v $PWD:/work -w /work -v $(realpath $PWD/../../extensions):/work/extensions gcr.io/istio-testing/wasmsdk:v2 bash /build_wasm.sh
rmdir extensions
3 changes: 2 additions & 1 deletion extensions/metadata_exchange/plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

#pragma once

#include "extensions/common/context.h"

#ifndef NULL_PLUGIN

#include <assert.h>
Expand All @@ -26,7 +28,6 @@ static const std::string EMPTY_STRING;

#else

#include "extensions/common/context.h"
#include "extensions/common/wasm/null/null_plugin.h"

namespace Envoy {
Expand Down
2 changes: 1 addition & 1 deletion extensions/stats/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ABSL = /root/abseil-cpp
ABSL_CPP = ${ABSL}/absl/strings/str_cat.cc ${ABSL}/absl/strings/str_split.cc ${ABSL}/absl/strings/numbers.cc ${ABSL}/absl/strings/ascii.cc

PROTO_SRCS = extensions/common/node_info.pb.cc config.pb.cc
COMMON_SRCS = extensions/common/context.cc
COMMON_SRCS = extensions/common/context.cc extensions/common/node_info_cache.cc extensions/common/util.cc

all: plugin.wasm

Expand Down
2 changes: 2 additions & 0 deletions extensions/stats/build_wasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

docker run -e uid="$(id -u)" -e gid="$(id -g)" -v $PWD:/work -w /work -v $(realpath $PWD/../../extensions):/work/extensions gcr.io/istio-testing/wasmsdk:v2 bash /build_wasm.sh
rmdir extensions
Binary file removed extensions/stats/plugin.wasm
Binary file not shown.

0 comments on commit c56a27e

Please sign in to comment.