Skip to content

Commit

Permalink
Use maven for plugin download (#139)
Browse files Browse the repository at this point in the history
* Fine tuning permissions on RPM spec file

* Get plugins using maven

* Rolling back changes to spec file

* Format files

---------

Co-authored-by: Álex Ruiz <alejandro.ruiz.becerra@wazuh.com>
  • Loading branch information
f-galland and AlexRuiz7 committed Sep 9, 2024
1 parent 4561078 commit ba3f142
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 29 deletions.
2 changes: 1 addition & 1 deletion docker/ci/images/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN mkdir /home/wazuh-indexer && \
echo "deb http://repo.aptly.info/ squeeze main" | tee -a /etc/apt/sources.list.d/aptly.list && \
apt-get update -y && \
apt-get upgrade -y && \
apt-get install -y aptly build-essential cpio debhelper-compat debmake freeglut3 libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-dev libcairo2 libcairo2-dev libcups2 libdrm2 libgbm-dev libgconf-2-4 libnspr4 libnspr4-dev libnss3 libpangocairo-1.0-0 libxcomposite-dev libxdamage1 libxfixes-dev libxfixes3 libxi6 libxkbcommon-x11-0 libxrandr2 libxrender1 libxtst6 rpm rpm2cpio && \
apt-get install -y aptly build-essential cpio debhelper-compat debmake freeglut3 libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-dev libcairo2 libcairo2-dev libcups2 libdrm2 libgbm-dev libgconf-2-4 libnspr4 libnspr4-dev libnss3 libpangocairo-1.0-0 libxcomposite-dev libxdamage1 libxfixes-dev libxfixes3 libxi6 libxkbcommon-x11-0 libxrandr2 libxrender1 libxtst6 rpm rpm2cpio maven && \
apt-get clean -y && \
dpkg -r lintian && \
addgroup --gid 1000 wazuh-indexer && \
Expand Down
1 change: 1 addition & 0 deletions docker/dev/images/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ RUN gradle clean

FROM eclipse-temurin:17-jdk-alpine
RUN apk add git && \
apk add curl && \
addgroup -g 1000 wazuh-indexer && \
adduser -u 1000 -G wazuh-indexer -D -h /home/wazuh-indexer wazuh-indexer && \
chmod 0775 /home/wazuh-indexer && \
Expand Down
56 changes: 28 additions & 28 deletions scripts/assemble.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,32 @@ set -ex

TEST=${TEST:-false}

if ( $TEST )
then
plugins=(
"performance-analyzer"
"opensearch-security"
)
if ($TEST); then
plugins=(
"performance-analyzer"
"opensearch-security"
)
else
plugins=(
"alerting" # "opensearch-alerting"
"opensearch-job-scheduler"
"opensearch-anomaly-detection" # Requires "opensearch-job-scheduler"
"asynchronous-search" # "opensearch-asynchronous-search"
"opensearch-cross-cluster-replication"
"geospatial" # "opensearch-geospatial"
"opensearch-index-management"
"opensearch-knn"
"opensearch-ml-plugin" # "opensearch-ml"
"neural-search" # "opensearch-neural-search"
"opensearch-notifications-core"
"notifications" # "opensearch-notifications". Requires "opensearch-notifications-core"
"opensearch-observability"
"performance-analyzer" # "opensearch-performance-analyzer"
"opensearch-reports-scheduler"
"opensearch-security"
"opensearch-security-analytics"
"opensearch-sql-plugin" # "opensearch-sql"
)
plugins=(
"alerting" # "opensearch-alerting"
"opensearch-job-scheduler"
"opensearch-anomaly-detection" # Requires "opensearch-job-scheduler"
"asynchronous-search" # "opensearch-asynchronous-search"
"opensearch-cross-cluster-replication"
"geospatial" # "opensearch-geospatial"
"opensearch-index-management"
"opensearch-knn"
"opensearch-ml-plugin" # "opensearch-ml"
"neural-search" # "opensearch-neural-search"
"opensearch-notifications-core"
"notifications" # "opensearch-notifications". Requires "opensearch-notifications-core"
"opensearch-observability"
"performance-analyzer" # "opensearch-performance-analyzer"
"opensearch-reports-scheduler"
"opensearch-security"
"opensearch-security-analytics"
"opensearch-sql-plugin" # "opensearch-sql"
)
fi

# ====
Expand Down Expand Up @@ -214,11 +213,12 @@ function enable_performance_analyzer_rca() {
# Install plugins
# ====
function install_plugins() {
# Install plugins from Maven repository
echo "Install plugins"
maven_repo_local="$HOME/maven"
for plugin in "${plugins[@]}"; do
plugin_from_maven="org.opensearch.plugin:${plugin}:$VERSION.0"
OPENSEARCH_PATH_CONF=$PATH_CONF "${PATH_BIN}/opensearch-plugin" install --batch --verbose "${plugin_from_maven}"
mvn -Dmaven.repo.local=$maven_repo_local org.apache.maven.plugins:maven-dependency-plugin:2.1:get -DrepoUrl=https://repo1.maven.org/maven2 -Dartifact=$plugin_from_maven:zip
OPENSEARCH_PATH_CONF=$PATH_CONF "${PATH_BIN}/opensearch-plugin" install --batch --verbose "file:${maven_repo_local}/org/opensearch/plugin/${plugin}/$VERSION.0/${plugin}-$VERSION.0.zip"
done
}

Expand Down

0 comments on commit ba3f142

Please sign in to comment.