Skip to content

Commit ac5e7f1

Browse files
author
Ethan Choe
committed
add opensearch-prometheus-exporter 3.6.0.0
1 parent 6f530cb commit ac5e7f1

1 file changed

Lines changed: 94 additions & 0 deletions

File tree

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#!/bin/bash -ex
2+
# -----------------------------------------------------------------------------
3+
#
4+
# Package : opensearch-prometheus-exporter
5+
# Version : 3.6.0.0
6+
# Source repo : https://github.com/opensearch-project/opensearch-prometheus-exporter.git
7+
# Tested on : UBI 9.6
8+
# Language : Java
9+
# Ci-Check : True
10+
# Script License : Apache License, Version 2 or later
11+
# Maintainer : Ethan Choe <ethanchoe@ibm.com>
12+
#
13+
# Disclaimer : This script has been tested in non-root mode on given
14+
# ========== platform using the mentioned version of the package.
15+
# It may not work as expected with newer versions of the
16+
# package and/or distribution. In such case, please
17+
# contact "Maintainer" of this script.
18+
#
19+
# ---------------------------------------------------------------------------
20+
21+
PACKAGE_NAME=opensearch-prometheus-exporter
22+
PACKAGE_URL=https://github.com/opensearch-project/opensearch-prometheus-exporter.git
23+
PACKAGE_VERSION=${1:-3.6.0.0}
24+
BUILD_HOME=`pwd`
25+
26+
# ----------------------------------------------
27+
# Install system packages
28+
# ----------------------------------------------
29+
sudo dnf install -y git wget
30+
31+
# ----------------------------------------------
32+
# Install java25
33+
# ----------------------------------------------
34+
sudo dnf install java-25-openjdk-devel
35+
36+
export JAVA_HOME=/usr/lib/jvm/java-25-openjdk
37+
export PATH="/usr/local/bin:$HOME/.local/bin:$JAVA_HOME/bin:$PATH"
38+
39+
# -------------------------------
40+
# Remove exiting repository (if exists)
41+
# -------------------------------
42+
if [ -d "${PACKAGE_NAME}" ]; then
43+
echo "Removing existing ${PACKAGE_NAME} directory..."
44+
rm -rf "${PACKAGE_NAME}"
45+
fi
46+
47+
# -------------------------------
48+
# Clone and Prepare Repository
49+
# -------------------------------
50+
cd "${BUILD_HOME}"
51+
git clone "${PACKAGE_URL}"
52+
cd "${PACKAGE_NAME}" && git checkout "${PACKAGE_VERSION}"
53+
54+
# --------
55+
# Build
56+
# --------
57+
ret=0
58+
./gradlew clean build || ret=$?
59+
if [ $ret -ne 0 ]; then
60+
set +ex
61+
echo "------------------ ${PACKAGE_NAME}: Build Failed ------------------"
62+
exit 1
63+
fi
64+
65+
export OPENSEARCH_PROMETHEUS_EXPORTER_ZIP=${BUILD_HOME}/${PACKAGE_NAME}/build/distributions/prometheus-exporter-${PACKAGE_VERSION}.zip
66+
67+
# ----------------------------------
68+
# Run complete test suite
69+
# ----------------------------------
70+
ret=0
71+
./gradlew clean check || ret=$?
72+
if [ $ret -ne 0 ]; then
73+
ret=0
74+
set +ex
75+
echo "------------------ ${PACKAGE_NAME}: Test Suite Failed ------------------"
76+
exit 2
77+
fi
78+
79+
# ---------------------------------------
80+
# Backward Compatibility (BWC) Testing
81+
# ---------------------------------------
82+
ret=0
83+
./bwctest.sh || ret=$?
84+
if [ $ret -ne 0 ]; then
85+
set +ex
86+
echo "------------------ ${PACKAGE_NAME}: BWC Tests Failed ------------------"
87+
exit 2
88+
fi
89+
90+
# If we reach here, both the build and tests were successful
91+
set +ex
92+
echo "------------------ ${PACKAGE_NAME} ${PACKAGE_VERSION} Build and Tests Successful ------------------"
93+
echo "------------------ Plugin zip available at $OPENSEARCH_PROMETHEUS_EXPORTER_ZIP --------------------------------"
94+
exit 0

0 commit comments

Comments
 (0)