From 57903649ff72c16cf7f9b8b7c69c84849b38b03c Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Thu, 14 Mar 2024 15:10:19 +0800 Subject: [PATCH] simplify feature gate Signed-off-by: Bugen Zhao --- ci/scripts/release.sh | 1 - docker/Dockerfile | 2 -- src/meta/dashboard/build.rs | 8 +------- src/meta/dashboard/src/lib.rs | 15 +++++++++------ src/meta/src/dashboard/mod.rs | 2 +- 5 files changed, 11 insertions(+), 17 deletions(-) diff --git a/ci/scripts/release.sh b/ci/scripts/release.sh index 02dcff4266d2a..e35459b71495b 100755 --- a/ci/scripts/release.sh +++ b/ci/scripts/release.sh @@ -39,7 +39,6 @@ source "$HOME/.cargo/env" rustup show source ci/scripts/common.sh unset RUSTC_WRAPPER # disable sccache -export TODO_DISABLE_EMBEDDED_DASHBOARD=1 # TODO(bugen): remove this after the embedded dashboard is ready echo "--- Install protoc3" PROTOC_ARCH=${ARCH} diff --git a/docker/Dockerfile b/docker/Dockerfile index 0bb2691b65d16..ff6fbba8467e1 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -76,8 +76,6 @@ ENV GIT_SHA=$GIT_SHA COPY ./ /risingwave WORKDIR /risingwave -# TODO(bugen): remove this after the embedded dashboard is ready -ENV TODO_DISABLE_EMBEDDED_DASHBOARD=1 RUN cargo fetch && \ cargo build -p risingwave_cmd_all --release --features "rw-static-link" --features embedded-python-udf && \ mkdir -p /risingwave/bin && \ diff --git a/src/meta/dashboard/build.rs b/src/meta/dashboard/build.rs index caa743361f10e..5a18ba963adbc 100644 --- a/src/meta/dashboard/build.rs +++ b/src/meta/dashboard/build.rs @@ -61,13 +61,7 @@ fn build() -> anyhow::Result<()> { } fn main() -> anyhow::Result<()> { - rerun_if_changed!("build.rs"); - - let should_build = env_var_is_true("ENABLE_BUILD_DASHBOARD") // asked to build by RiseDev - || (std::env::var("PROFILE").unwrap() == "release" && !env_var_is_true("RISINGWAVE_CI")); // release build and not in CI - - // TODO(bugen): remove this after the embedded dashboard is ready - let should_build = should_build && !env_var_is_true("TODO_DISABLE_EMBEDDED_DASHBOARD"); + let should_build = env_var_is_true("ENABLE_BUILD_DASHBOARD"); if should_build { build()?; diff --git a/src/meta/dashboard/src/lib.rs b/src/meta/dashboard/src/lib.rs index a67a7dc2bd216..bb8a9ed5e90e7 100644 --- a/src/meta/dashboard/src/lib.rs +++ b/src/meta/dashboard/src/lib.rs @@ -24,13 +24,16 @@ mod proxy; /// Based on the configuration, it will either serve the assets embedded in the binary, /// or proxy all requests to the latest static files built and hosted on GitHub. /// -/// - For development and CI builds, the requests to the dashboard will be proxied. This -/// is to reduce the build time and eliminate the dependency on `node`, so that the -/// developer experience can be better. +/// - If env var `ENABLE_BUILD_DASHBOARD` is not set during the build, the requests to +/// the dashboard will be proxied. This is to reduce the build time and eliminate the +/// dependency on `node`, so that the developer experience can be better. This is the +/// default behavior for CI and development builds. /// -/// - For release builds, the assets will built in the build script and embedded in the -/// binary. This is to make the deployment easier and the dashboard more reliable -/// without relying on external or remote resources. +/// - If env var `ENABLE_BUILD_DASHBOARD` is set during the build, the assets will be +/// built in the build script and embedded in the binary. This is to make the +/// deployment easier and the dashboard more reliable without relying on external or +/// remote resources. This is the default behavior for versioned releases, and can be +/// manually enabled for development builds with RiseDev. /// /// If you're going to develop with the dashboard, see `dashboard/README.md` for more /// details. diff --git a/src/meta/src/dashboard/mod.rs b/src/meta/src/dashboard/mod.rs index 0eac865bb2d22..2e3848d329d22 100644 --- a/src/meta/src/dashboard/mod.rs +++ b/src/meta/src/dashboard/mod.rs @@ -412,7 +412,7 @@ impl DashboardService { let trace_ui_router = otlp_embedded::ui_app(srv.trace_state.clone(), "/trace/"); let dashboard_router = if let Some(ui_path) = ui_path { - // TODO(bugen): remove `ui_path` + // TODO(bugen): remove `ui_path` and all in the embedded `risingwave_meta_dashboard`. get_service(ServeDir::new(ui_path)) .handle_error(|e| async move { match e {} }) .boxed_clone()