Skip to content

Commit 76012c0

Browse files
author
Ethan Choe
committed
Add opensearch-prometheus-exporter 3.6.0.0 build script
- Added build script for opensearch-prometheus-exporter version 3.6.0.0 - Updated build_info.json configuration - Fixed permission issue with chown command for CI environment Signed-off-by: Ethan Choe <ethanchoe@ibm.com>
1 parent 6f530cb commit 76012c0

2 files changed

Lines changed: 107 additions & 5 deletions

File tree

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
{
2-
"maintainer": "Prachi.Gaonkar@ibm.com",
2+
"maintainer": "ethanchoe@ibm.com",
33
"package_name": "opensearch-prometheus-exporter",
44
"github_url": "https://github.com/opensearch-project/opensearch-prometheus-exporter.git",
5-
"version": "3.2.0.0",
6-
"required_versions":{"Releases": ["*"], "Tags": ["3.2.0.0"]},
5+
"version": "3.6.0.0",
6+
"required_versions":{"Releases": ["*"], "Tags": ["3.6.0.0"]},
77
"default_branch": "main",
88
"package_dir": "o/opensearch-prometheus-exporter",
9-
"build_script": "opensearch-prometheus-exporter_3.2.0.0_ubi_9.6.sh",
9+
"build_script": "opensearch-prometheus-exporter_3.6.0.0_ubi_9.6.sh",
1010
"validate_build_script": true,
1111
"use_non_root_user": true,
1212
"docker_build": false,
1313
"3.2.0.0": {
1414
"build_script": "opensearch-prometheus-exporter_3.2.0.0_ubi_9.6.sh"
15+
},
16+
"3.6.0.0": {
17+
"build_script": "opensearch-prometheus-exporter_3.6.0.0_ubi_9.6.sh"
18+
},
19+
"3.*.*.*": {
20+
"build_script": "opensearch-prometheus-exporter_3.6.0.0_ubi_9.6.sh"
1521
}
16-
}
22+
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
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 -y 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+
sudo chown -R test_user:test_user /home/tester
40+
41+
# -------------------------------
42+
# Remove exiting repository (if exists)
43+
# -------------------------------
44+
if [ -d "${PACKAGE_NAME}" ]; then
45+
echo "Removing existing ${PACKAGE_NAME} directory..."
46+
rm -rf "${PACKAGE_NAME}"
47+
fi
48+
49+
# -------------------------------
50+
# Clone and Prepare Repository
51+
# -------------------------------
52+
cd "${BUILD_HOME}"
53+
git clone "${PACKAGE_URL}"
54+
cd "${PACKAGE_NAME}" && git checkout "${PACKAGE_VERSION}"
55+
56+
# --------
57+
# Build
58+
# --------
59+
ret=0
60+
./gradlew clean build || ret=$?
61+
if [ $ret -ne 0 ]; then
62+
set +ex
63+
echo "------------------ ${PACKAGE_NAME}: Build Failed ------------------"
64+
exit 1
65+
fi
66+
67+
export OPENSEARCH_PROMETHEUS_EXPORTER_ZIP=${BUILD_HOME}/${PACKAGE_NAME}/build/distributions/prometheus-exporter-${PACKAGE_VERSION}.zip
68+
69+
# ----------------------------------
70+
# Run complete test suite
71+
# ----------------------------------
72+
ret=0
73+
./gradlew clean check || ret=$?
74+
if [ $ret -ne 0 ]; then
75+
ret=0
76+
set +ex
77+
echo "------------------ ${PACKAGE_NAME}: Test Suite Failed ------------------"
78+
exit 2
79+
fi
80+
81+
# ---------------------------------------
82+
# Backward Compatibility (BWC) Testing
83+
# ---------------------------------------
84+
ret=0
85+
./bwctest.sh || ret=$?
86+
if [ $ret -ne 0 ]; then
87+
set +ex
88+
echo "------------------ ${PACKAGE_NAME}: BWC Tests Failed ------------------"
89+
exit 2
90+
fi
91+
92+
# If we reach here, both the build and tests were successful
93+
set +ex
94+
echo "------------------ ${PACKAGE_NAME} ${PACKAGE_VERSION} Build and Tests Successful ------------------"
95+
echo "------------------ Plugin zip available at $OPENSEARCH_PROMETHEUS_EXPORTER_ZIP --------------------------------"
96+
exit 0

0 commit comments

Comments
 (0)