Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: remove ci workspace #6229

Merged
merged 18 commits into from
Apr 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
api
examples/grpc-bridge/script
8 changes: 4 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
workspace(name = "envoy")

load("//bazel:api_repositories.bzl", "envoy_api_dependencies")

envoy_api_dependencies()

load("//bazel:repositories.bzl", "GO_VERSION", "envoy_dependencies")
load("//bazel:cc_configure.bzl", "cc_configure")

Expand All @@ -11,10 +15,6 @@ rules_foreign_cc_dependencies()

cc_configure()

load("@envoy_api//bazel:repositories.bzl", "api_dependencies")

api_dependencies()

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

go_rules_dependencies()
Expand Down
35 changes: 35 additions & 0 deletions bazel/api_repositories.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
def _default_envoy_api_impl(ctx):
ctx.file("WORKSPACE", "")
ctx.file("BUILD.bazel", "")
api_dirs = [
"bazel",
"docs",
"envoy",
"examples",
"test",
"tools",
]
for d in api_dirs:
ctx.symlink(ctx.path(ctx.attr.api).dirname.get_child(d), d)

_default_envoy_api = repository_rule(
implementation = _default_envoy_api_impl,
attrs = {
"api": attr.label(default = "@envoy//api:BUILD"),
},
)

def envoy_api_dependencies():
# Treat the data plane API as an external repo, this simplifies exporting the API to
# https://github.com/envoyproxy/data-plane-api.
if "envoy_api" not in native.existing_rules().keys():
_default_envoy_api(name = "envoy_api")

native.bind(
name = "api_httpbody_protos",
actual = "@googleapis//:api_httpbody_protos",
)
native.bind(
name = "http_api_protos",
actual = "@googleapis//:http_api_protos",
)
57 changes: 11 additions & 46 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load(":genrule_repository.bzl", "genrule_repository")
load("//api/bazel:envoy_http_archive.bzl", "envoy_http_archive")
load("@envoy_api//bazel:envoy_http_archive.bzl", "envoy_http_archive")
load(":repository_locations.bzl", "REPOSITORY_LOCATIONS")
load(
"@bazel_tools//tools/cpp:windows_cc_configure.bzl",
"find_vc_path",
"setup_vc_env_vars",
)
load("@bazel_tools//tools/cpp:lib_cc_configure.bzl", "get_env_var")
load("@envoy_api//bazel:repositories.bzl", "api_dependencies")

# dict of {build recipe name: longform extension name,}
PPC_SKIP_TARGETS = {"luajit": "envoy.filters.http.lua"}
Expand Down Expand Up @@ -38,27 +39,6 @@ _default_envoy_build_config = repository_rule(
},
)

def _default_envoy_api_impl(ctx):
ctx.file("WORKSPACE", "")
ctx.file("BUILD.bazel", "")
api_dirs = [
"bazel",
"docs",
"envoy",
"examples",
"test",
"tools",
]
for d in api_dirs:
ctx.symlink(ctx.path(ctx.attr.api).dirname.get_child(d), d)

_default_envoy_api = repository_rule(
implementation = _default_envoy_api_impl,
attrs = {
"api": attr.label(default = "@envoy//api:BUILD"),
},
)

# Python dependencies. If these become non-trivial, we might be better off using a virtualenv to
# wrap them, but for now we can treat them as first-class Bazel.
def _python_deps():
Expand Down Expand Up @@ -94,6 +74,14 @@ def _python_deps():
name = "com_github_twitter_common_finagle_thrift",
build_file = "@envoy//bazel/external:twitter_common_finagle_thrift.BUILD",
)
_repository_impl(
name = "six_archive",
build_file = "@com_google_protobuf//:six.BUILD",
)
native.bind(
name = "six",
actual = "@six_archive//:six",
)

# Bazel native C++ dependencies. For the dependencies that doesn't provide autoconf/automake builds.
def _cc_deps():
Expand Down Expand Up @@ -127,29 +115,6 @@ def _go_deps(skip_targets):
_repository_impl("io_bazel_rules_go")
_repository_impl("bazel_gazelle")

def _envoy_api_deps():
# Treat the data plane API as an external repo, this simplifies exporting the API to
# https://github.com/envoyproxy/data-plane-api.
if "envoy_api" not in native.existing_rules().keys():
_default_envoy_api(name = "envoy_api")

native.bind(
name = "api_httpbody_protos",
actual = "@googleapis//:api_httpbody_protos",
)
native.bind(
name = "http_api_protos",
actual = "@googleapis//:http_api_protos",
)
_repository_impl(
name = "six_archive",
build_file = "@com_google_protobuf//:six.BUILD",
)
native.bind(
name = "six",
actual = "@six_archive//:six",
)

def envoy_dependencies(skip_targets = []):
# Treat Envoy's overall build config as an external repo, so projects that
# build Envoy as a subcomponent can easily override the config.
Expand Down Expand Up @@ -207,7 +172,7 @@ def envoy_dependencies(skip_targets = []):
_python_deps()
_cc_deps()
_go_deps(skip_targets)
_envoy_api_deps()
api_dependencies()

def _boringssl():
_repository_impl("boringssl")
Expand Down
29 changes: 0 additions & 29 deletions ci/WORKSPACE

This file was deleted.

6 changes: 3 additions & 3 deletions ci/WORKSPACE.filter.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ local_repository(
path = "/source",
)

load("@envoy//bazel:api_repositories.bzl", "envoy_api_dependencies")
envoy_api_dependencies()

load("@envoy//bazel:repositories.bzl", "envoy_dependencies", "GO_VERSION")
load("@envoy//bazel:cc_configure.bzl", "cc_configure")

Expand All @@ -16,9 +19,6 @@ rules_foreign_cc_dependencies()

cc_configure()

load("@envoy_api//bazel:repositories.bzl", "api_dependencies")
api_dependencies()

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains(go_version = GO_VERSION)
16 changes: 1 addition & 15 deletions ci/build_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ else
fi

# Not sandboxing, since non-privileged Docker can't do nested namespaces.
BAZEL_OPTIONS="--package_path %workspace%:${ENVOY_SRCDIR}"
export BAZEL_QUERY_OPTIONS="${BAZEL_OPTIONS}"
export BAZEL_BUILD_OPTIONS="--strategy=Genrule=standalone --spawn_strategy=standalone \
--verbose_failures ${BAZEL_OPTIONS} --action_env=HOME --action_env=PYTHONUSERBASE \
Expand All @@ -92,7 +91,7 @@ if [ "$1" != "-nofetch" ]; then
then
git clone https://github.com/envoyproxy/envoy-filter-example.git "${ENVOY_FILTER_EXAMPLE_SRCDIR}"
fi

# This is the hash on https://github.com/envoyproxy/envoy-filter-example.git we pin to.
(cd "${ENVOY_FILTER_EXAMPLE_SRCDIR}" && git fetch origin && git checkout -f 6c0625cb4cc9a21df97cef2a1d065463f2ae81ae)
cp -f "${ENVOY_SRCDIR}"/ci/WORKSPACE.filter.example "${ENVOY_FILTER_EXAMPLE_SRCDIR}"/WORKSPACE
Expand All @@ -101,7 +100,6 @@ fi
# Also setup some space for building Envoy standalone.
export ENVOY_BUILD_DIR="${BUILD_DIR}"/envoy
mkdir -p "${ENVOY_BUILD_DIR}"
cp -f "${ENVOY_SRCDIR}"/ci/WORKSPACE "${ENVOY_BUILD_DIR}"

# This is where we copy build deliverables to.
export ENVOY_DELIVERY_DIR="${ENVOY_BUILD_DIR}"/source/exe
Expand All @@ -119,29 +117,17 @@ mkdir -p "${ENVOY_FAILED_TEST_LOGS}"
export ENVOY_BUILD_PROFILE="${ENVOY_BUILD_DIR}"/generated/build-profile
mkdir -p "${ENVOY_BUILD_PROFILE}"

# This is where we build for bazel.release* and bazel.dev.
export ENVOY_CI_DIR="${ENVOY_SRCDIR}"/ci

function cleanup() {
# Remove build artifacts. This doesn't mess with incremental builds as these
# are just symlinks.
rm -rf "${ENVOY_SRCDIR}"/bazel-*
rm -rf "${ENVOY_CI_DIR}"/bazel-*
rm -rf "${ENVOY_CI_DIR}"/bazel
rm -rf "${ENVOY_CI_DIR}"/tools
rm -f "${ENVOY_CI_DIR}"/.bazelrc
}

cleanup
trap cleanup EXIT

# Hack due to https://github.com/envoyproxy/envoy/issues/838 and the need to have
# .bazelrc available for build linkstamping.
mkdir -p "${ENVOY_FILTER_EXAMPLE_SRCDIR}"/bazel
mkdir -p "${ENVOY_CI_DIR}"/bazel
ln -sf "${ENVOY_SRCDIR}"/bazel/get_workspace_status "${ENVOY_FILTER_EXAMPLE_SRCDIR}"/bazel/
ln -sf "${ENVOY_SRCDIR}"/bazel/get_workspace_status "${ENVOY_CI_DIR}"/bazel/
cp -f "${ENVOY_SRCDIR}"/.bazelrc "${ENVOY_FILTER_EXAMPLE_SRCDIR}"/
cp -f "${ENVOY_SRCDIR}"/.bazelrc "${ENVOY_CI_DIR}"/

export BUILDIFIER_BIN="/usr/local/bin/buildifier"
Loading