From 27d47c05c4cc628bbafa868d7981660ad85eb087 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Tue, 12 Apr 2022 14:43:15 +0200 Subject: [PATCH] Build: Run `npm run dev` on development build --- build_scripts/appimage/appimage.sh | 3 ++- build_scripts/build_package.sh | 7 ++++++- build_scripts/common.sh | 9 ++++++++- build_scripts/docker/docker.sh | 3 ++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/build_scripts/appimage/appimage.sh b/build_scripts/appimage/appimage.sh index e7064f0cc..e81291dd0 100755 --- a/build_scripts/appimage/appimage.sh +++ b/build_scripts/appimage/appimage.sh @@ -28,6 +28,7 @@ setup_build_dir() { local agent_binary_dir=$1 local monkey_repo=$2 local deployment_type=$3 + local is_release_build=$4 pushd $APPIMAGE_DIR @@ -44,7 +45,7 @@ setup_build_dir() { install_mongodb generate_ssl_cert "$BUILD_DIR" - build_frontend "$BUILD_DIR" + build_frontend "$BUILD_DIR" "$is_release_build" remove_python_appdir_artifacts diff --git a/build_scripts/build_package.sh b/build_scripts/build_package.sh index aee36de6a..88f24b4fc 100755 --- a/build_scripts/build_package.sh +++ b/build_scripts/build_package.sh @@ -196,8 +196,13 @@ fi install_build_prereqs install_package_specific_build_prereqs "$WORKSPACE" +is_release_build=false +# Monkey version is empty on release build +if [ ! -z "$monkey_version" ]; then + is_release_build=true +fi -setup_build_dir "$agent_binary_dir" "$monkey_repo" "$deployment_type" +setup_build_dir "$agent_binary_dir" "$monkey_repo" "$deployment_type" "$is_release_build" commit_id=$(get_commit_id "$monkey_repo") build_package "$monkey_version" "$commit_id" "$DIST_DIR" diff --git a/build_scripts/common.sh b/build_scripts/common.sh index abeef5f0d..7c222b8a5 100644 --- a/build_scripts/common.sh +++ b/build_scripts/common.sh @@ -74,11 +74,18 @@ generate_ssl_cert() { build_frontend() { local ui_dir="$1/monkey_island/cc/ui" + local is_release_build=$2 pushd "$ui_dir" || handle_error log_message "Generating front end" npm ci - npm run dist + if [ "$is_release_build" == true ]; then + log_message "Running production front end build" + npm run dist + else + log_message "Running development front end build" + npm run dev + fi popd || handle_error diff --git a/build_scripts/docker/docker.sh b/build_scripts/docker/docker.sh index 42004f8f7..e0bd31b5d 100755 --- a/build_scripts/docker/docker.sh +++ b/build_scripts/docker/docker.sh @@ -9,6 +9,7 @@ install_package_specific_build_prereqs() { setup_build_dir() { local agent_binary_dir=$1 local monkey_repo=$2 + local is_release_build=$4 local build_dir=$DOCKER_DIR/monkey mkdir "$build_dir" @@ -22,7 +23,7 @@ setup_build_dir() { generate_ssl_cert "$build_dir" - build_frontend "$build_dir" + build_frontend "$build_dir" "$is_release_build" } copy_entrypoint_to_build_dir() {