-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* migrate wazuh cypress * deleted workflow * updated workflow for docker images * deleted reports files * updated workflows * update workflow * added new files * Delete .DS_Store * changed directory * updated dockerfile * add test cases and fix for PR 4418 and 4416 for directory changes (#4432) * add test cases and fix for PR 4418 and 4416 for directory changes * rollback decoders.page.js file for wzd Co-authored-by: mauceballos <[email protected]>
- Loading branch information
1 parent
d6ea40a
commit e856b0b
Showing
225 changed files
with
22,520 additions
and
133 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
# This is a basic workflow that is manually triggered | ||
|
||
name: Cypress automation test - [basic] | ||
|
||
# Controls when the action will run. Workflow runs when manually triggered using the UI | ||
# or API. | ||
on: | ||
workflow_dispatch: | ||
# Inputs the workflow accepts. | ||
inputs: | ||
wazuh-version: | ||
description: 'Wazuh Version' | ||
default: 'v4.3.4' | ||
required: true | ||
elastic-version: | ||
description: 'Elastic Version' | ||
default: '7.16.3' | ||
required: true | ||
ubuntu-cypress-version: | ||
description: 'Ubuntu Cypress Version' | ||
default: '3.0.0' | ||
required: true | ||
url-package: | ||
description: 'Package Download Url' | ||
required: false | ||
default: 'https://packages-dev.wazuh.com/pre-release/ui/kibana/wazuh_kibana-4.3.4_7.16.3-1.zip' | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
setup-wazuh-kibana-app: | ||
name: Run setup environment wazuh kibana app | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Step 01 - Set up environment variables | ||
run: | | ||
echo "PATH_TEMPLATE=$GITHUB_WORKSPACE/wazuh-app-environments/templates_elastic_prod/es_basic-wz_cluster-agent/" >> $GITHUB_ENV | ||
echo "Information about the workflow (basic): | ||
wazuh-version: ${{ github.event.inputs.wazuh-version }} | ||
elastic-version: ${{ github.event.inputs.elastic-version }} | ||
ubuntu-cypress-version: ${{ github.event.inputs.ubuntu-cypress-version }} | ||
url-package: ${{ github.event.inputs.url-package }}" | ||
- name: Step 02 - Download Project wazuh-app-environments | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: matiasmoreno876/wazuh-app-environments | ||
ref: 'master' | ||
path: wazuh-app-environments | ||
token: ${{ secrets.FE_SECRET_TOKEN }} | ||
- name: Step 03 - Configuring templates docker environment | ||
run: | | ||
cd $GITHUB_WORKSPACE/wazuh-app-environments/ | ||
mkdir packages | ||
cd ${{ env.PATH_TEMPLATE }} | ||
sed -i -e 's|WAZUH_VERSION=.*|WAZUH_VERSION=${{ github.event.inputs.wazuh-version }}|g' ./.env | ||
sed -i -e 's|ELASTIC_VERSION=.*|ELASTIC_VERSION=${{ github.event.inputs.elastic-version }}|g' ./.env | ||
sed -i -e 's|UBUNTU_CYPRESS_VERSION=.*|UBUNTU_CYPRESS_VERSION=${{ github.event.inputs.ubuntu-cypress-version }}|g' ./.env | ||
cat .env | ||
- name: Step 04 - Starting containers | ||
run: | | ||
cd ${{ env.PATH_TEMPLATE }} | ||
docker-compose up -d | ||
echo CONTINUES AFTER 15 SECONDS ... | ||
sleep 15s | ||
- name: Step 05 - Installing package from url | ||
run: | | ||
cd ${{ env.PATH_TEMPLATE }} | ||
docker exec $(docker-compose ps -q kibana) bin/kibana-plugin install ${{ github.event.inputs.url-package }} | ||
docker-compose restart kibana | ||
echo CONTINUES AFTER 60 SECONDS ... | ||
sleep 60s | ||
docker-compose ps | ||
- name: Step 06 - Configuring ip container into wazuh.yml | ||
run: | | ||
cd ${{ env.PATH_TEMPLATE }} | ||
docker exec $(docker-compose ps -q kibana) sed -i -e "s/url: https:\/\/localhost/url: https:\/\/wazuh-manager-master/g" /usr/share/kibana/data/wazuh/config/wazuh.yml | ||
docker exec $(docker-compose ps -q kibana) cat /usr/share/kibana/data/wazuh/config/wazuh.yml | ||
- name: Step 07 - Run Cypress tests | ||
id: run-cypress-test | ||
run: | | ||
cd ${{ env.PATH_TEMPLATE }} | ||
docker exec $(docker-compose ps -q cypress) bash -c " . /home/automation/nvm/nvm.sh && nvm use && npm run cypress:run-headless:github-actions:basic" | tee cypress.log | ||
continue-on-error: true | ||
- name: Step 08 - Run Cypress reports | ||
run: | | ||
cd ${{ env.PATH_TEMPLATE }} | ||
docker exec $(docker-compose ps -q cypress) bash -c " . /home/automation/nvm/nvm.sh && nvm use && npm run cypress:report" | ||
docker exec $(docker-compose ps -q cypress) bash -c "cp -R /home/automation/wazuh-cypress/cypress/* /home/automation/wazuh-cypress/cypress-slack" | ||
- name: Step 09 - Archive reports | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: cypress-reports_BASIC_${{ github.event.inputs.wazuh-version }}-${{ github.event.inputs.elastic-version }} | ||
path: ${{ env.PATH_TEMPLATE }}/report/* | ||
- name: Step 10 - Log parsing | ||
run: | | ||
cd ${{ env.PATH_TEMPLATE }} | ||
echo "TEST_SKIPPED=$(grep -E "failed \(|passed" cypress.log | awk ' { print $(NF)}')" >> $GITHUB_ENV | ||
echo "TEST_PENDING=$(grep -E "failed \(|passed" cypress.log | awk ' { print $(NF-1)}')" >> $GITHUB_ENV | ||
echo "TEST_FAILING=$(grep -E "failed \(|passed" cypress.log | awk ' { print $(NF-2)}')" >> $GITHUB_ENV | ||
echo "TEST_PASSING=$(grep -E "failed \(|passed" cypress.log | awk ' { print $(NF-3)}')" >> $GITHUB_ENV | ||
echo "TEST_TOTAL=$(grep -E "failed \(|passed" cypress.log | awk ' { print $(NF-4)}')" >> $GITHUB_ENV | ||
echo "TEST_TIME=$(grep -E "failed \(|passed" cypress.log | awk ' { print $(NF-5)}')" >> $GITHUB_ENV | ||
- name: Step 11 - Post to a Slack channel | ||
id: slack | ||
uses: slackapi/[email protected] | ||
with: | ||
# Slack channel id, channel name, or user id to post message. | ||
# See also: https://api.slack.com/methods/chat.postMessage#channels | ||
channel-id: ${{ secrets.SLACK_CHANNEL_ID }} | ||
# For posting a simple plain text message | ||
slack-message: "The following workflow was executed: ${{ github.workflow }}\nWazuh version: ${{ github.event.inputs.wazuh-version }}\nElastic version: ${{ github.event.inputs.elastic-version }}\nUbuntu Cypress version: ${{ github.event.inputs.ubuntu-cypress-version }}\nPackage used: ${{ github.event.inputs.url-package }}\n\nTest summary:\n\tTotal Test: ${{ env.TEST_TOTAL }}\n\tPassing: ${{ env.TEST_PASSING }}\n\tFailing: ${{ env.TEST_FAILING }}\n\tPending: ${{ env.TEST_PENDING }}\n\tSkipped: ${{ env.TEST_SKIPPED }}\n\tTotal Time: ${{ env.TEST_TIME }}\n\nFor more information visit: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.ACTIONS_SLACK_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# This is a basic workflow that is manually triggered | ||
|
||
name: Cypress automation test - [odfe] | ||
|
||
# Controls when the action will run. Workflow runs when manually triggered using the UI | ||
# or API. | ||
on: | ||
workflow_dispatch: | ||
# Inputs the workflow accepts. | ||
inputs: | ||
wazuh-version: | ||
description: 'Wazuh Version' | ||
default: 'v4.3.4' | ||
required: true | ||
elastic-version: | ||
description: 'Elastic Version' | ||
default: '7.10.2' | ||
required: true | ||
odfe-version: | ||
description: 'ODFE Version' | ||
default: '1.13.2' | ||
required: true | ||
ubuntu-cypress-version: | ||
description: 'Ubuntu Cypress Version' | ||
default: '3.0.0' | ||
required: true | ||
url-package: | ||
description: 'Package Download Url' | ||
required: false | ||
default: 'https://packages-dev.wazuh.com/pre-release/ui/kibana/wazuh_kibana-4.3.4_7.16.3-1.zip' | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
setup-wazuh-kibana-app: | ||
name: Run setup environment wazuh kibana app | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Step 01 - Set up environment variables | ||
run: | | ||
echo "PATH_TEMPLATE=$GITHUB_WORKSPACE/wazuh-app-environments/templates_elastic_prod/es_odfe-wz_cluster-agent/" >> $GITHUB_ENV | ||
echo "Information about the workflow (odfe): | ||
wazuh-version: ${{ github.event.inputs.wazuh-version }} | ||
elastic-version: ${{ github.event.inputs.elastic-version }} | ||
odfe-version: ${{ github.event.inputs.odfe-version }} | ||
ubuntu-cypress-version: ${{ github.event.inputs.ubuntu-cypress-version }} | ||
url-package: ${{ github.event.inputs.url-package }}" | ||
- name: Step 02 - Download Project wazuh-app-environments | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: matiasmoreno876/wazuh-app-environments | ||
ref: 'master' | ||
path: wazuh-app-environments | ||
token: ${{ secrets.FE_SECRET_TOKEN }} | ||
- name: Step 03 - Configuring templates docker environment | ||
run: | | ||
cd $GITHUB_WORKSPACE/wazuh-app-environments/ | ||
mkdir packages | ||
cd ${{ env.PATH_TEMPLATE }} | ||
sed -i -e 's|WAZUH_VERSION=.*|WAZUH_VERSION=${{ github.event.inputs.wazuh-version }}|g' ./.env | ||
sed -i -e 's|ELASTIC_VERSION=.*|ELASTIC_VERSION=${{ github.event.inputs.elastic-version }}|g' ./.env | ||
sed -i -e 's|ODFE_VERSION=.*|ODFE_VERSION=${{ github.event.inputs.odfe-version }}|g' ./.env | ||
sed -i -e 's|UBUNTU_CYPRESS_VERSION=.*|UBUNTU_CYPRESS_VERSION=${{ github.event.inputs.ubuntu-cypress-version }}|g' ./.env | ||
cat .env | ||
- name: Step 04 - Starting containers | ||
run: | | ||
cd ${{ env.PATH_TEMPLATE }} | ||
docker-compose up -d | ||
echo CONTINUES AFTER 15 SECONDS ... | ||
sleep 15s | ||
- name: Step 05 - Installing package from url | ||
run: | | ||
cd ${{ env.PATH_TEMPLATE }} | ||
docker exec $(docker-compose ps -q kibana) bin/kibana-plugin install ${{ github.event.inputs.url-package }} | ||
docker-compose restart kibana | ||
echo CONTINUES AFTER 60 SECONDS ... | ||
sleep 60s | ||
docker-compose ps | ||
- name: Step 06 - Configuring ip container into wazuh.yml | ||
run: | | ||
cd ${{ env.PATH_TEMPLATE }} | ||
docker exec $(docker-compose ps -q kibana) sed -i -e "s/url: https:\/\/localhost/url: https:\/\/wazuh-manager-master/g" /usr/share/kibana/data/wazuh/config/wazuh.yml | ||
docker exec $(docker-compose ps -q kibana) cat /usr/share/kibana/data/wazuh/config/wazuh.yml | ||
- name: Step 07 - Run Cypress tests | ||
id: run-cypress-test | ||
run: | | ||
cd ${{ env.PATH_TEMPLATE }} | ||
docker exec $(docker-compose ps -q cypress) bash -c " . /home/automation/nvm/nvm.sh && nvm use && npm run cypress:run-headless:github-actions:odfe" | tee cypress.log | ||
continue-on-error: true | ||
- name: Step 08 - Run Cypress reports | ||
run: | | ||
cd ${{ env.PATH_TEMPLATE }} | ||
docker exec $(docker-compose ps -q cypress) bash -c " . /home/automation/nvm/nvm.sh && nvm use && npm run cypress:report" | ||
docker exec $(docker-compose ps -q cypress) bash -c "cp -R /home/automation/wazuh-cypress/cypress/* /home/automation/wazuh-cypress/cypress-slack" | ||
- name: Step 09 - Archive reports | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: cypress-reports_ODFE_${{ github.event.inputs.wazuh-version }}-${{ github.event.inputs.odfe-version }}-${{ github.event.inputs.elastic-version }} | ||
path: ${{ env.PATH_TEMPLATE }}/report/* | ||
- name: Step 10 - Log parsing | ||
run: | | ||
cd ${{ env.PATH_TEMPLATE }} | ||
echo "TEST_SKIPPED=$(grep -E "failed \(|passed" cypress.log | awk ' { print $(NF)}')" >> $GITHUB_ENV | ||
echo "TEST_PENDING=$(grep -E "failed \(|passed" cypress.log | awk ' { print $(NF-1)}')" >> $GITHUB_ENV | ||
echo "TEST_FAILING=$(grep -E "failed \(|passed" cypress.log | awk ' { print $(NF-2)}')" >> $GITHUB_ENV | ||
echo "TEST_PASSING=$(grep -E "failed \(|passed" cypress.log | awk ' { print $(NF-3)}')" >> $GITHUB_ENV | ||
echo "TEST_TOTAL=$(grep -E "failed \(|passed" cypress.log | awk ' { print $(NF-4)}')" >> $GITHUB_ENV | ||
echo "TEST_TIME=$(grep -E "failed \(|passed" cypress.log | awk ' { print $(NF-5)}')" >> $GITHUB_ENV | ||
- name: Step 11 - Post to a Slack channel | ||
id: slack | ||
uses: slackapi/[email protected] | ||
with: | ||
# Slack channel id, channel name, or user id to post message. | ||
# See also: https://api.slack.com/methods/chat.postMessage#channels | ||
channel-id: ${{ secrets.SLACK_CHANNEL_ID }} | ||
# For posting a simple plain text message | ||
slack-message: "The following workflow was executed: ${{ github.workflow }}\nWazuh version: ${{ github.event.inputs.wazuh-version }}\nElastic version: ${{ github.event.inputs.elastic-version }}\nODFE version: ${{ github.event.inputs.odfe-version }}\nUbuntu Cypress version: ${{ github.event.inputs.ubuntu-cypress-version }}\nPackage used: ${{ github.event.inputs.url-package }}\n\nTest summary:\n\tTotal Test: ${{ env.TEST_TOTAL }}\n\tPassing: ${{ env.TEST_PASSING }}\n\tFailing: ${{ env.TEST_FAILING }}\n\tPending: ${{ env.TEST_PENDING }}\n\tSkipped: ${{ env.TEST_SKIPPED }}\n\tTotal Time: ${{ env.TEST_TIME }}\n\nFor more information visit: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.ACTIONS_SLACK_TOKEN }} |
Oops, something went wrong.