Skip to content

Commit

Permalink
Add package test (#6508)
Browse files Browse the repository at this point in the history
  • Loading branch information
yenienserrano authored Mar 15, 2024
1 parent d5636a8 commit be39ae4
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/manual-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,35 @@ jobs:
command: 'yarn build'
artifact_name: 'wazuh-dashboard-plugins'
secrets: inherit

test-packages:
needs: build
name: Test packages
runs-on: ubuntu-latest

steps:
- name: Step 01 - Download the plugin's source code
uses: actions/checkout@v3
with:
repository: wazuh/wazuh-dashboard-plugins
ref: ${{ inputs.reference }}
path: wazuh

- name: Step 02 - Get version and revision
run: |
echo "currentDir=$(pwd -P)" >> $GITHUB_ENV
echo "version=$(jq -r '.version' $(pwd)/wazuh/plugins/main/package.json)" >> $GITHUB_ENV
echo "revision=$(jq -r '.revision' $(pwd)/wazuh/plugins/main/package.json)" >> $GITHUB_ENV
echo "versionPlatform=$(jq -r '.pluginPlatform.version' $(pwd)/wazuh/plugins/main/package.json)" >> $GITHUB_ENV
- name: Step 03 - Download the plugin's source code
uses: actions/download-artifact@v3
with:
name: wazuh-dashboard-plugins_${{ env.version }}-${{ env.revision }}_${{ inputs.reference }}.zip
path: ${{ env.currentDir }}/wazuh/scripts/test-packages/wazuh-dashboard-plugins_${{ env.version }}-${{ env.revision }}_${{ inputs.reference }}.zip

- name: Step 04 - Build the Docker image
run: |
echo "current=${{ env.currentDir }}"
cd ./wazuh/scripts/test-packages
docker build --build-arg OSD_VERSION=${{ env.versionPlatform }} --build-arg PACKAGE_NAME=wazuh-dashboard-plugins_${{ env.version }}-${{ env.revision }}_${{ inputs.reference }}.zip -f osd-test-packages.Dockerfile ./
6 changes: 6 additions & 0 deletions scripts/test-packages/install-plugins.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
plugins=$(ls /tmp)
echo $plugins
for plugin in $plugins; do
echo $plugin
/usr/share/opensearch-dashboards/bin/opensearch-dashboards-plugin install file:///tmp/$plugin
done
21 changes: 21 additions & 0 deletions scripts/test-packages/osd-test-packages.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# docker build --build-arg OSD_VERSION=2.12.0 --build-arg PACKAGE_NAME=wazuh-2.12.0.zip -t test-packages -f osd-test-packages.Dockerfile ./

ARG OSD_VERSION

FROM opensearchproject/opensearch-dashboards:${OSD_VERSION}

ARG PACKAGE_NAME

ADD ./${PACKAGE_NAME} /tmp/
# This is needed to run it local
#
# USER root
# RUN yum update -y && yum install -y unzip
# RUN unzip /tmp/${PACKAGE_NAME} -d /tmp/
# RUN rm /tmp/${PACKAGE_NAME}
# USER opensearch-dashboards
#
COPY --chown=opensearch-dashboards ./install-plugins.sh /
RUN chmod +x /install-plugins.sh
RUN /install-plugins.sh

0 comments on commit be39ae4

Please sign in to comment.