Skip to content

Commit

Permalink
Edit path and fix the control in assemble.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
mcasas993 committed Nov 13, 2024
1 parent fce51b6 commit d2cdd36
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 69 deletions.
66 changes: 0 additions & 66 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -278,22 +278,6 @@ jobs:
echo "versionOpenSearch_inBuild=$VERSION" >> $GITHUB_OUTPUT
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: PRE Cache /usr/share/wazuh-indexer/bin/opensearch-plugin
id: pre-assemble-cache-usr-share-opensearch-plugins
uses: actions/cache@v4
with:
path: |
./usr/share/wazuh-indexer/bin/opensearch-plugin
key: ${{ runner.os }}-usr-share-opensearch-${{ hashFiles('**.jar') }}
restore-keys: |
${{ runner.os }}-usr-share-opensearch-
${{ runner.os }}-usr-share-opensearch
- if: ${{steps.pre-assemble-cache-usr-share-opensearch-plugins.outputs.cache-hit == 'true'}}
name: PRE Cache /usr/share/wazuh-indexer/bin/opensearch-plugin success
run: ls -la ./usr/share/wazuh-indexer/bin/opensearch-plugin


- name: PRE Cache ~/.m2/repository/org/opensearch
id: pre-assemble-cache-m2-repository-opensearch-plugins
uses: actions/cache@v4
Expand All @@ -309,46 +293,13 @@ jobs:
name: PRE Cache ~/.m2/repository/org/opensearch success
run: ls -la ~/.m2/repository/org/opensearch


- name: PRE Cache $HOME/.m2/org/opensearch/plugin/
id: pre-assemble-cache-home-m2-opensearch-plugins
uses: actions/cache@v4
with:
path: |
$HOME/.m2/org/opensearch/plugin/
key: ${{ runner.os }}-home-m2-opensearch-${{ hashFiles('**.xml') }}
restore-keys: |
${{ runner.os }}-home-m2-opensearch-
${{ runner.os }}-home-m2-opensearch
- if: ${{steps.pre-assemble-cache-home-m2-opensearch-plugins.outputs.cache-hit == 'true'}}
name: PRE Cache $HOME/.m2/org/opensearch/plugin/
run: ls -la $HOME/.m2/org/opensearch/plugin/


- name: Run `assemble.sh`
run: |
bash build-scripts/assemble.sh \
-a ${{ matrix.architecture }} \
-d ${{ matrix.distribution }} \
-r ${{ inputs.revision }}
- name: POST Cache /usr/share/wazuh-indexer/bin/opensearch-plugin
id: post-assemble-cache-usr-share-opensearch-plugins
uses: actions/cache@v4
with:
path: |
./usr/share/wazuh-indexer/bin/opensearch-plugin
key: ${{ runner.os }}-usr-share-opensearch-${{ hashFiles('**.jar') }}
restore-keys: |
${{ runner.os }}-usr-share-opensearch-
${{ runner.os }}-usr-share-opensearch
- if: ${{steps.post-assemble-cache-usr-share-opensearch-plugins.outputs.cache-hit == 'true'}}
name: POST Cache /usr/share/wazuh-indexer/bin/opensearch-plugin success
run: ls -la ./usr/share/wazuh-indexer/bin/opensearch-plugin


- name: POST Cache ~/.m2/repository/org/opensearch
id: post-assemble-cache-m2-repository-opensearch-plugins
uses: actions/cache@v4
Expand All @@ -364,23 +315,6 @@ jobs:
name: POST Cache ~/.m2/repository/org/opensearch success
run: ls -la ~/.m2/repository/org/opensearch


- name: POST Cache $HOME/.m2/org/opensearch/plugin/
id: post-assemble-cache-home-m2-opensearch-plugins
uses: actions/cache@v4
with:
path: |
$HOME/.m2/org/opensearch/plugin/
key: ${{ runner.os }}-home-m2-opensearch-${{ hashFiles('**.xml') }}
restore-keys: |
${{ runner.os }}-home-m2-opensearch-
${{ runner.os }}-home-m2-opensearch
- if: ${{steps.pre-assemble-cache-home-m2-opensearch-plugins.outputs.cache-hit == 'true'}}
name: POST Cache $HOME/.m2/org/opensearch/plugin/
run: ls -la $HOME/.m2/org/opensearch/plugin/


- name: Test RPM package
if: ${{ matrix.distribution == 'rpm' }}
uses: addnab/docker-run-action@v3
Expand Down
7 changes: 4 additions & 3 deletions build-scripts/assemble.sh
Original file line number Diff line number Diff line change
Expand Up @@ -226,18 +226,19 @@ function enable_performance_analyzer_rca() {
function install_plugins() {
echo "Installing OpenSearch plugins"
local maven_repo_local="$HOME/.m2"
echo "Content of .m2/repository/org/opensearch/"
ls la "~/.m2/repository/org/opensearch/"
for plugin in "${plugins[@]}"; do
echo "Plugin ${plugin}, version ${VERSION}"
local plugin_from_maven="org.opensearch.plugin:${plugin}:${VERSION}.0"

if [[ -f "${maven_repo_local}/org/opensearch/plugin/${plugin}/${VERSION}.0/${plugin}-${VERSION}.0.zip" ]]; then
if [[ -f "~/.m2/repository/org/opensearch/${plugin}/${VERSION}.0/${plugin}-${VERSION}.0.pom" ]]; then
echo "Plugin ${plugin} is already present, download omitted."
else
echo "Downloand ${plugin} plugin."
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"
fi
echo "Path TO CACHE ${PATH_BIN}/opensearch-plugin and OPENSEARCH_PATH_CONF=$PATH_CONF"
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

echo "Installing Wazuh plugins"
Expand Down

0 comments on commit d2cdd36

Please sign in to comment.