Skip to content

Commit 5477151

Browse files
Update dashboards build script to consume distribution
Signed-off-by: Peter Zhu <[email protected]>
1 parent 18c173c commit 5477151

File tree

1 file changed

+26
-11
lines changed
  • scripts/components/OpenSearch-Dashboards

1 file changed

+26
-11
lines changed

scripts/components/OpenSearch-Dashboards/build.sh

+26-11
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ function usage() {
1313
echo -e "-s SNAPSHOT\t[Optional] Build a snapshot, default is 'false'."
1414
echo -e "-p PLATFORM\t[Optional] Platform, default is 'uname -s'."
1515
echo -e "-a ARCHITECTURE\t[Optional] Build architecture, default is 'uname -m'."
16+
echo -e "-d DISTRIBUTION\t[Optional] Distribution, default is 'tar'."
1617
echo -e "-o OUTPUT\t[Optional] Output path, default is 'artifacts'."
1718
echo -e "-h help"
1819
}
1920

20-
while getopts ":h:v:s:o:p:a:" arg; do
21+
while getopts ":h:v:s:o:p:a:d:" arg; do
2122
case $arg in
2223
h)
2324
usage
@@ -38,6 +39,9 @@ while getopts ":h:v:s:o:p:a:" arg; do
3839
a)
3940
ARCHITECTURE=$OPTARG
4041
;;
42+
d)
43+
DISTRIBUTION=$OPTARG
44+
;;
4145
:)
4246
echo "Error: -${OPTARG} requires an argument"
4347
usage
@@ -59,35 +63,46 @@ fi
5963
[ -z "$OUTPUT" ] && OUTPUT=artifacts
6064
[ -z "$PLATFORM" ] && PLATFORM=$(uname -s | awk '{print tolower($0)}')
6165
[ -z "$ARCHITECTURE" ] && ARCHITECTURE=`uname -m`
66+
[ -z "$DISTRIBUTION" ] && DISTRIBUTION="tar"
67+
[[ "$SNAPSHOT" == "true" ]] && IDENTIFIER="-SNAPSHOT"
68+
[[ "$SNAPSHOT" != "true" ]] && RELEASE="--release"
6269

6370
# Assemble distribution artifact
6471
# see https://github.com/opensearch-project/OpenSearch/blob/main/settings.gradle#L34 for other distribution targets
65-
case $ARCHITECTURE in
66-
x64)
72+
case $PLATFORM-$DISTRIBUTION-$ARCHITECTURE in
73+
linux-tar-x64)
6774
TARGET="--$PLATFORM"
75+
EXT="tar.gz"
76+
EXTRA_PARAMS="--skip-os-packages"
6877
QUALIFIER="$PLATFORM-x64"
6978
;;
70-
arm64)
79+
linux-tar-arm64)
7180
TARGET="--$PLATFORM-arm"
81+
EXT="tar.gz"
82+
EXTRA_PARAMS="--skip-os-packages"
7283
QUALIFIER="$PLATFORM-arm64"
7384
;;
85+
linux-rpm-x64)
86+
TARGET="--$DISTRIBUTION"
87+
EXT="$DISTRIBUTION"
88+
EXTRA_PARAMS="--all-platforms --skip-archives"
89+
QUALIFIER="x64"
90+
;;
7491
*)
75-
echo "Unsupported architecture: ${ARCHITECTURE}"
92+
echo "Unsupported platform-distribution-architecture combination: $PLATFORM-$DISTRIBUTION-$ARCHITECTURE"
7693
exit 1
7794
;;
7895
esac
7996

80-
echo "Building node modules for core"
97+
echo "Building node modules for core with $PLATFORM-$DISTRIBUTION-$ARCHITECTURE"
8198
yarn osd bootstrap
8299

83100
echo "Building artifact"
84-
[[ "$SNAPSHOT" == "true" ]] && IDENTIFIER="-SNAPSHOT"
85-
[[ "$SNAPSHOT" != "true" ]] && RELEASE="--release"
86101

87-
yarn build-platform $TARGET --skip-os-packages $RELEASE
102+
yarn build-platform $TARGET $EXTRA_PARAMS $RELEASE
88103

89104
mkdir -p "${OUTPUT}/dist"
90105
# Copy artifact to dist folder in bundle build output
91-
ARTIFACT_BUILD_NAME=opensearch-dashboards-$VERSION$IDENTIFIER-$QUALIFIER.tar.gz
92-
ARTIFACT_TARGET_NAME=opensearch-dashboards-min-$VERSION$IDENTIFIER-$QUALIFIER.tar.gz
106+
ARTIFACT_BUILD_NAME=opensearch-dashboards-$VERSION$IDENTIFIER-$QUALIFIER.$EXT
107+
ARTIFACT_TARGET_NAME=opensearch-dashboards-min-$VERSION$IDENTIFIER-$QUALIFIER.$EXT
93108
cp target/$ARTIFACT_BUILD_NAME $OUTPUT/dist/$ARTIFACT_TARGET_NAME

0 commit comments

Comments
 (0)