Skip to content

Commit

Permalink
Merge branch '4.3-7.10' of github.com:wazuh/wazuh-kibana-app into clo…
Browse files Browse the repository at this point in the history
…ud/4.3-7.10
  • Loading branch information
matiasmoreno876 committed May 6, 2022
2 parents 0f8c255 + 52580b8 commit a9e7d31
Show file tree
Hide file tree
Showing 1,017 changed files with 42,559 additions and 18,569 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/create-wazuh-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: create-wazuh-packages
on:
workflow_dispatch:
inputs:
wazuh_kibana_app_branch:
description: 'Branch Kibana App'
required: true
wazuh_packages_branch:
description: 'Branch Wazuh Packages'
required: true
default: '4.3'
jobs:
setup-wazuh-kibana-app:
name: Run setup environment wazuh kibana app
runs-on: ubuntu-18.04
steps:
- name: Step 01 - Set up environment
run: |
mkdir packages
- name: Step 02 - Download project wazuh-packages
uses: actions/checkout@v2
with:
repository: wazuh/wazuh-packages
ref: ${{ github.event.inputs.wazuh_packages_branch }}
path: wazuh-packages
- name: Step 03 - Building package
run: |
plugin_platform_directory="kibana"
echo "[info] checking the platform for the plugin..."
response_status=$(curl --silent -o /dev/null -w "%{http_code}" https://raw.githubusercontent.com/wazuh/wazuh-kibana-app/${{ github.event.inputs.wazuh_kibana_app_branch }}/.opensearch_dashboards-plugin-helpers.json)
[ "$response_status" = "200" ] && { plugin_platform_directory="opensearch-dashboards"; }
echo "[info] platform: $plugin_platform_directory"
echo "[info] changing the directory to $GITHUB_WORKSPACE/wazuh-packages/wazuhapp/$plugin_platform_directory"
cd $GITHUB_WORKSPACE/wazuh-packages/wazuhapp/$plugin_platform_directory
echo "[info] running script to generate the plugin package"
./generate_wazuh_app.sh -b ${{ github.event.inputs.wazuh_kibana_app_branch }} -s $GITHUB_WORKSPACE/packages -r 1
- name: Archive packages
uses: actions/upload-artifact@v2
with:
name: wazuh-packages
path: ${{ github.workspace }}/packages/*
130 changes: 130 additions & 0 deletions .github/workflows/cypress-automation-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Cypress Automation Tests

on:
push:
branches:
- 'disable'
pull_request:
branches:
- '*.*-*.*'

jobs:
setup-wazuh-kibana-app:
name: Run setup environment wazuh kibana app
#runs-on: self-hosted
runs-on: ubuntu-18.04
#container: cypress/browsers:node12.18.0-chrome83-ff77
steps:
- name: Step 01 - Set up environment variables
env:
SHOULD_TEST: ${{ contains(github.event.pull_request.body, 'SHOULD_TEST=TRUE') }}
run: |
if ${SHOULD_TEST} == true; then
echo Base Branch: ${{ github.base_ref }}
echo Head Branch: ${{ github.head_ref }}
echo Run Test TRUE
echo "RUN_TEST=true" >> $GITHUB_ENV
echo "WAZUH_HEAD_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
echo "${{ github.event.pull_request.body }}" > pull_request.body.txt
echo "WAZUH_MANAGER_IMAGE=$(grep 'WAZUH_MANAGER_IMAGE=*' ./pull_request.body.txt | cut -d '=' -f2)" >> $GITHUB_ENV
echo "WAZUH_AGENT_IMAGE=$(grep 'WAZUH_AGENT_IMAGE=*' ./pull_request.body.txt | cut -d '=' -f2)" >> $GITHUB_ENV
echo "WAZUH_VERSION=$(grep 'WAZUH_VERSION=*' ./pull_request.body.txt | cut -d '=' -f2)" >> $GITHUB_ENV
echo "ELASTIC_VERSION=$(grep 'ELASTIC_VERSION=*' ./pull_request.body.txt | cut -d '=' -f2)" >> $GITHUB_ENV
echo "PATH_TEMPLATE_BASIC_CLUSTER_AGENT=$GITHUB_WORKSPACE/wazuh-app-environments/templates_elastic_prod/es_basic-wz_cluster-agent/" >> $GITHUB_ENV
else
echo Run Test FALSE
echo "RUN_TEST=false" >> $GITHUB_ENV
fi
- name: Step 02 - Download Project wazuh-app-environments
if: ${{ env.RUN_TEST == 'true' }}
uses: actions/checkout@v2
with:
repository: frankeros/wazuh-app-environments
ref: 'master'
path: wazuh-app-environments
token: ${{ secrets.ENV_TEMPLATES_TOKEN }}
- name: Step 03 - Configuring templates docker environment
if: ${{ env.RUN_TEST == 'true'}}
run: |
cd $GITHUB_WORKSPACE/wazuh-app-environments/
mkdir packages
cd ${{ env.PATH_TEMPLATE_BASIC_CLUSTER_AGENT }}
sed -i -e "s/WAZUH_MANAGER_IMAGE=.*/WAZUH_MANAGER_IMAGE=${{ env.WAZUH_MANAGER_IMAGE }}/g" ./.env
sed -i -e "s/WAZUH_AGENT_IMAGE=.*/WAZUH_AGENT_IMAGE=${{ env.WAZUH_AGENT_IMAGE }}/g" ./.env
sed -i -e "s/WAZUH_VERSION=.*/WAZUH_VERSION=${{ env.WAZUH_VERSION }}/g" ./.env
sed -i -e "s/ELASTIC_VERSION=.*/ELASTIC_VERSION=${{ env.ELASTIC_VERSION }}/g" ./.env
cat .env
- name: Step 04 - Starting containers
if: ${{ env.RUN_TEST == 'true'}}
run: |
cd ${{ env.PATH_TEMPLATE_BASIC_CLUSTER_AGENT }}
sudo docker-compose up -d
- name: Step 05 - Download Project wazuh-packages
if: ${{ env.RUN_TEST == 'true' }}
uses: actions/checkout@v2
with:
repository: wazuh/wazuh-packages
ref: '4.2'
path: wazuh-packages
- name: Step 06 - Building package
if: ${{ env.RUN_TEST == 'true' }}
run: |
cd $GITHUB_WORKSPACE/wazuh-packages/wazuhapp
echo fixing command...
sed -i -e 's/'\|' cut -d \"\/\" \-f2//g' ./generate_wazuh_app.sh
echo run command...
./generate_wazuh_app.sh -b ${{ env.WAZUH_HEAD_BRANCH }} -s $GITHUB_WORKSPACE/wazuh-app-environments/packages -r 1
- name: Step 07 - Installing package
if: ${{ env.RUN_TEST == 'true' }}
run: |
cd $GITHUB_WORKSPACE/wazuh-app-environments/packages/
PACKAGE_NAME=`ls *.zip`
cd ${{ env.PATH_TEMPLATE_BASIC_CLUSTER_AGENT }}
docker exec es_basic-wz_cluster-agent_kibana_1 bin/kibana-plugin install file:///packages/$PACKAGE_NAME
sudo docker-compose restart kibana
echo CONTINUES AFTER 20 SECONDS ...
sleep 20s
- name: Step 08 - Configuring ip container into wazuh.yml
if: ${{ env.RUN_TEST == 'true' }}
run: |
IP_CONTAINER_MANAGER=$(docker exec es_basic-wz_cluster-agent_wazuh-manager-master_1 hostname -i)
docker exec es_basic-wz_cluster-agent_kibana_1 cat ./data/wazuh/config/wazuh.yml
docker exec es_basic-wz_cluster-agent_kibana_1 sed -i -e "s/url: https:\/\/localhost/url: https:\/\/$IP_CONTAINER_MANAGER/g" ./data/wazuh/config/wazuh.yml
docker exec es_basic-wz_cluster-agent_kibana_1 cat ./data/wazuh/config/wazuh.yml
- name: Step 09 - Download Project wazuh-qa
if: ${{ env.RUN_TEST == 'true' }}
uses: actions/checkout@v2
with:
repository: wazuh/wazuh-qa
ref: 'feature/frontend'
path: wazuh-qa
- name: Step 10 - Install Cypress Project Dependencies
if: ${{ env.RUN_TEST == 'true' }}
run: |
cd $GITHUB_WORKSPACE/wazuh-qa/tests/frontend/test_kibana_app/
npm install
npm run cy:install
- name: Step 11 - Run Cypress tests
if: ${{ env.RUN_TEST == 'true' }}
run: |
cd $GITHUB_WORKSPACE/wazuh-qa/tests/frontend/test_kibana_app/
npm run cypress:run-headless
# continue-on-error: true
- name: Step 12 - Upload Screenshots And Videos To Slack
if: failure()
uses: trymbill/[email protected]
with:
workdir: wazuh-qa/tests/frontend/test_kibana_app/cypress
token: ${{ secrets.ACTIONS_SLACK_TOKEN }}
channels: 'daily-app-team'
message-text: ${{ format('Workflow "{0}" job test triggered by {1} is FAILED for {2} - {3}', github.workflow, github.event_name, github.base_ref, github.head_ref) }}
73 changes: 73 additions & 0 deletions .github/workflows/wazuh-unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Wazuh Unit Tests

on:
push:
branches:
- 'disable'
pull_request:
branches:
- '4.3-7.10'

jobs:
setup-wazuh-app:
name: Run setup environment wazuh app
runs-on: ubuntu-18.04
env:
NODE_10-23-1: '10.23.1'
NODE_12-22-3: '12.22.3'
YARN_1-21-1: '1.21.1'
KIBANA_TAG: 'v7.10.2'
steps:
- name: Step 01 - Download Project kibana
uses: actions/checkout@v2
with:
repository: elastic/kibana
ref: ${{ env.KIBANA_TAG }}
path: kibana

- name: Step 02 - Setup node for kibana app
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_10-23-1 }}

- name: Step 03 - Install dependencies of kibana
run: |
cd kibana
yarn set version ${{ env.YARN_1-21-1 }}
yarn kbn bootstrap
mkdir plugins/wazuh-kibana-app
- name: Step 04 - Download Project wazuh-app
uses: actions/checkout@v2
with:
path: kibana/plugins/wazuh-kibana-app

- name: Step 05 - Setup node version for wazuh app
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_12-22-3 }}

- name: Step 06 - Install dependencies of wazuh
run: |
cd kibana/plugins/wazuh-kibana-app/
yarn install
- name: Step 07 - Setup node for Jest
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_10-23-1 }}

- name: Step 08 - Run Tests & Collect Coverage
run: |
cd ./kibana/plugins/wazuh-kibana-app
yarn run test:jest --colors
- name: Step 09 - Comment Test Coverage
uses: AthleticNet/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
path: ./kibana/plugins/wazuh-kibana-app/target/test-coverage/coverage-summary.json
title: Jest Test Coverage
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10.23.1
Loading

0 comments on commit a9e7d31

Please sign in to comment.