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: use small image and use remote_jdk #7786

Merged
merged 10 commits into from
Aug 1, 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
6 changes: 2 additions & 4 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ build --experimental_local_memory_estimate
build --host_force_python=PY2
build --action_env=BAZEL_LINKLIBS=-l%:libstdc++.a
build --action_env=BAZEL_LINKOPTS=-lm:-static-libgcc
build --host_javabase=@bazel_tools//tools/jdk:remote_jdk11
build --javabase=@bazel_tools//tools/jdk:remote_jdk11

# Basic ASAN/UBSAN that works for gcc
build:asan --action_env=BAZEL_LINKLIBS=
Expand Down Expand Up @@ -83,10 +85,6 @@ build:sizeopt -c opt --copt -Os
build --test_env=HEAPCHECK=normal --test_env=PPROF_PATH

# Remote execution: https://docs.bazel.build/versions/master/remote-execution.html
build:rbe-toolchain --host_javabase=@rbe_ubuntu_clang//java:jdk
build:rbe-toolchain --javabase=@rbe_ubuntu_clang//java:jdk
build:rbe-toolchain --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
build:rbe-toolchain --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
build:rbe-toolchain --host_platform=@envoy//bazel/toolchains:rbe_ubuntu_clang_platform
build:rbe-toolchain --platforms=@envoy//bazel/toolchains:rbe_ubuntu_clang_platform
build:rbe-toolchain --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.28.0
0.28.1
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ executors:
description: "A regular build executor based on ubuntu image"
docker:
# NOTE: Update bazel/toolchains/rbe_toolchains_config.bzl with sha256 digest to match the image here.
- image: envoyproxy/envoy-build:8246167b9d238797cbc6c03dccc9e3921c37617d
- image: envoyproxy/envoy-build:b02c73f3ebbaf5c7852fa814eb3d61e841588068
resource_class: xlarge
working_directory: /source

Expand Down
14 changes: 8 additions & 6 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ REPOSITORY_LOCATIONS = dict(
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.17.0/bazel-gazelle-0.17.0.tar.gz"],
),
bazel_toolchains = dict(
sha256 = "68e7678473090542e679ce7e6aa8a3ba5669577dede2b404f9865d556bd99f10",
strip_prefix = "bazel-toolchains-0.28.0",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/0.28.0.tar.gz",
"https://github.com/bazelbuild/bazel-toolchains/archive/0.28.0.tar.gz",
],
sha256 = "0710ec5a88201c4c3038ea458f7e9078cc3ad7ad61736ab287c115438eb91b1d",
strip_prefix = "bazel-toolchains-5a8611ee011d0d68498b16bf42a9c69d139bc708",
# 2019-08-01
# Need:
# - https://github.com/bazelbuild/bazel-toolchains/pull/644 to select correct toolchain from same image
# - https://github.com/bazelbuild/bazel-toolchains/pull/650 to support no java config
# TODO(lizan): Update to release when new version is released.
urls = ["https://github.com/bazelbuild/bazel-toolchains/archive/5a8611ee011d0d68498b16bf42a9c69d139bc708.tar.gz"],
),
boringssl = dict(
# Use commits from branch "chromium-stable-with-bazel"
Expand Down
25 changes: 0 additions & 25 deletions bazel/toolchains/configs/clang/bazel_0.28.0/java/BUILD

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ cc_toolchain_config(
"-Wl,-z,relro,-z,now",
"-B/usr/lib/llvm-8/bin",
"-lm",
"-static-libgcc"],
"-static-libgcc",
"-fuse-ld=lld"],
link_libs = ["-l:libstdc++.a"],
opt_link_flags = ["-Wl,--gc-sections"],
unfiltered_compile_flags = ["-no-canonical-prefixes",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ toolchain(
"@bazel_tools//platforms:linux",
"@bazel_tools//platforms:x86_64",
],
toolchain = "//bazel/toolchains/configs/clang/bazel_0.28.0/cc:cc-compiler-k8",
toolchain = "//bazel/toolchains/configs/clang/bazel_0.28.1/cc:cc-compiler-k8",
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
)

Expand All @@ -43,7 +43,7 @@ platform(
remote_execution_properties = """
properties: {
name: "container-image"
value:"docker://gcr.io/envoy-ci/envoy-build@sha256:9dbe1cba2b3340d49a25a1d286c8d49083ec986a6fead27f487e80ca334f065f"
value:"docker://gcr.io/envoy-ci/envoy-build@sha256:555fb7b0aa578d11852b57c6c14fd54ab4450ad001a9f03bb5c43d5454460c28"
}
properties {
name: "OSFamily"
Expand Down
149 changes: 149 additions & 0 deletions bazel/toolchains/configs/clang_libcxx/bazel_0.28.1/cc/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# Copyright 2016 The Bazel Authors. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think you can move this to some other repository that we consume, to reduce the churn in the main Envoy repo? Just a suggestion, we can ship this PR as is.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is totally possible to have whole bazel/toolchains/configs in a separate repo, or even just a generated tar in somewhere (like the build image). It just need more bash snafu to automate the generate process though.

I don't expect much more churn from here other than every bazel update (likely it will be just rename based on Bazel version) or adding new configuration (e.g. MSAN)

#
# 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.

# This becomes the BUILD file for @local_config_cc// under non-FreeBSD unixes.

package(default_visibility = ["//visibility:public"])

load(":cc_toolchain_config.bzl", "cc_toolchain_config")
load(":armeabi_cc_toolchain_config.bzl", "armeabi_cc_toolchain_config")

licenses(["notice"]) # Apache 2.0

cc_library(
name = "malloc",
)

filegroup(
name = "empty",
srcs = [],
)

filegroup(
name = "cc_wrapper",
srcs = ["cc_wrapper.sh"],
)

filegroup(
name = "compiler_deps",
srcs = glob(["extra_tools/**"], allow_empty = True) + [":empty"],
)

# This is the entry point for --crosstool_top. Toolchains are found
# by lopping off the name of --crosstool_top and searching for
# the "${CPU}" entry in the toolchains attribute.
cc_toolchain_suite(
name = "toolchain",
toolchains = {
"k8|clang": ":cc-compiler-k8",
"k8": ":cc-compiler-k8",
"armeabi-v7a|compiler": ":cc-compiler-armeabi-v7a",
"armeabi-v7a": ":cc-compiler-armeabi-v7a",
},
)

cc_toolchain(
name = "cc-compiler-k8",
toolchain_identifier = "local",
toolchain_config = ":local",
all_files = ":compiler_deps",
ar_files = ":compiler_deps",
as_files = ":compiler_deps",
compiler_files = ":compiler_deps",
dwp_files = ":empty",
linker_files = ":compiler_deps",
objcopy_files = ":empty",
strip_files = ":empty",
supports_param_files = 1,
)

cc_toolchain_config(
name = "local",
cpu = "k8",
compiler = "clang",
toolchain_identifier = "local",
host_system_name = "local",
target_system_name = "local",
target_libc = "local",
abi_version = "local",
abi_libc_version = "local",
cxx_builtin_include_directories = ["/usr/local/include",
"/usr/lib/llvm-8/lib/clang/8.0.1/include",
"/usr/include/x86_64-linux-gnu",
"/usr/include",
"/usr/lib/llvm-8/include/c++/v1",
"/usr/include/clang/8.0.1/include"],
tool_paths = {"ar": "/usr/bin/ar",
"ld": "/usr/bin/ld",
"cpp": "/usr/bin/cpp",
"gcc": "/usr/lib/llvm-8/bin/clang",
"dwp": "/usr/bin/dwp",
"gcov": "/usr/lib/llvm-8/bin/llvm-profdata",
"nm": "/usr/bin/nm",
"objcopy": "/usr/bin/objcopy",
"objdump": "/usr/bin/objdump",
"strip": "/usr/bin/strip"},
compile_flags = ["-U_FORTIFY_SOURCE",
"-fstack-protector",
"-Wall",
"-Wthread-safety",
"-Wself-assign",
"-fcolor-diagnostics",
"-fno-omit-frame-pointer"],
opt_compile_flags = ["-g0",
"-O2",
"-D_FORTIFY_SOURCE=1",
"-DNDEBUG",
"-ffunction-sections",
"-fdata-sections"],
dbg_compile_flags = ["-g"],
cxx_flags = ["-stdlib=libc++"],
link_flags = ["-fuse-ld=gold",
"-Wl,-no-as-needed",
"-Wl,-z,relro,-z,now",
"-B/usr/lib/llvm-8/bin",
"-lm",
"-static-libgcc",
"-pthread",
"-fuse-ld=lld"],
link_libs = ["-l:libc++.a",
"-l:libc++abi.a"],
opt_link_flags = ["-Wl,--gc-sections"],
unfiltered_compile_flags = ["-no-canonical-prefixes",
"-Wno-builtin-macro-redefined",
"-D__DATE__=\"redacted\"",
"-D__TIMESTAMP__=\"redacted\"",
"-D__TIME__=\"redacted\""],
coverage_compile_flags = ["-fprofile-instr-generate", "-fcoverage-mapping"],
coverage_link_flags = ["-fprofile-instr-generate"],
supports_start_end_lib = True,
)

# Android tooling requires a default toolchain for the armeabi-v7a cpu.
cc_toolchain(
name = "cc-compiler-armeabi-v7a",
toolchain_identifier = "stub_armeabi-v7a",
toolchain_config = ":stub_armeabi-v7a",
all_files = ":empty",
ar_files = ":empty",
as_files = ":empty",
compiler_files = ":empty",
dwp_files = ":empty",
linker_files = ":empty",
objcopy_files = ":empty",
strip_files = ":empty",
supports_param_files = 1,
)

armeabi_cc_toolchain_config(name = "stub_armeabi-v7a")
20 changes: 10 additions & 10 deletions ...hains/configs/gcc/bazel_0.28.0/java/BUILD → ...lang_libcxx/bazel_0.28.1/cc/cc_wrapper.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright 2016 The Bazel Authors. All rights reserved.
#!/bin/bash
#
# Copyright 2015 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -11,15 +13,13 @@
# 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.
#
# Ship the environment to the C++ action
#
set -eu

# This file is auto-generated by an rbe_autoconfig repository rule
# and should not be modified directly.
# See @bazel_toolchains//rules:rbe_repo.bzl
# Set-up the environment

package(default_visibility = ["//visibility:public"])

java_runtime(
name = "jdk",
srcs = [],
java_home = "/usr/lib/jvm/java-8-openjdk-amd64",
)
# Call the C++ compiler
/usr/lib/llvm-8/bin/clang "$@"
53 changes: 53 additions & 0 deletions bazel/toolchains/configs/clang_libcxx/bazel_0.28.1/config/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright 2016 The Bazel Authors. All rights reserved.
#
# 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.

# This file is auto-generated by an rbe_autoconfig repository rule
# and should not be modified directly.
# See @bazel_toolchains//rules:rbe_repo.bzl

package(default_visibility = ["//visibility:public"])

toolchain(
name = "cc-toolchain",
exec_compatible_with = [
"@bazel_tools//platforms:x86_64",
"@bazel_tools//platforms:linux",
"@bazel_tools//tools/cpp:clang",
],
target_compatible_with = [
"@bazel_tools//platforms:linux",
"@bazel_tools//platforms:x86_64",
],
toolchain = "//bazel/toolchains/configs/clang_libcxx/bazel_0.28.1/cc:cc-compiler-k8",
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
)

platform(
name = "platform",
constraint_values = [
"@bazel_tools//platforms:x86_64",
"@bazel_tools//platforms:linux",
"@bazel_tools//tools/cpp:clang",
],
remote_execution_properties = """
properties: {
name: "container-image"
value:"docker://gcr.io/envoy-ci/envoy-build@sha256:555fb7b0aa578d11852b57c6c14fd54ab4450ad001a9f03bb5c43d5454460c28"
}
properties {
name: "OSFamily"
value: "Linux"
}
""",
)
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ cc_toolchain_config(
"cpp": "/usr/bin/cpp",
"gcc": "/usr/bin/gcc",
"dwp": "/usr/bin/dwp",
"gcov": "/usr/bin/gcov",
"gcov": "None",
"nm": "/usr/bin/nm",
"objcopy": "/usr/bin/objcopy",
"objdump": "/usr/bin/objdump",
Expand All @@ -116,7 +116,8 @@ cc_toolchain_config(
"-B/usr/bin",
"-pass-exit-codes",
"-lm",
"-static-libgcc"],
"-static-libgcc",
"-fuse-ld=lld"],
link_libs = ["-l:libstdc++.a"],
opt_link_flags = ["-Wl,--gc-sections"],
unfiltered_compile_flags = ["-fno-canonical-system-headers",
Expand Down
Loading