Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add package test #6508

Merged
merged 2 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

Loading