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

[AUTO] Version Increment to 1.3.4-SNAPSHOT #1

Open
wants to merge 2 commits into
base: 1.3
Choose a base branch
from
Open
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
22 changes: 11 additions & 11 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,28 @@ jobs:

- name: Assemble anomaly-detection
run: |
./gradlew assemble -Dopensearch.version=1.3.3-SNAPSHOT
echo "Creating ./src/test/resources/org/opensearch/ad/bwc/anomaly-detection/1.3.3.0-SNAPSHOT ..."
mkdir -p ./src/test/resources/org/opensearch/ad/bwc/anomaly-detection/1.3.3.0-SNAPSHOT
echo "Copying ./build/distributions/*.zip to ./src/test/resources/org/opensearch/ad/bwc/anomaly-detection/1.3.3.0-SNAPSHOT ..."
./gradlew assemble -Dopensearch.version=1.3.4-SNAPSHOT
echo "Creating ./src/test/resources/org/opensearch/ad/bwc/anomaly-detection/1.3.4.0-SNAPSHOT ..."
mkdir -p ./src/test/resources/org/opensearch/ad/bwc/anomaly-detection/1.3.4.0-SNAPSHOT
echo "Copying ./build/distributions/*.zip to ./src/test/resources/org/opensearch/ad/bwc/anomaly-detection/1.3.4.0-SNAPSHOT ..."
ls ./build/distributions/
cp ./build/distributions/*.zip ./src/test/resources/org/opensearch/ad/bwc/anomaly-detection/1.3.3.0-SNAPSHOT
echo "Copied ./build/distributions/*.zip to ./src/test/resources/org/opensearch/ad/bwc/anomaly-detection/1.3.3.0-SNAPSHOT ..."
ls ./src/test/resources/org/opensearch/ad/bwc/anomaly-detection/1.3.3.0-SNAPSHOT
cp ./build/distributions/*.zip ./src/test/resources/org/opensearch/ad/bwc/anomaly-detection/1.3.4.0-SNAPSHOT
echo "Copied ./build/distributions/*.zip to ./src/test/resources/org/opensearch/ad/bwc/anomaly-detection/1.3.4.0-SNAPSHOT ..."
ls ./src/test/resources/org/opensearch/ad/bwc/anomaly-detection/1.3.4.0-SNAPSHOT
- name: Build and Run Tests
run: |
./gradlew build -Dopensearch.version=1.3.3-SNAPSHOT
./gradlew build -Dopensearch.version=1.3.4-SNAPSHOT
- name: Publish to Maven Local
run: |
./gradlew publishToMavenLocal -Dopensearch.version=1.3.3-SNAPSHOT
./gradlew publishToMavenLocal -Dopensearch.version=1.3.4-SNAPSHOT
- name: Multi Nodes Integration Testing
run: |
./gradlew integTest -PnumNodes=3
- name: Pull and Run Docker
run: |
plugin=`ls build/distributions/*.zip`
version=1.3.3
plugin_version=1.3.3.0-SNAPSHOT
version=1.3.4
plugin_version=1.3.4.0-SNAPSHOT
echo Using OpenSearch $version with AD $plugin_version
cd ..
if docker pull opensearchstaging/opensearch:$version
Expand Down
30 changes: 26 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import org.opensearch.gradle.testclusters.StandaloneRestIntegTestTask
buildscript {
ext {
opensearch_group = "org.opensearch"
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
opensearch_version = System.getProperty("opensearch.version", "1.3.3-SNAPSHOT")
opensearch_version = project.property('opensearch.version')
isSnapshot = project.property('build.snapshot')
if (isSnapshot) {
plugin_version = opensearch_version.substring(0, opensearch_version.indexOf("-"))
} else {
Expand Down Expand Up @@ -137,6 +137,28 @@ configurations {
}
}

task versionIncrement {
final String workingDir = project.buildDir.toString() + "/../"
if(project.hasProperty('newVersion')) {
println 'Set Project to new Version '+newVersion.tokenize('-')[0]
ant.replaceregexp(match: opensearch_version.tokenize('-')[0], replace: newVersion.tokenize('-')[0], flags:'g', byline:true) {
fileset(dir: workingDir) {
include(name: ".github/workflows/CI.yml")
include(name: "build.gradle")
}
}
}
}

task setVersion(dependsOn: versionIncrement) {
if(project.hasProperty('newVersion')) {
ant.propertyfile(
file: "gradle.properties") {
entry( key: "opensearch.version", value: "${newVersion}")
}
}
}

tasks.named('forbiddenApisMain').configure {
// Only enable limited check because AD code has too many violations.
replaceSignatureFiles 'jdk-signatures'
Expand Down Expand Up @@ -336,7 +358,7 @@ String bwcAnomalyDetectionPath = bwcFilePath + "anomaly-detection/"
testClusters {
"${baseName}$i" {
testDistribution = "ARCHIVE"
versions = ["7.10.2","1.3.3-SNAPSHOT"]
versions = ["7.10.2","1.3.4-SNAPSHOT"]
numberOfNodes = 3
plugin(provider(new Callable<RegularFile>(){
@Override
Expand Down Expand Up @@ -764,4 +786,4 @@ validateNebulaPom.enabled = false

tasks.withType(licenseHeaders.class) {
additionalLicense 'AL ', 'Apache', 'Licensed under the Apache License, Version 2.0 (the "License")'
}
}
7 changes: 7 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#Fri, 01 Jul 2022 16:48:59 +0000

# Copyright OpenSearch Contributors
# SPDX-License-Identifier: Apache-2.0

opensearch.version=1.3.4-SNAPSHOT
build.snapshot=true
69 changes: 69 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash

#
# Copyright OpenSearch Contributors
#
# SPDX-License-Identifier: Apache-2.0
#

set -ex

function usage() {
echo "Usage: $0 [args]"
echo ""
echo "Arguments:"
echo -e "-v VERSION\t[Required] OpenSearch version."
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:s:o:p:a:" arg; do
case $arg in
h)
usage
exit 1
;;
v)
VERSION=$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

[[ "$SNAPSHOT" == "true" ]] && VERSION=$VERSION-SNAPSHOT
[ -z "$OUTPUT" ] && OUTPUT=artifacts

./gradlew assemble --no-daemon --refresh-dependencies -DskipTests=true -Popensearch.version=$VERSION -Pbuild.snapshot=$SNAPSHOT
[ -z "$OUTPUT" ] && OUTPUT=artifacts
mkdir -p $OUTPUT/plugins
cp ./build/distributions/*.zip $OUTPUT/plugins