forked from opensearch-project/security
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds build script for publishing plugin zip and makes it executable (o…
…pensearch-project#1921) (opensearch-project#1923) (cherry picked from commit 192ef35) Co-authored-by: Darshit Chanpura <[email protected]>
- Loading branch information
1 parent
a526d0b
commit 8418dfe
Showing
1 changed file
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/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 "-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 | ||
|
||
./gradlew publishPluginZipPublicationToZipStagingRepository -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT -Dbuild.version_qualifier=$QUALIFIER | ||
mkdir -p $OUTPUT/maven/org/opensearch | ||
cp -r ./build/local-staging-repo/org/opensearch/. $OUTPUT/maven/org/opensearch |