From 96572dbdc287e0cb6cf21ac24269078d0d31d2b6 Mon Sep 17 00:00:00 2001 From: Lucas Martinez <57833320+martinezlucas98@users.noreply.github.com> Date: Tue, 21 Jun 2022 16:48:36 -0400 Subject: [PATCH 1/5] docs: add example for running Envoy via CLI Basic example on how to run Envoy from the CLI. Signed-off-by: Lucas Martinez <57833320+martinezlucas98@users.noreply.github.com> --- bazel/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bazel/README.md b/bazel/README.md index b738506df15b..1470613815c9 100644 --- a/bazel/README.md +++ b/bazel/README.md @@ -270,6 +270,16 @@ for how to update or override dependencies. 1. `bazel build envoy` from the Envoy source directory. Add `-c opt` for an optimized release build or `-c dbg` for an unoptimized, fully instrumented debugging build. +## Running Envoy via CLI + +After Envoy is built, it can be executed via CLI. + +For example, if Envoy was built using the `bazel build -c opt //source/exe:envoy-static` command, then it can be executed from the project's root directory by running: + +``` +bazel-bin/source/exe/envoy-static --config-path /path/to/your/envoy/config.yaml +``` + ## Building Envoy with the CI Docker image Envoy can also be built with the Docker image used for CI, by installing Docker and executing the following. From 3e29f97830a16790bab1f3f2262f4aa595f3869f Mon Sep 17 00:00:00 2001 From: Lucas Martinez <57833320+martinezlucas98@users.noreply.github.com> Date: Wed, 22 Jun 2022 14:39:38 -0400 Subject: [PATCH 2/5] Apply suggestions from code review Apply @phlax suggestions from code review Signed-off-by: Lucas Martinez <57833320+martinezlucas98@users.noreply.github.com> Co-authored-by: phlax --- bazel/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bazel/README.md b/bazel/README.md index 1470613815c9..0f84067d5d0d 100644 --- a/bazel/README.md +++ b/bazel/README.md @@ -270,13 +270,13 @@ for how to update or override dependencies. 1. `bazel build envoy` from the Envoy source directory. Add `-c opt` for an optimized release build or `-c dbg` for an unoptimized, fully instrumented debugging build. -## Running Envoy via CLI +## Running the built Envoy binary on the host system After Envoy is built, it can be executed via CLI. For example, if Envoy was built using the `bazel build -c opt //source/exe:envoy-static` command, then it can be executed from the project's root directory by running: -``` +```console bazel-bin/source/exe/envoy-static --config-path /path/to/your/envoy/config.yaml ``` From 0093ede3d44125cac18819408e58ce5ca8298426 Mon Sep 17 00:00:00 2001 From: Lucas Martinez <57833320+martinezlucas98@users.noreply.github.com> Date: Fri, 1 Jul 2022 11:28:05 -0400 Subject: [PATCH 3/5] docs: Update "Running the built Envoy binary on the host system" console command Resolves Bazel's output path issues as stated in #21811 by @daixiang0 and @phlax Signed-off-by: Lucas Martinez <57833320+martinezlucas98@users.noreply.github.com> --- bazel/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bazel/README.md b/bazel/README.md index 0f84067d5d0d..5fd2940a1ca3 100644 --- a/bazel/README.md +++ b/bazel/README.md @@ -272,12 +272,14 @@ for how to update or override dependencies. ## Running the built Envoy binary on the host system -After Envoy is built, it can be executed via CLI. +After Envoy is built, it can be executed via CLI. + +As Bazel's current ability to provide information about where it just built the artifacts is limited (as stated in [bazel's issue #8739](https://github.com/bazelbuild/bazel/issues/8739)), we can use the `bazel info bazel-genfiles` command to get the path where Envoy was built. For example, if Envoy was built using the `bazel build -c opt //source/exe:envoy-static` command, then it can be executed from the project's root directory by running: ```console -bazel-bin/source/exe/envoy-static --config-path /path/to/your/envoy/config.yaml +$(bazel info bazel-genfiles)/source/exe/envoy-static --config-path /path/to/your/envoy/config.yaml ``` ## Building Envoy with the CI Docker image From 8c8182ca41b9e127ad89fd9a7eb437aff6f40d18 Mon Sep 17 00:00:00 2001 From: Lucas Martinez <57833320+martinezlucas98@users.noreply.github.com> Date: Fri, 1 Jul 2022 12:38:37 -0400 Subject: [PATCH 4/5] docs: Update "Running the built Envoy binary on the host system" Information about bazel's command `bazel info bazel-genfiles` seems unnecessary in this section. Signed-off-by: Lucas Martinez <57833320+martinezlucas98@users.noreply.github.com> --- bazel/README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bazel/README.md b/bazel/README.md index 5fd2940a1ca3..1f3b179a93c8 100644 --- a/bazel/README.md +++ b/bazel/README.md @@ -272,9 +272,7 @@ for how to update or override dependencies. ## Running the built Envoy binary on the host system -After Envoy is built, it can be executed via CLI. - -As Bazel's current ability to provide information about where it just built the artifacts is limited (as stated in [bazel's issue #8739](https://github.com/bazelbuild/bazel/issues/8739)), we can use the `bazel info bazel-genfiles` command to get the path where Envoy was built. +After Envoy is built, it can be executed via CLI. For example, if Envoy was built using the `bazel build -c opt //source/exe:envoy-static` command, then it can be executed from the project's root directory by running: From 14b37b986508e81cc28e607be8710396960fed53 Mon Sep 17 00:00:00 2001 From: Lucas Martinez <57833320+martinezlucas98@users.noreply.github.com> Date: Fri, 1 Jul 2022 13:11:17 -0400 Subject: [PATCH 5/5] Move "Running the built Envoy binary..." section above "Testing Envoy with Bazel" Signed-off-by: Lucas Martinez <57833320+martinezlucas98@users.noreply.github.com> --- bazel/README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bazel/README.md b/bazel/README.md index 1f3b179a93c8..6f5fb80370c9 100644 --- a/bazel/README.md +++ b/bazel/README.md @@ -270,16 +270,6 @@ for how to update or override dependencies. 1. `bazel build envoy` from the Envoy source directory. Add `-c opt` for an optimized release build or `-c dbg` for an unoptimized, fully instrumented debugging build. -## Running the built Envoy binary on the host system - -After Envoy is built, it can be executed via CLI. - -For example, if Envoy was built using the `bazel build -c opt //source/exe:envoy-static` command, then it can be executed from the project's root directory by running: - -```console -$(bazel info bazel-genfiles)/source/exe/envoy-static --config-path /path/to/your/envoy/config.yaml -``` - ## Building Envoy with the CI Docker image Envoy can also be built with the Docker image used for CI, by installing Docker and executing the following. @@ -380,6 +370,16 @@ target from [`cc_binary`](https://docs.bazel.build/versions/master/be/c-cpp.html or pass [`--strip=always`](https://docs.bazel.build/versions/master/command-line-reference.html#flag--strip) instead. +# Running the built Envoy binary on the host system + +After Envoy is built, it can be executed via CLI. + +For example, if Envoy was built using the `bazel build -c opt //source/exe:envoy-static` command, then it can be executed from the project's root directory by running: + +```console +$(bazel info bazel-genfiles)/source/exe/envoy-static --config-path /path/to/your/envoy/config.yaml +``` + # Testing Envoy with Bazel All the Envoy tests can be built and run with: