diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4ecebaf6..eb1c7c40 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,11 +30,11 @@ jobs: - name: Checkout Branch uses: actions/checkout@v2 - name: Build with Gradle - run: ./gradlew build -Dopensearch.version=1.3.4-SNAPSHOT + run: ./gradlew build -Dopensearch.version=1.3.5-SNAPSHOT - name: Pull and Run Docker for security tests run: | - version=1.3.4-SNAPSHOT - plugin_version=1.3.4.0-SNAPSHOT + version=1.3.5-SNAPSHOT + plugin_version=1.3.5.0-SNAPSHOT pwd=`pwd` echo $pwd cd .. @@ -108,7 +108,7 @@ jobs: - name: Checkout Branch uses: actions/checkout@v2 - name: Build with Gradle - run: ./gradlew.bat build -D"opensearch.version=1.3.4-SNAPSHOT" -x integTest -x jacocoTestReport + run: ./gradlew.bat build -D"opensearch.version=1.3.5-SNAPSHOT" -x integTest -x jacocoTestReport env: _JAVA_OPTIONS: -Xmx4096M - name: Create Artifact Path @@ -136,7 +136,7 @@ jobs: - name: Checkout Branch uses: actions/checkout@v2 - name: Build with Gradle - run: ./gradlew build -Dopensearch.version=1.3.4-SNAPSHOT -x integTest -x jacocoTestReport + run: ./gradlew build -Dopensearch.version=1.3.5-SNAPSHOT -x integTest -x jacocoTestReport env: _JAVA_OPTIONS: -Xmx4096M - name: Create Artifact Path diff --git a/.github/workflows/multi-node-test-workflow.yml b/.github/workflows/multi-node-test-workflow.yml index 5467ded3..886ef284 100644 --- a/.github/workflows/multi-node-test-workflow.yml +++ b/.github/workflows/multi-node-test-workflow.yml @@ -27,7 +27,7 @@ jobs: - name: Checkout Branch uses: actions/checkout@v2 - name: Run integration tests with multi node config - run: ./gradlew integTest -PnumNodes=5 -Dopensearch.version=1.3.4-SNAPSHOT + run: ./gradlew integTest -PnumNodes=5 -Dopensearch.version=1.3.5-SNAPSHOT - name: Run Backwards Compatibility Tests run: | echo "Running backwards compatibility tests ..." diff --git a/build.gradle b/build.gradle index 04ea682d..6f455b1f 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { distribution = 'oss-zip' opensearch_group = "org.opensearch" isSnapshot = "true" == System.getProperty("build.snapshot", "true") - opensearch_version = System.getProperty("opensearch.version", "1.3.4-SNAPSHOT") + opensearch_version = System.getProperty("opensearch.version", "1.3.5-SNAPSHOT") // 1.0.0 -> 1.0.0.0, and 1.0.0-SNAPSHOT -> 1.0.0.0-SNAPSHOT opendistro_plugin_version = System.getProperty("bwc.version", "1.13.0.1") opensearch_build = opensearch_version.replaceAll(/(\.\d)([^\d]*)$/, '$1.0$2') @@ -344,3 +344,22 @@ run { } apply from: 'build-tools/pkgbuild.gradle' + +// updateVersion: Task to auto increment to the next development iteration +task updateVersion { + onlyIf { System.getProperty('newVersion') } + doLast { + ext.newVersion = System.getProperty('newVersion') + println "Setting version to ${newVersion}." + // String tokenization to support -SNAPSHOT + ant.replaceregexp(match: opensearch_version.tokenize('-')[0], replace: newVersion.tokenize('-')[0], flags:'g', byline:true) { + fileset(dir: projectDir) { + // Include the required files that needs to be updated with new Version + include(name: ".github/workflows/build.yml") + include(name: ".github/workflows/multi-node-test-workflow.yml") + + } + } + ant.replaceregexp(file:'build.gradle', match: '"opensearch.version", "\\d.*"', replace: '"opensearch.version", "' + newVersion.tokenize('-')[0] + '-SNAPSHOT"', flags:'g', byline:true) + } +} diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 00000000..5cf85406 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,79 @@ +#!/bin/bash + +# SPDX-License-Identifier: Apache-2.0 +# +# The OpenSearch Contributors require contributions made to +# this file be licensed under the Apache-2.0 license or a +# compatible open source license. + +set -ex + +function usage() { + echo "Usage: $0 [args]" + echo "" + echo "Arguments:" + echo -e "-v VERSION\t[Required] OpenSearch version." + echo -e "-q QUALIFIER\t[Optional] Version qualifier." + echo -e "-s SNAPSHOT\t[Optional] Build a snapshot, default is 'false'." + echo -e "-p PLATFORM\t[Optional] Platform, ignored." + echo -e "-a ARCHITECTURE\t[Optional] Build architecture, ignored." + echo -e "-o OUTPUT\t[Optional] Output path, default is 'artifacts'." + echo -e "-h help" +} + +while getopts ":h:v:q:s:o:p:a:" arg; do + case $arg in + h) + usage + exit 1 + ;; + v) + VERSION=$OPTARG + ;; + q) + QUALIFIER=$OPTARG + ;; + s) + SNAPSHOT=$OPTARG + ;; + o) + OUTPUT=$OPTARG + ;; + p) + PLATFORM=$OPTARG + ;; + a) + ARCHITECTURE=$OPTARG + ;; + :) + echo "Error: -${OPTARG} requires an argument" + usage + exit 1 + ;; + ?) + echo "Invalid option: -${arg}" + exit 1 + ;; + esac +done + +if [ -z "$VERSION" ]; then + echo "Error: You must specify the OpenSearch version" + usage + exit 1 +fi + +[[ ! -z "$QUALIFIER" ]] && VERSION=$VERSION-$QUALIFIER +[[ "$SNAPSHOT" == "true" ]] && VERSION=$VERSION-SNAPSHOT +[ -z "$OUTPUT" ] && OUTPUT=artifacts + +mkdir -p $OUTPUT + +./gradlew assemble --no-daemon --refresh-dependencies -DskipTests=true -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT -Dbuild.version_qualifier=$QUALIFIER + +zipPath=$(find . -path \*build/distributions/*.zip) +distributions="$(dirname "${zipPath}")" + +echo "COPY ${distributions}/*.zip" +mkdir -p $OUTPUT/plugins +cp ${distributions}/*.zip ./$OUTPUT/plugins