This is an automated email from the ASF dual-hosted git repository. shuber pushed a commit to branch unomi-3-dev in repository https://gitbox.apache.org/repos/asf/unomi.git
commit c747986d1587fd17c2b9b4d1d20f039aefb73a82 Author: Serge Huber <[email protected]> AuthorDate: Mon Jan 5 17:53:27 2026 +0100 UNOMI-919 Integrate new Unomi distributions with build shell script --- build.sh | 41 +++++++++++++++++++- .../src/main/asciidoc/building-and-deploying.adoc | 44 +++++++++++++++++++++- 2 files changed, 82 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 42c3d432e..0cfdc7df3 100755 --- a/build.sh +++ b/build.sh @@ -254,6 +254,7 @@ KARAF_DEBUG_SUSPEND=n USE_OPENSEARCH=false NO_KARAF=false AUTO_START="" +UNOMI_DISTRIBUTION="" SINGLE_TEST="" IT_DEBUG=false IT_DEBUG_PORT=5006 @@ -292,6 +293,7 @@ EOF echo -e " ${CYAN}--purge-maven-cache${NC} Purge local Maven cache before building" echo -e " ${CYAN}--karaf-home PATH${NC} Set Karaf home directory for deployment" echo -e " ${CYAN}--use-opensearch${NC} Use OpenSearch instead of ElasticSearch" + echo -e " ${CYAN}--distribution DIST${NC} Set Unomi distribution (e.g., unomi-distribution-opensearch)" echo -e " ${CYAN}--no-karaf${NC} Build without starting Karaf" echo -e " ${CYAN}--auto-start ENGINE${NC} Auto-start with specified engine" echo -e " ${CYAN}--single-test TEST${NC} Run a single integration test" @@ -327,6 +329,7 @@ EOF echo " --purge-maven-cache Purge local Maven cache before building" echo " --karaf-home PATH Set Karaf home directory for deployment" echo " --use-opensearch Use OpenSearch instead of ElasticSearch" + echo " --distribution DIST Set Unomi distribution (e.g., unomi-distribution-opensearch)" echo " --no-karaf Build without starting Karaf" echo " --auto-start ENGINE Auto-start with specified engine" echo " --single-test TEST Run a single integration test" @@ -415,6 +418,10 @@ while [ "$1" != "" ]; do --use-opensearch) USE_OPENSEARCH=true ;; + --distribution) + shift + UNOMI_DISTRIBUTION="$1" + ;; --no-karaf) NO_KARAF=true ;; @@ -454,6 +461,17 @@ while [ "$1" != "" ]; do shift done +# Wire distribution and use-opensearch parameters +# If --use-opensearch is set, automatically set distribution to opensearch if not already set +if [ "$USE_OPENSEARCH" = true ] && [ -z "$UNOMI_DISTRIBUTION" ]; then + UNOMI_DISTRIBUTION="unomi-distribution-opensearch" +fi + +# If distribution contains "opensearch", automatically enable USE_OPENSEARCH for integration tests +if [ ! -z "$UNOMI_DISTRIBUTION" ] && [[ "$UNOMI_DISTRIBUTION" == *opensearch* ]]; then + USE_OPENSEARCH=true +fi + # Set environment DIRNAME=`dirname "$0"` PROGNAME=`basename "$0"` @@ -932,6 +950,12 @@ check_integration_test_env_vars() { fi } +# Add unomi.distribution system property if set +if [ ! -z "$UNOMI_DISTRIBUTION" ]; then + MVN_OPTS="$MVN_OPTS -Dunomi.distribution=$UNOMI_DISTRIBUTION" + echo "Using Unomi distribution: $UNOMI_DISTRIBUTION" +fi + # Add profile options PROFILES="" if [ "$RUN_INTEGRATION_TESTS" = true ]; then @@ -1235,12 +1259,27 @@ EOF exit 1 fi + # Build KARAF_OPTS with auto-start and distribution + KARAF_OPTS_ARGS="" if [ ! -z "$AUTO_START" ]; then print_status "info" "Configuring auto-start for $AUTO_START" - export KARAF_OPTS="-Dunomi.autoStart=$AUTO_START" + KARAF_OPTS_ARGS="-Dunomi.autoStart=$AUTO_START" else print_status "info" "Use [unomi:start] to start Unomi after Karaf initialization" fi + + if [ ! -z "$UNOMI_DISTRIBUTION" ]; then + if [ ! -z "$KARAF_OPTS_ARGS" ]; then + KARAF_OPTS_ARGS="$KARAF_OPTS_ARGS -Dunomi.distribution=$UNOMI_DISTRIBUTION" + else + KARAF_OPTS_ARGS="-Dunomi.distribution=$UNOMI_DISTRIBUTION" + fi + print_status "info" "Using Unomi distribution: $UNOMI_DISTRIBUTION" + fi + + if [ ! -z "$KARAF_OPTS_ARGS" ]; then + export KARAF_OPTS="$KARAF_OPTS_ARGS" + fi ./karaf || { print_status "error" "Karaf failed to start" diff --git a/manual/src/main/asciidoc/building-and-deploying.adoc b/manual/src/main/asciidoc/building-and-deploying.adoc index a03249623..b36c70b28 100644 --- a/manual/src/main/asciidoc/building-and-deploying.adoc +++ b/manual/src/main/asciidoc/building-and-deploying.adoc @@ -81,8 +81,11 @@ The `build.sh` script offers the following features: * **Preflight validation**: Automatically checks for required tools (Java, Maven, GraphViz), system resources (memory, disk space), Maven settings, and port availability -* **Flexible build options**: Support for skipping tests, running integration tests, using OpenSearch, debug modes, +* **Flexible build options**: Support for skipping tests, running integration tests, using OpenSearch, setting Unomi distribution, debug modes, and more +* **Distribution management**: The `--distribution` parameter allows you to specify which Unomi distribution to use (e.g., `unomi-distribution-opensearch`, `unomi-distribution-elasticsearch`). + When used with `--use-opensearch`, the distribution is automatically set to `unomi-distribution-opensearch` if not explicitly specified. + Conversely, if a distribution containing "opensearch" is specified, OpenSearch is automatically enabled for integration tests. * **Deployment helpers**: Automatically copies KAR packages to Karaf deploy directory and purges caches * **Enhanced output**: Colorized, structured output with progress indicators (respects `NO_COLOR` environment variable) @@ -109,6 +112,20 @@ Common usage examples: ./build.sh --integration-tests --use-opensearch ---- + +* Build with a specific Unomi distribution (automatically enables OpenSearch for tests if distribution contains "opensearch"): ++ +[source] +---- +./build.sh --integration-tests --distribution unomi-distribution-opensearch +---- ++ +* Build with OpenSearch using explicit distribution (both parameters work together): ++ +[source] +---- +./build.sh --integration-tests --use-opensearch --distribution unomi-distribution-opensearch-graphql +---- ++ * Build in debug mode: + [source] @@ -538,12 +555,35 @@ mvn -P integration-tests clean install ===== Selecting the Search Engine for Integration Tests -By default, integration tests target ElasticSearch. To run them against OpenSearch, set the activation property used by the OpenSearch profile (no additional -P flags are required): +By default, integration tests target ElasticSearch. To run them against OpenSearch, you can use either: +* **Using the build script** (recommended): ++ +[source] +---- +./build.sh --integration-tests --use-opensearch +---- ++ +Or specify the distribution directly (automatically enables OpenSearch if distribution contains "opensearch"): ++ +[source] +---- +./build.sh --integration-tests --distribution unomi-distribution-opensearch +---- ++ +* **Using Maven directly**: Set the activation property used by the OpenSearch profile (no additional -P flags are required): ++ [source] ---- mvn -P integration-tests -Duse.opensearch=true clean install ---- ++ +You can also set the Unomi distribution system property: ++ +[source] +---- +mvn -P integration-tests -Dunomi.distribution=unomi-distribution-opensearch clean install +---- ==== Testing with an example page
