Skip to content

Build with latest Bazel(upgrade Bazel from 0.5.4 to 0.21.0) #529

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

Merged
merged 40 commits into from
Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
baea6bb
Build with latest Bazel(upgrade Bazel from 0.5.4 to 0.21.0)
jiachenwang Feb 5, 2019
0b3b96c
change docker version for Jenkins
jiachenwang Feb 6, 2019
8f4f277
show bazel version in presubmit script
jiachenwang Feb 6, 2019
08abaaa
test if Jenkins picks up new config
jiachenwang Feb 7, 2019
2332032
test if Jenkins picks up new config
jiachenwang Feb 7, 2019
8c50860
test if Jenkins picks up new config
jiachenwang Feb 8, 2019
af6d2a6
test if Jenkins picks up new config
jiachenwang Feb 11, 2019
e3cc14c
test if Jenkins picks up new config
jiachenwang Feb 11, 2019
b7dd598
change BAZEL_BUILD_ARGS in Jenkinsfile
jiachenwang Feb 11, 2019
4304180
test bazel build args
jiachenwang Feb 11, 2019
b5f5fa3
add bazel build args in presubmit
jiachenwang Feb 13, 2019
30e22f0
test bazel build args
jiachenwang Feb 13, 2019
13b9a28
test if Jenkins picks up new config
jiachenwang Feb 13, 2019
0e8c7f5
add Bazel build flag to .bazelrc
jiachenwang Feb 13, 2019
28efabf
add Bazel fetch flag to .bazelrc
jiachenwang Feb 13, 2019
112c36d
test bazel build args
jiachenwang Feb 15, 2019
2b25282
test bazel build args
jiachenwang Feb 15, 2019
e8f1cc4
remove linux_amd64_stripped in src/nginx/t/ApiManager.pm
jiachenwang Feb 15, 2019
702ba5e
test bazel build args
jiachenwang Feb 15, 2019
f6fa9bc
test bazel build args
jiachenwang Feb 15, 2019
3b8f6b1
test bazel build args
jiachenwang Feb 15, 2019
22c1c25
change path for interop server and client in interop test
jiachenwang Feb 15, 2019
9b4b7d8
cleanup doc and script
jiachenwang Feb 15, 2019
046c3e3
update doc/testing.md
jiachenwang Feb 15, 2019
95d38ab
fix path of grpc interop server and client for e2e
jiachenwang Feb 15, 2019
003006e
fix path of grpc interop grpc_testing proto for e2e
jiachenwang Feb 15, 2019
234b694
fix Bazel genrule for grpc-interop_descriptor in e2e
jiachenwang Feb 15, 2019
b0dd33a
remove grpc-interop_descriptor genrule in test/grpc/BUILD
jiachenwang Feb 15, 2019
a181b3b
remove grpc-interop_descriptor in Jenkinsfile
jiachenwang Feb 16, 2019
9d41d95
fix e2e
jiachenwang Feb 16, 2019
9cb9272
fix grpc-interop_descriptor for e2e
jiachenwang Feb 16, 2019
06498f8
fix style
jiachenwang Feb 16, 2019
3b00f07
fix interop server, client path in Jenkinsfile for e2e
jiachenwang Feb 16, 2019
e39b83f
fix path of metrics_client and stress client for e2e
jiachenwang Feb 16, 2019
20551e0
cleanup script/robot-release
jiachenwang Feb 16, 2019
fbccda4
add GRPC_GO_LOG_SEVERITY_LEVEL for grpc metrics_client to print log
jiachenwang Feb 23, 2019
bcdd5c0
fix problem when setting GRPC_GO_LOG_SEVERITY_LEVEL in test-grpc-inte…
jiachenwang Feb 23, 2019
ac838a8
fix setting env var GRPC_GO_LOG_SEVERITY_LEVEL problem in test-grpc-i…
jiachenwang Feb 23, 2019
f541774
change grpc-go commit hash to reflect actual version
jiachenwang Feb 25, 2019
6e68051
add data of commit SHA for some libraries
jiachenwang Feb 26, 2019
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tools/bazel.rc → .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,11 @@ build --cxxopt -Wnon-virtual-dtor
build --cxxopt -Wformat
build --cxxopt -Wformat-security


fetch --incompatible_remove_native_git_repository=false
fetch --incompatible_remove_native_http_archive=false
fetch --incompatible_package_name_is_a_function=false

build --incompatible_remove_native_git_repository=false
build --incompatible_remove_native_http_archive=false
build --incompatible_package_name_is_a_function=false
11 changes: 5 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ SUCH DAMAGE.

import static java.util.UUID.randomUUID


// Supported Stages.
// ALL will run all stage but the one starting with '_'.
// By default all ALL stages will run.
Expand All @@ -53,7 +52,7 @@ SUPPORTED_STAGES = [
]

// Supported VM Images
SLAVE_IMAGE = 'gcr.io/endpoints-jenkins/debian-8:0.7'
SLAVE_IMAGE = 'gcr.io/endpoints-jenkins/debian-8:0.12'

// Release Qualification end to end tests.
// If RAPTURE_REPO build parameter is set only those test will run.
Expand Down Expand Up @@ -450,10 +449,10 @@ def buildPackages() {
def stashPaths = [
'bazel-bin/src/tools/auth_token_gen',
'bazel-bin/test/grpc/grpc-test-client',
'bazel-bin/test/grpc/interop-client',
'bazel-bin/external/org_golang_google_grpc/stress/metrics_client/metrics_client',
'bazel-bin/external/org_golang_google_grpc/interop/server/server',
'bazel-bin/external/org_golang_google_grpc/stress/client/client',
'bazel-bin/test/grpc/linux_amd64_stripped/interop-client',
Copy link
Contributor

Choose a reason for hiding this comment

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

if --config=asan or debug,the file name will without linux_amd64_stripped. do we need to stash or save them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Jenkins stores Release version binary to GCS bucket for e2e testing, so we do not neet stash asan or debug one.

'bazel-bin/external/org_golang_google_grpc/stress/metrics_client/linux_amd64_stripped/metrics_client',
'bazel-bin/external/org_golang_google_grpc/interop/server/linux_amd64_stripped/server',
'bazel-bin/external/org_golang_google_grpc/stress/client/linux_amd64_stripped/client',
'bazel-genfiles/test/grpc/grpc-test.descriptor',
'bazel-genfiles/test/grpc/grpc-interop.descriptor',
]
Expand Down
19 changes: 15 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ load(
"//:repositories.bzl",
"googletest_repositories",
#"grpc_repositories",
"go_grpc_repositories",
"protobuf_repositories",
"servicecontrol_client_repositories",
"transcoding_repositories",
Expand Down Expand Up @@ -146,6 +147,8 @@ bind(

servicecontrol_client_repositories()

go_grpc_repositories()

protobuf_repositories()

googletest_repositories()
Expand All @@ -168,7 +171,7 @@ bind(
#
git_repository(
name = "io_bazel_rules_pex",
commit = "6af30588d4f11cafcb744c50935cc37f029e6e7f",
commit = "0c5773db01ab8aeb3ae749b2fc570749b93af41f", # Jul 22, 2018
remote = "https://github.com/benley/bazel_rules_pex.git",
)

Expand All @@ -191,13 +194,21 @@ git_repository(
#
git_repository(
name = "io_bazel_rules_go",
commit = "2d9f328a9723baf2d037ba9db28d9d0e30683938", # Apr 6, 2017 (buildifier fix)
commit = "2d792dea8d22c552f455623bb15eb4f61fcb2f1b", # Dec 15, 2018 (v0.16.5)
remote = "https://github.com/bazelbuild/rules_go.git",
)

load("@io_bazel_rules_go//go:def.bzl", "go_repositories", "go_repository", "new_go_repository")
http_archive(
name = "bazel_gazelle",
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.16.0/bazel-gazelle-0.16.0.tar.gz"],
sha256 = "7949fc6cc17b5b191103e97481cf8889217263acf52e00b560683413af204fcb", # Jan 9, 2019 (v0.16.0)
)

go_repositories()
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()
go_register_toolchains()
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
gazelle_dependencies()

new_git_repository(
name = "github_com_golang_protobuf",
Expand Down
4 changes: 2 additions & 2 deletions doc/build-esp-on-ubuntu-16-04.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Install the following software packages:

ESP is built using the [bazel](http://bazel.io) build tool.
Follow the bazel [install instructions](https://docs.bazel.build/versions/master/install-ubuntu.html#install-using-binary-installer) to install bazel.
ESP currently requires bazel 0.5.4. For bazel 0.5.4 on Ubuntu,
the binary installer is bazel-0.5.4-installer-linux-x86_64.sh.
ESP currently requires bazel 0.21.0. For bazel 0.21.0 on Ubuntu,
the binary installer is bazel-0.21.0-installer-linux-x86_64.sh.

*Note:* Bazel is under active development and from time to time, ESP continuous
integration systems are upgraded to a new version of Bazel.
Expand Down
2 changes: 1 addition & 1 deletion doc/testing.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Testing ESP with Bazel #

ESP is built using [Bazel](http://bazel.io) build tool. Install
[Bazel](http://bazel.io) version 0.5.4, following the [Bazel
[Bazel](http://bazel.io) version 0.21.0, following the [Bazel
documentation](http://bazel.io/docs/install.html).

# Building ESP #
Expand Down
4 changes: 2 additions & 2 deletions doc/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ On Linux, install:
## Bazel ##

ESP is built using [Bazel](http://bazel.io) build tool. Install
[Bazel](http://bazel.io) version 0.5.4, following the [Bazel
[Bazel](http://bazel.io) version 0.21.0, following the [Bazel
documentation](http://bazel.io/docs/install.html).

*Note:* Bazel is under active development and from time to time, ESP continuous
integration systems are upgraded to a new version of Bazel. Currently, ESP
requires Bazel 0.5.4.
requires Bazel 0.21.0.

The version of Bazel used by ESP continuous integration systems can be found in
the [linux-install-software](/script/linux-install-software)
Expand Down
2 changes: 1 addition & 1 deletion jenkins/slaves/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PROJECT = endpoints-jenkins
VERSION = 0.7
VERSION = 0.12
TOOLS_BUCKET = endpoints-tools

# Note: The build directory is the root of the istio/test-infra repository, not ./
Expand Down
36 changes: 36 additions & 0 deletions repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,42 @@ genrule(
actual = "@cares_git//:ares",
)

def go_grpc_repositories(bind = True):
BUILD = """
# Copyright (C) Extensible Service Proxy 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.
#
################################################################################
#
filegroup(
name = "test_proto",
srcs = ["interop/grpc_testing/test.proto"],
visibility = ["//visibility:public"],
)
"""
native.new_git_repository(
name = "org_golang_google_grpc_git",
commit = "9bf8ea0a8282ebecd1aa474c926e3028f5c22a4c", # May 19, 2017
remote = "https://github.com/grpc/grpc-go.git",
build_file_content = BUILD,
)

if bind:
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems this bind is not used. when it is binded, instead of depends on "@org_golang_google_grpc_git//:test_proto", you can depend on "//external:test_proto"

I saw the BUILD file use @org_golang_google_grpc_git//:test_proto directly. so bind is not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack. Other parts in this file uses bind = True. I would like to leave it to be consistent.

native.bind(
name = "test_proto",
actual = "@org_golang_google_grpc_git//:test_proto")

def protobuf_repositories(bind = True):
native.git_repository(
name = "protobuf_git",
Expand Down
6 changes: 3 additions & 3 deletions script/presubmits
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ function build_and_test() {
fi
echo "${message}..."
retry -n 3 ${BAZEL} ${BAZEL_ARGS} fetch \
//src/... //tools/src/... //third_party:all //start_esp/test/... \
//src/... //third_party:all //start_esp/test/... \
&& retry -n 2 ${BAZEL} ${BAZEL_ARGS} build \
${BAZEL_BUILD_ARGS} ${config_flag} \
//src/... //tools/src/... //third_party:all //start_esp/test/... \
//src/... //third_party:all //start_esp/test/... \
&& ${BAZEL} ${BAZEL_ARGS} test --test_output=errors ${config_flag} \
//src/... //tools/src/... //third_party:all //start_esp/test/... \
//src/... //third_party:all //start_esp/test/... \
|| { echo "${error}..."; return 1; }
}

Expand Down
10 changes: 6 additions & 4 deletions script/test-grpc-interop
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ done
HOST_IP=${HOST%:*}
HOST_PORT=${HOST#*:}
echo "HOST_IP: ${HOST_IP}, HOST_PORT: ${HOST_PORT}"
retry $ROOT/bazel-bin/test/grpc/interop-client --server_port "${HOST_PORT}" \
retry $ROOT/bazel-bin/test/grpc/linux_amd64_stripped/interop-client --server_port "${HOST_PORT}" \
--server_host "${HOST_IP}" \
|| error_exit 'Failed to send one request, the proxy did not start properly.'

Expand All @@ -72,7 +72,7 @@ echo "Test during is: $((DURATION_IN_SEC / 60)) minutes."
echo "Test cases are: ${TEST_CASES}"

# Start a background test client job.
$ROOT/bazel-bin/external/org_golang_google_grpc/stress/client/client \
$ROOT/bazel-bin/external/org_golang_google_grpc/stress/client/linux_amd64_stripped/client \
--server_addresses "${HOST}" \
--num_channels_per_server 200 \
--num_stubs_per_channel 1 \
Expand All @@ -84,6 +84,7 @@ START_TIME=$(date +"%s")
END_TIME=$((START_TIME + DURATION_IN_SEC))
RUN_COUNT=0
FAIL_COUNT=0
export GRPC_GO_LOG_SEVERITY_LEVEL=INFO

detect_memory_leak_init "http://${HOST}"

Expand All @@ -92,8 +93,8 @@ while true; do
((RUN_COUNT++))

sleep 10
METRIC_RESULT=$("$ROOT/bazel-bin/external/org_golang_google_grpc/stress/metrics_client/metrics_client" \
--total_only --metrics_server_address=localhost:8081 2>&1)
METRIC_RESULT=$("$ROOT/bazel-bin/external/org_golang_google_grpc/stress/metrics_client/linux_amd64_stripped/metrics_client" \
--total_only --metrics_server_address=localhost:8081 2>&1 | tail -1)
QPS=$(echo ${METRIC_RESULT}|awk '{print $NF}')
echo "Metric report at $((CURR_TIME - START_TIME)) seconds: ${QPS} qps"
# Count non zero QPS as success.
Expand All @@ -114,4 +115,5 @@ fi
# We fail the test if memory increase is large.
detect_memory_leak_final && MEMORY_LEAK=0 || MEMORY_LEAK=1

unset GRPC_GO_LOG_SEVERITY_LEVEL
exit $((${RESULT} + ${MEMORY_LEAK}))
2 changes: 1 addition & 1 deletion script/tools/linux-install-bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fi
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
. ${DIR}/all-utilities || { echo "Cannot load Bash utilities" ; exit 1 ; }

BAZEL_VERSION='0.5.4'
BAZEL_VERSION='0.21.0'
BAZEL_BASE_URL='https://github.com/bazelbuild/bazel/releases/download'
BAZEL_SH="bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh"
BAZEL_URL="${BAZEL_BASE_URL}/${BAZEL_VERSION}/${BAZEL_SH}"
Expand Down
2 changes: 1 addition & 1 deletion script/travis/install
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
##################################################

# Download (update the URL when upgrading Bazel)
BAZEL_INSTALLER_URL='https://github.com/bazelbuild/bazel/releases/download/0.5.4/bazel-0.5.4-installer-linux-x86_64.sh'
BAZEL_INSTALLER_URL='https://github.com/bazelbuild/bazel/releases/download/0.21.0/bazel-0.21.0-installer-linux-x86_64.sh'
curl -L "${BAZEL_INSTALLER_URL}" -o ./bazel-installer.sh || \
error_exit "Failed to get the bazel installer from ${BAZEL_INSTALLER_URL}"
chmod +x ./bazel-installer.sh
Expand Down
10 changes: 8 additions & 2 deletions src/nginx/t/ApiManager.pm
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,10 @@ sub grpc_test_server {

sub grpc_interop_server {
my ($t, $port) = @_;
my $server = './external/org_golang_google_grpc/interop/server/server';
my $server = './external/org_golang_google_grpc/interop/server/linux_amd64_stripped/server';
unless (-e $server) {
$server = './external/org_golang_google_grpc/interop/server/linux_amd64/server';
}
exec $server, "--port", $port;
}

Expand Down Expand Up @@ -373,7 +376,10 @@ sub run_grpc_test {
sub run_grpc_interop_test {
my ($t, $port, $test_case, @args) = @_;
my $testdir = $t->testdir();
my $client = './test/grpc/interop-client';
my $client = './test/grpc/linux_amd64_stripped/interop-client';
unless (-e $client) {
$client = './test/grpc/linux_amd64/interop-client';
}
return system "$client --server_port $port --test_case $test_case " . join(' ', @args)
}

Expand Down
2 changes: 1 addition & 1 deletion src/nginx/t/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
################################################################################
#
load("@io_bazel_rules_perl//perl:perl.bzl", "perl_library")
load("/nginx", "nginx_test", "nginx_suite")
load("//:nginx.bzl", "nginx_test", "nginx_suite")

perl_library(
name = "perl_library",
Expand Down
6 changes: 3 additions & 3 deletions src/nginx/t/grpc_web_interop_unary.t
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ Content-Length: 8
\x00\x00\x00\x00\x02\x10\x0a});

is(ApiManager::http_response_body($response),
"\x00\x00\x00\x00\x10".
"\x0a\x0e\x08\x00".
"\x12\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x007grpc-status: 0\x0d\x0a".
"\x00\x00\x00\x00\x0e\x0a".
"\x0c\x12\x0a".
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x007grpc-status: 0\x0d\x0a".
"x-grpc-test-echo-trailing-bin: abcdeQ\x0d\x0a",
'UnaryCall returns OK.');

Expand Down
2 changes: 1 addition & 1 deletion src/nginx/t/grpc_web_interop_unary_large.t
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Content-Length: 10

\x00\x00\x00\x00\x04\x10\x80\x80\x40});

is(length(ApiManager::http_response_body($response)), 1048612, 'UnaryCall returns OK.');
is(length(ApiManager::http_response_body($response)), 1048610, 'UnaryCall returns OK.');

$t->stop_daemons();

Expand Down
10 changes: 4 additions & 6 deletions test/grpc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ genrule(
name = "grpc-interop_descriptor",
srcs = [
"@protobuf_git//:well_known_protos",
"@org_golang_google_grpc//interop/grpc_testing:go_default_library_protos",
"@org_golang_google_grpc_git//:test_proto"
],
outs = ["grpc-interop.descriptor"],
cmd = """$(location //external:protoc) \
$(location @org_golang_google_grpc//interop/grpc_testing:go_default_library_protos) \
-I$$(dirname $(location @org_golang_google_grpc//interop/grpc_testing:go_default_library_protos)) \
$(location @org_golang_google_grpc_git//:test_proto) \
-I$$(dirname $(location @org_golang_google_grpc_git//:test_proto)) \
-Iexternal/protobuf_git/src \
--include_imports --descriptor_set_out=$@""",
tools = ["//external:protoc"],
Expand Down Expand Up @@ -130,18 +130,16 @@ cc_binary(

load(
"@io_bazel_rules_go//go:def.bzl",
"go_prefix",
"go_binary",
)

go_prefix("github.com/cloudendpoints/esp/test/grpc")

go_binary(
name = "interop-client",
srcs = [
"interop-client.go",
],
go_prefix = ":go_prefix",
importpath = "github.com/cloudendpoints/esp/test/grpc",
deps = [
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//credentials:go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion test/grpc/linux-build-grpc-docker
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ while getopts :i:o arg; do
i) IMAGE="${OPTARG}";;
o)
TEST_SERVER_TARGET='@org_golang_google_grpc//interop/server'
TEST_SERVER_BIN='external/org_golang_google_grpc/interop/server/server'
TEST_SERVER_BIN='external/org_golang_google_grpc/interop/server/linux_amd64_stripped/server'
TEST_SERVER_ARGS='--port=8081'
;;
*) error_exit "Unrecognized argument -${OPTARG}";;
Expand Down
Loading