Skip to content

Commit c81ec6a

Browse files
authored
Update setup_clang_toolchain and requirements (#1476)
One half of the local build/test issue reported by other maintainers. - fixes _ci.yml to _append_ additional bazel build arguments rather than override the CI defaults. If it's running from _ci.yml, we always want those defaults. - sets toplevel download option using current .bazelrc names for the release task. - adds `--config=clang` to build and test Bazel execution options when setup_clang_toolchain is invoked in do_ci.sh. This worked on remote execution because remote execution included e.g. `config=docker-clang` which itself sets `config=clang` separately. - adds `fix_requirements` to do_ci.sh - the requirements update step also uses Bazel and should be using the same Bazel configuration options we're applying for build and test (specifically, updating requirements is otherwise broken because running the bazel command directly omits `export CARGO_BAZEL_REPIN=true` and breaks on a hash mismatch in the lockfile) - adds `fix_docs` to the do_ci.sh commands as docs, too, relies on Bazel building to re-generate. - regenerates docs and requirements using new utilities - updates the maintainer guide to point towards the do_ci.sh utilities instead of invoking the Bazel commands directly. - deletes the obsolesced separate docs utility script. - updates nighthawk_envoy_updater to use `fix_requirements` and `fix_docs` and adds a missing comma from the copied files list. - also removes a chunk in .bazelrc that was previously submitted by mistake! Signed-off-by: Elizabeth Byerly <ebyerly@google.com>
1 parent 4120535 commit c81ec6a

8 files changed

Lines changed: 282 additions & 241 deletions

File tree

.bazelrc

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This is necessary since this needs to be available before we can access # unique
33
# the Envoy repository contents via Bazel. # unique
44
# unique
5-
build:asan --test_timeout=4800 # unique
5+
build:asan --test_timeout=4800 # unique
66
build:tsan --test_timeout=4800 # unique
77
build:test_gcc --test_timeout=4800 # unique
88
# See https://github.com/envoyproxy/nighthawk/issues/405 # unique
@@ -13,17 +13,7 @@ build:macos --copt -UDEBUG
1313
test:stress --//test/config:run_stress_tests=True # unique
1414
# unique
1515
# CI configuration # unique
16-
build:remote-ci-download --config=ci # unique
17-
build:remote-ci-download --remote_download_toplevel # unique
18-
19-
# DO NOT SUBMIT -->
20-
# Explicitly set the --host_action_env for clang build since we are not building # unique
21-
# rbe-toolchain-clang that Envoy builds. # unique
22-
# This value is the same for different VMs, thus cache hits can be shared among machines. # unique
23-
build --host_action_env=PATH=/usr/sbin:/usr/bin:/opt/llvm/bin # unique
24-
# To make our own CI green, we do need that flag on Windows though.
25-
build:windows --action_env=PATH --host_action_env=PATH
26-
# <--
16+
build:download-toplevel --remote_download_outputs=toplevel # unique
2717

2818
#############################################################################
2919
# startup

.github/workflows/_ci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ on:
1313
description: "Extra bazel args"
1414
required: false
1515
type: string
16-
default: >-
17-
--config=remote-ci
18-
--config=rbe
1916
docker-in-docker:
2017
description: "Enable Docker in Docker"
2118
required: false
@@ -65,6 +62,8 @@ jobs:
6562
env:
6663
GITHUB_TOKEN: ${{ github.token }}
6764
BAZEL_BUILD_EXTRA_OPTIONS: >-
65+
--config=remote-ci
66+
--config=rbe
6867
${{ inputs.bazel-extra }}
6968
GH_BRANCH: ${{ github.ref }}
7069
GH_SHA1: ${{ github.sha }}

.github/workflows/nighthawk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,5 @@ jobs:
6565
with:
6666
task: docker
6767
bazel-extra: >-
68-
--config=remote-ci-download
68+
--config=download-toplevel
6969
docker-in-docker: true

ci/do_ci.sh

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function maybe_copy_binaries_to_directory () {
9090
#######################################
9191
function do_build () {
9292
bazel build $BAZEL_BUILD_OPTIONS //:nighthawk
93-
tools/update_cli_readme_documentation.sh --mode check
93+
do_fix_docs
9494
maybe_copy_binaries_to_directory
9595
}
9696

@@ -183,6 +183,8 @@ function setup_clang_toolchain() {
183183
export CXX=clang++
184184
export ASAN_SYMBOLIZER_PATH=/opt/llvm/bin/llvm-symbolizer
185185
export BAZEL_COMPILER=clang
186+
BAZEL_BUILD_OPTIONS="$BAZEL_BUILD_OPTIONS --config=clang"
187+
BAZEL_TEST_OPTIONS="$BAZEL_TEST_OPTIONS --config=clang"
186188
echo "$CC/$CXX toolchain configured"
187189
}
188190

@@ -286,6 +288,23 @@ function do_fix_format() {
286288
./tools/format_python_tools.sh fix
287289
}
288290

291+
function do_fix_requirements() {
292+
echo "fix_requirements..."
293+
cd "${SRCDIR}"
294+
# Wipe the requirements file to prevent caching.
295+
echo "" > tools/base/requirements.txt
296+
bazel run //tools/base:requirements.update
297+
}
298+
299+
function do_fix_docs() {
300+
echo "fix_docs..."
301+
cd "${SRCDIR}"
302+
bazel run $BAZEL_BUILD_OPTIONS //tools:update_cli_readme_documentation -- --binary bazel-bin/nighthawk_client --readme README.md --mode=fix
303+
bazel run $BAZEL_BUILD_OPTIONS //tools:update_cli_readme_documentation -- --binary bazel-bin/nighthawk_service --readme README.md --mode=fix
304+
bazel run $BAZEL_BUILD_OPTIONS //tools:update_cli_readme_documentation -- --binary bazel-bin/nighthawk_output_transform --readme README.md --mode=fix
305+
bazel run $BAZEL_BUILD_OPTIONS //tools:update_cli_readme_documentation -- --binary bazel-bin/nighthawk_test_server --readme source/server/README.md --mode=fix
306+
}
307+
289308
if grep 'docker\|lxc' /proc/1/cgroup; then
290309
export BUILD_DIR=/build
291310
echo "Running in Docker, built binaries will be copied into ${BUILD_DIR}."
@@ -368,6 +387,16 @@ case "$1" in
368387
do_fix_format
369388
exit 0
370389
;;
390+
fix_requirements)
391+
setup_clang_toolchain
392+
do_fix_requirements
393+
exit 0
394+
;;
395+
fix_docs)
396+
setup_clang_toolchain
397+
do_fix_docs
398+
exit 0
399+
;;
371400
benchmark_with_own_binaries)
372401
setup_clang_toolchain
373402
do_benchmark_with_own_binaries
@@ -384,7 +413,7 @@ case "$1" in
384413
exit 0
385414
;;
386415
*)
387-
echo "must be one of [opt_build,build,test,clang_tidy,coverage,coverage_integration,asan,tsan,benchmark_with_own_binaries,docker,check_format,fix_format,test_gcc]"
416+
echo "must be one of [opt_build,build,test,clang_tidy,coverage,coverage_integration,asan,tsan,benchmark_with_own_binaries,docker,check_format,fix_format,fix_requirements,fix_docs,test_gcc]"
388417
exit 1
389418
;;
390419
esac

docs/root/updating_envoy_dependency.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ These should always be accompanied with a comment explaining them. Avoid using
280280
Update the dependencies by running:
281281

282282
```bash
283-
bazel run //tools/base:requirements.update
283+
ci/do_ci.sh fix_requirements
284284
```
285285

286286
This will use the configuration from
@@ -342,7 +342,7 @@ and retrying the format command.
342342
If Nighthawk command line flags have been changed, execute:
343343

344344
```bash
345-
tools/update_cli_readme_documentation.sh --mode fix
345+
ci/do_ci.sh fix_docs
346346
```
347347

348348
to regenerate the

0 commit comments

Comments
 (0)