Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Release 1.3.5] Version increment and add build.sh #170

Merged
merged 4 commits into from
Aug 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/multi-node-test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..."
Expand Down
21 changes: 20 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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)
}
}
79 changes: 79 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -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