Skip to content

Commit

Permalink
[BUILD][OSD] Support version qualifier
Browse files Browse the repository at this point in the history
Support version qualifier builds for OpenSearch Dashboards and
OpenSearch Dashboards Plugins.

This will create a zip for plugins with the OpenSearch Dashboards
version + qualifier. But the version of the plugin will remain the
same whilst opensearchDashboardsVersion in the opensearch_dashboards.json
will be the OpenSearch Dashboards version, eg, 1.3.0-alpha1. This is why
the version check needed to be modified a little to ensure that it can
get the version + qualifier and the default version of the plugin.

Updated for plugins as well.

Was able to successfully build and connect OSD 1.3.0-alpha1 to
the release version of OS 1.3.0.

Issue resolved:
opensearch-project/OpenSearch-Dashboards#1340

Issue partially resolved:
opensearch-project#1632

Signed-off-by: Kawika Avilla <[email protected]>
  • Loading branch information
kavilla committed Mar 27, 2022
1 parent 6a06d7d commit b9b58ae
Show file tree
Hide file tree
Showing 15 changed files with 100 additions and 45 deletions.
1 change: 1 addition & 0 deletions manifests/2.0.0/opensearch-dashboards-2.0.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ schema-version: '1.0'
build:
name: OpenSearch Dashboards
version: 2.0.0
qualifier: alpha1
ci:
image:
name: opensearchstaging/ci-runner:ci-runner-centos7-opensearch-dashboards-build
Expand Down
21 changes: 13 additions & 8 deletions scripts/components/OpenSearch-Dashboards/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function usage() {
echo ""
echo "Arguments:"
echo -e "-v VERSION\t[Required] OpenSearch Dashboards 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, default is 'uname -s'."
echo -e "-a ARCHITECTURE\t[Optional] Build architecture, default is 'uname -m'."
Expand All @@ -18,7 +19,7 @@ function usage() {
echo -e "-h help"
}

while getopts ":h:v:s:o:p:a:d:" arg; do
while getopts ":h:v:q:s:o:p:a:d:" arg; do
case $arg in
h)
usage
Expand All @@ -27,6 +28,9 @@ while getopts ":h:v:s:o:p:a:d:" arg; do
v)
VERSION=$OPTARG
;;
q)
QUALIFIER=$OPTARG
;;
s)
SNAPSHOT=$OPTARG
;;
Expand Down Expand Up @@ -64,6 +68,7 @@ fi
[ -z "$PLATFORM" ] && PLATFORM=$(uname -s | awk '{print tolower($0)}')
[ -z "$ARCHITECTURE" ] && ARCHITECTURE=`uname -m`
[ -z "$DISTRIBUTION" ] && DISTRIBUTION="tar"
[ ! -z "$QUALIFIER" ] && QUALIFIER_IDENTIFIER="-$QUALIFIER"
[[ "$SNAPSHOT" == "true" ]] && IDENTIFIER="-SNAPSHOT"
[[ "$SNAPSHOT" != "true" ]] && RELEASE="--release"

Expand All @@ -75,28 +80,28 @@ case $PLATFORM-$DISTRIBUTION-$ARCHITECTURE in
EXT="tar.gz"
BUILD_PARAMS="build-platform"
EXTRA_PARAMS="--skip-os-packages"
QUALIFIER="$PLATFORM-x64"
SUFFIX="$PLATFORM-x64"
;;
linux-tar-arm64)
TARGET="--$PLATFORM-arm"
EXT="tar.gz"
BUILD_PARAMS="build-platform"
EXTRA_PARAMS="--skip-os-packages"
QUALIFIER="$PLATFORM-arm64"
SUFFIX="$PLATFORM-arm64"
;;
linux-rpm-x64)
TARGET="--$DISTRIBUTION"
EXT="$DISTRIBUTION"
BUILD_PARAMS="build"
EXTRA_PARAMS="--skip-archives"
QUALIFIER="x64"
SUFFIX="x64"
;;
linux-rpm-arm64)
TARGET="--$DISTRIBUTION-arm"
EXT="$DISTRIBUTION"
BUILD_PARAMS="build"
EXTRA_PARAMS="--skip-archives"
QUALIFIER="arm64"
SUFFIX="arm64"
;;
*)
echo "Unsupported platform-distribution-architecture combination: $PLATFORM-$DISTRIBUTION-$ARCHITECTURE"
Expand All @@ -109,10 +114,10 @@ yarn osd bootstrap

echo "Building artifact"

yarn $BUILD_PARAMS $TARGET $EXTRA_PARAMS $RELEASE
yarn $BUILD_PARAMS $TARGET $EXTRA_PARAMS $RELEASE --version-qualifier=$QUALIFIER

mkdir -p "${OUTPUT}/dist"
# Copy artifact to dist folder in bundle build output
ARTIFACT_BUILD_NAME=opensearch-dashboards-$VERSION$IDENTIFIER-$QUALIFIER.$EXT
ARTIFACT_TARGET_NAME=opensearch-dashboards-min-$VERSION$IDENTIFIER-$QUALIFIER.$EXT
ARTIFACT_BUILD_NAME=opensearch-dashboards-$VERSION$QUALIFIER_IDENTIFIER$IDENTIFIER-$SUFFIX.$EXT
ARTIFACT_TARGET_NAME=opensearch-dashboards-min-$VERSION$QUALIFIER_IDENTIFIER$IDENTIFIER-$SUFFIX.$EXT
cp target/$ARTIFACT_BUILD_NAME $OUTPUT/dist/$ARTIFACT_TARGET_NAME
11 changes: 8 additions & 3 deletions scripts/components/ganttChartDashboards/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ function usage() {
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:s:o:p:a:" arg; do
while getopts ":h:v:q:s:o:p:a:" arg; do
case $arg in
h)
usage
Expand All @@ -29,6 +30,9 @@ while getopts ":h:v:s:o:p:a:" arg; do
v)
VERSION=$OPTARG
;;
q)
QUALIFIER=$OPTARG
;;
s)
SNAPSHOT=$OPTARG
;;
Expand Down Expand Up @@ -60,6 +64,7 @@ if [ -z "$VERSION" ]; then
fi

[ -z "$OUTPUT" ] && OUTPUT=artifacts
[ ! -z "$QUALIFIER" ] && QUALIFIER_IDENTIFIER="-$QUALIFIER"

mkdir -p $OUTPUT/plugins
# For hybrid plugin it actually resides in 'ganttChartDashboards/gantt-chart'
Expand All @@ -71,7 +76,7 @@ cp -r ../$PLUGIN_FOLDER/ ../../OpenSearch-Dashboards/plugins
echo "BUILD MODULES FOR $PLUGIN_NAME"
(cd ../../OpenSearch-Dashboards && yarn osd bootstrap)
echo "BUILD RELEASE ZIP FOR $PLUGIN_NAME"
(cd ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER && yarn plugin-helpers build)
(cd ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER && yarn plugin-helpers build --opensearch-dashboards-version=$VERSION$QUALIFIER_IDENTIFIER)
echo "COPY $PLUGIN_NAME.zip"
cp -r ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER/build/$PLUGIN_NAME-$VERSION.zip $OUTPUT/plugins/
cp -r ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER/build/$PLUGIN_NAME-$VERSION$QUALIFIER_IDENTIFIER.zip $OUTPUT/plugins/
rm -rf ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER
11 changes: 8 additions & 3 deletions scripts/components/notebooksDashboards/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ function usage() {
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:s:o:p:a:" arg; do
while getopts ":h:v:q:s:o:p:a:" arg; do
case $arg in
h)
usage
Expand All @@ -29,6 +30,9 @@ while getopts ":h:v:s:o:p:a:" arg; do
v)
VERSION=$OPTARG
;;
q)
QUALIFIER=$OPTARG
;;
s)
SNAPSHOT=$OPTARG
;;
Expand Down Expand Up @@ -60,6 +64,7 @@ if [ -z "$VERSION" ]; then
fi

[ -z "$OUTPUT" ] && OUTPUT=artifacts
[ ! -z "$QUALIFIER" ] && QUALIFIER_IDENTIFIER="-$QUALIFIER"

mkdir -p $OUTPUT/plugins
# For hybrid plugin it actually resides in 'notebooksDashboards/dashboards-notebooks'
Expand All @@ -71,7 +76,7 @@ cp -r ../$PLUGIN_FOLDER/ ../../OpenSearch-Dashboards/plugins
echo "BUILD MODULES FOR $PLUGIN_NAME"
(cd ../../OpenSearch-Dashboards && yarn osd bootstrap)
echo "BUILD RELEASE ZIP FOR $PLUGIN_NAME"
(cd ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER && yarn plugin-helpers build)
(cd ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER && yarn plugin-helpers build --opensearch-dashboards-version=$VERSION$QUALIFIER_IDENTIFIER)
echo "COPY $PLUGIN_NAME.zip"
cp -r ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER/build/$PLUGIN_NAME-$VERSION.zip $OUTPUT/plugins/
cp -r ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER/build/$PLUGIN_NAME-$VERSION$QUALIFIER_IDENTIFIER.zip $OUTPUT/plugins/
rm -rf ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER
11 changes: 8 additions & 3 deletions scripts/components/notificationsDashboards/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ function usage() {
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:s:o:p:a:" arg; do
while getopts ":h:v:q:s:o:p:a:" arg; do
case $arg in
h)
usage
Expand All @@ -29,6 +30,9 @@ while getopts ":h:v:s:o:p:a:" arg; do
v)
VERSION=$OPTARG
;;
q)
QUALIFIER=$OPTARG
;;
s)
SNAPSHOT=$OPTARG
;;
Expand Down Expand Up @@ -60,6 +64,7 @@ if [ -z "$VERSION" ]; then
fi

[ -z "$OUTPUT" ] && OUTPUT=artifacts
[ ! -z "$QUALIFIER" ] && QUALIFIER_IDENTIFIER="-$QUALIFIER"

mkdir -p $OUTPUT/plugins
# For hybrid plugin it actually resides in 'notificationsDashboards/dashboards-notifications'
Expand All @@ -71,7 +76,7 @@ cp -r ../$PLUGIN_FOLDER/ ../../OpenSearch-Dashboards/plugins
echo "BUILD MODULES FOR $PLUGIN_NAME"
(cd ../../OpenSearch-Dashboards && yarn osd bootstrap)
echo "BUILD RELEASE ZIP FOR $PLUGIN_NAME"
(cd ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER && yarn plugin_helpers build)
(cd ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER && yarn plugin_helpers build --opensearch-dashboards-version=$VERSION$QUALIFIER_IDENTIFIER)
echo "COPY $PLUGIN_NAME.zip"
cp -r ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER/build/$PLUGIN_NAME-$VERSION.zip $OUTPUT/plugins/
cp -r ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER/build/$PLUGIN_NAME-$VERSION$QUALIFIER_IDENTIFIER.zip $OUTPUT/plugins/
rm -rf ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER
11 changes: 8 additions & 3 deletions scripts/components/observabilityDashboards/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ function usage() {
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:s:o:p:a:" arg; do
while getopts ":h:v:q:s:o:p:a:" arg; do
case $arg in
h)
usage
Expand All @@ -29,6 +30,9 @@ while getopts ":h:v:s:o:p:a:" arg; do
v)
VERSION=$OPTARG
;;
q)
QUALIFIER=$OPTARG
;;
s)
SNAPSHOT=$OPTARG
;;
Expand Down Expand Up @@ -60,6 +64,7 @@ if [ -z "$VERSION" ]; then
fi

[ -z "$OUTPUT" ] && OUTPUT=artifacts
[ ! -z "$QUALIFIER" ] && QUALIFIER_IDENTIFIER="-$QUALIFIER"

mkdir -p $OUTPUT/plugins
# For hybrid plugin it actually resides in 'observability/dashboards-observability'
Expand All @@ -71,7 +76,7 @@ cp -r ../$PLUGIN_FOLDER/ ../../OpenSearch-Dashboards/plugins
echo "BUILD MODULES FOR $PLUGIN_NAME"
(cd ../../OpenSearch-Dashboards && yarn osd bootstrap)
echo "BUILD RELEASE ZIP FOR $PLUGIN_NAME"
(cd ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER && yarn plugin_helpers build)
(cd ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER && yarn plugin_helpers build --opensearch-dashboards-version=$VERSION$QUALIFIER_IDENTIFIER)
echo "COPY $PLUGIN_NAME.zip"
cp -r ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER/build/$PLUGIN_NAME-$VERSION.zip $OUTPUT/plugins/
cp -r ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER/build/$PLUGIN_NAME-$VERSION$QUALIFIER_IDENTIFIER.zip $OUTPUT/plugins/
rm -rf ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER
11 changes: 8 additions & 3 deletions scripts/components/queryWorkbenchDashboards/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ function usage() {
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:s:o:p:a:" arg; do
while getopts ":h:v:q:s:o:p:a:" arg; do
case $arg in
h)
usage
Expand All @@ -29,6 +30,9 @@ while getopts ":h:v:s:o:p:a:" arg; do
v)
VERSION=$OPTARG
;;
q)
QUALIFIER=$OPTARG
;;
s)
SNAPSHOT=$OPTARG
;;
Expand Down Expand Up @@ -60,6 +64,7 @@ if [ -z "$VERSION" ]; then
fi

[ -z "$OUTPUT" ] && OUTPUT=artifacts
[ ! -z "$QUALIFIER" ] && QUALIFIER_IDENTIFIER="-$QUALIFIER"

mkdir -p $OUTPUT/plugins
# For hybrid plugin it actually resides in 'queryWorkbenchDashboards/workbench'
Expand All @@ -71,7 +76,7 @@ cp -r ../$PLUGIN_FOLDER/ ../../OpenSearch-Dashboards/plugins
echo "BUILD MODULES FOR $PLUGIN_NAME"
(cd ../../OpenSearch-Dashboards && yarn osd bootstrap)
echo "BUILD RELEASE ZIP FOR $PLUGIN_NAME"
(cd ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER && yarn plugin_helpers build)
(cd ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER && yarn plugin_helpers build --opensearch-dashboards-version=$VERSION$QUALIFIER_IDENTIFIER)
echo "COPY $PLUGIN_NAME.zip"
cp -r ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER/build/$PLUGIN_NAME-$VERSION.zip $OUTPUT/plugins/
cp -r ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER/build/$PLUGIN_NAME-$VERSION$QUALIFIER_IDENTIFIER.zip $OUTPUT/plugins/
rm -rf ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER
15 changes: 10 additions & 5 deletions scripts/components/reportsDashboards/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ function usage() {
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, default is 'uname -s'."
echo -e "-a ARCHITECTURE\t[Optional] Build architecture, default is 'uname -m'."
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
while getopts ":h:v:q:s:o:p:a:" arg; do
case $arg in
h)
usage
Expand All @@ -29,6 +30,9 @@ while getopts ":h:v:s:o:p:a:" arg; do
v)
VERSION=$OPTARG
;;
q)
QUALIFIER=$OPTARG
;;
s)
SNAPSHOT=$OPTARG
;;
Expand Down Expand Up @@ -62,6 +66,7 @@ fi
[ -z "$OUTPUT" ] && OUTPUT=artifacts
[ -z "$PLATFORM" ] && PLATFORM=$(uname -s | awk '{print tolower($0)}')
[ -z "$ARCHITECTURE" ] && ARCHITECTURE=`uname -m`
[ ! -z "$QUALIFIER" ] && QUALIFIER_IDENTIFIER="-$QUALIFIER"

case $PLATFORM in
linux*)
Expand Down Expand Up @@ -99,17 +104,17 @@ cp -r ../$PLUGIN_FOLDER/ ../../OpenSearch-Dashboards/plugins
echo "BUILD MODULES FOR $PLUGIN_NAME"
(cd ../../OpenSearch-Dashboards && yarn osd bootstrap)
echo "BUILD RELEASE ZIP FOR $PLUGIN_NAME"
(cd ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER && yarn plugin_helpers build)
(cd ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER && yarn plugin_helpers build --opensearch-dashboards-version=$VERSION$QUALIFIER_IDENTIFIER)
ZIP_NAME=`ls ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER/build | grep .zip`
unzip ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER/build/$ZIP_NAME -d ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER/build/
# Reporting uses headless chromium to generate reports, which needs to be included in its artifact
echo "DOWNLOADING CHROMIUM FOR $PLUGIN_NAME"
mkdir -p ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER/build/opensearch-dashboards/$PLUGIN_NAME
curl -SL "$CHROMIUM_URL" -o $CHROMIUM_TARGET
echo "PUTTING CHROMIUM INSIDE $PLUGIN_NAME-$VERSION.zip"
echo "PUTTING CHROMIUM INSIDE $PLUGIN_NAME-$VERSION$QUALIFIER_IDENTIFIER.zip"
unzip "$CHROMIUM_TARGET" -d ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER/build/opensearch-dashboards/$PLUGIN_NAME
(cd ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER/build && zip -ur $PLUGIN_NAME-$VERSION.zip opensearch-dashboards)
(cd ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER/build && zip -ur $PLUGIN_NAME-$VERSION$QUALIFIER_IDENTIFIER.zip opensearch-dashboards)
echo "COPY $PLUGIN_NAME.zip"
cp -r ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER/build/$PLUGIN_NAME-$VERSION.zip $OUTPUT/plugins/
cp -r ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER/build/$PLUGIN_NAME-$VERSION$QUALIFIER_IDENTIFIER.zip $OUTPUT/plugins/
rm -rf ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER

Loading

0 comments on commit b9b58ae

Please sign in to comment.