diff --git a/.github/actions/comment-test-coverage/README.md b/.github/actions/comment-test-coverage/README.md index e86b5f2238..b20a220ab1 100644 --- a/.github/actions/comment-test-coverage/README.md +++ b/.github/actions/comment-test-coverage/README.md @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Code - uses: actions/checkout@v1 + uses: actions/checkout@v4 - name: Run Jasmine tests run: npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 0b144db595..d6623591c4 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -9,11 +9,11 @@ # the `language` matrix defined below to confirm you have the correct set of # supported CodeQL languages. # -name: "CodeQL" +name: 'CodeQL' on: schedule: - - cron: '0 8 * * *' + - cron: '0 8 * * *' workflow_dispatch: jobs: @@ -28,45 +28,44 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'javascript' ] + language: ['javascript'] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # Use only 'java' to analyze code written in Java, Kotlin or both # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support steps: - - name: Checkout repository - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v4 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 - with: - category: "/language:${{matrix.language}}" + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: '/language:${{matrix.language}}' diff --git a/.github/workflows/cypress-basic.yml b/.github/workflows/cypress-basic.yml index e0465d7e2c..d8c6725c5e 100644 --- a/.github/workflows/cypress-basic.yml +++ b/.github/workflows/cypress-basic.yml @@ -12,18 +12,18 @@ on: description: 'Wazuh Version' default: 'v4.3.4' required: true - elastic-version: + elastic-version: description: 'Elastic Version' default: '7.16.3' required: true - ubuntu-cypress-version: + 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' + 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: @@ -31,83 +31,85 @@ jobs: name: Run setup environment wazuh kibana app runs-on: ubuntu-latest 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 + - 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" - - 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/slack-github-action@v1.19.0 - with: + 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@v4 + 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" + - name: Step 09 - Archive reports + uses: actions/upload-artifact@v4 + with: + name: cypress-reports_BASIC_${{ github.event.inputs.wazuh-version }}-${{ github.event.inputs.elastic-version }} + path: ${{ env.PATH_TEMPLATE }}/report/* + overwrite: true + - 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/slack-github-action@v1.19.0 + 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 }} \ No newline at end of file + 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 }} diff --git a/.github/workflows/cypress-odfe.yml b/.github/workflows/cypress-odfe.yml index e95263a91a..241c8e9cd1 100644 --- a/.github/workflows/cypress-odfe.yml +++ b/.github/workflows/cypress-odfe.yml @@ -12,22 +12,22 @@ on: description: 'Wazuh Version' default: 'v4.3.4' required: true - elastic-version: + elastic-version: description: 'Elastic Version' default: '7.10.2' required: true - odfe-version: + odfe-version: description: 'ODFE Version' default: '1.13.2' required: true - ubuntu-cypress-version: + 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' + 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: @@ -35,85 +35,87 @@ jobs: name: Run setup environment wazuh kibana app runs-on: ubuntu-latest 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 + - 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" - - 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/slack-github-action@v1.19.0 - with: + 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@v4 + 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" + - name: Step 09 - Archive reports + uses: actions/upload-artifact@v4 + 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/* + overwrite: true + - 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/slack-github-action@v1.19.0 + 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 }} \ No newline at end of file + 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 }} diff --git a/.github/workflows/cypress-wzd.yml b/.github/workflows/cypress-wzd.yml index 8e0b051142..b4abd30034 100644 --- a/.github/workflows/cypress-wzd.yml +++ b/.github/workflows/cypress-wzd.yml @@ -12,14 +12,14 @@ on: description: 'Wazuh Stack Version' default: '4.3.4' required: true - ubuntu-cypress-version: + 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/dashboard/wazuh-4.3.4-1.zip' + required: false + default: 'https://packages-dev.wazuh.com/pre-release/ui/dashboard/wazuh-4.3.4-1.zip' # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: @@ -27,84 +27,86 @@ jobs: name: Run setup environment wazuh dashboard app runs-on: ubuntu-latest steps: - - name: Step 01 - Set up environment variables - run: | - echo "PATH_TEMPLATE=$GITHUB_WORKSPACE/wazuh-app-environments/templates_wazuh_prod/" >> $GITHUB_ENV + - name: Step 01 - Set up environment variables + run: | + echo "PATH_TEMPLATE=$GITHUB_WORKSPACE/wazuh-app-environments/templates_wazuh_prod/" >> $GITHUB_ENV - echo "Information about the workflow (wzd): - wazuh-stack-version: ${{ github.event.inputs.wazuh-stack-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_STACK_VERSION=.*|WAZUH_STACK_VERSION=${{ github.event.inputs.wazuh-stack-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 30 SECONDS ... - sleep 30s - - name: Step 05 - Remove Wazuh - run: | - cd ${{ env.PATH_TEMPLATE }} - docker exec $(docker-compose ps -q wazuh.dashboard) bin/opensearch-dashboards-plugin remove wazuh - docker-compose restart wazuh.dashboard - echo CONTINUES AFTER 30 SECONDS ... - sleep 30s - docker-compose ps - - name: Step 06 - Installing package from url - run: | - cd ${{ env.PATH_TEMPLATE }} - docker exec $(docker-compose ps -q wazuh.dashboard) bin/opensearch-dashboards-plugin install ${{ github.event.inputs.url-package }} - docker-compose restart wazuh.dashboard - echo CONTINUES AFTER 60 SECONDS ... - sleep 60s - docker-compose ps - - 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:wzd" | 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" - - name: Step 09 - Archive reports - uses: actions/upload-artifact@v2 - with: - name: cypress-reports_WZD_${{ github.event.inputs.wazuh-stack-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/slack-github-action@v1.19.0 - with: + echo "Information about the workflow (wzd): + wazuh-stack-version: ${{ github.event.inputs.wazuh-stack-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@v4 + 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_STACK_VERSION=.*|WAZUH_STACK_VERSION=${{ github.event.inputs.wazuh-stack-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 30 SECONDS ... + sleep 30s + - name: Step 05 - Remove Wazuh + run: | + cd ${{ env.PATH_TEMPLATE }} + docker exec $(docker-compose ps -q wazuh.dashboard) bin/opensearch-dashboards-plugin remove wazuh + docker-compose restart wazuh.dashboard + echo CONTINUES AFTER 30 SECONDS ... + sleep 30s + docker-compose ps + - name: Step 06 - Installing package from url + run: | + cd ${{ env.PATH_TEMPLATE }} + docker exec $(docker-compose ps -q wazuh.dashboard) bin/opensearch-dashboards-plugin install ${{ github.event.inputs.url-package }} + docker-compose restart wazuh.dashboard + echo CONTINUES AFTER 60 SECONDS ... + sleep 60s + docker-compose ps + - 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:wzd" | 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" + - name: Step 09 - Archive reports + uses: actions/upload-artifact@v4 + with: + name: cypress-reports_WZD_${{ github.event.inputs.wazuh-stack-version }} + path: ${{ env.PATH_TEMPLATE }}/report/* + overwrite: true + - 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/slack-github-action@v1.19.0 + 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 stack version: ${{ github.event.inputs.wazuh-stack-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 }} \ No newline at end of file + channel-id: + ${{ secrets.SLACK_CHANNEL_ID }} + # For posting a simple plain text message + slack-message: "The following workflow was executed: ${{ github.workflow }}\nWazuh stack version: ${{ github.event.inputs.wazuh-stack-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 }} diff --git a/.github/workflows/cypress-xpack.yml b/.github/workflows/cypress-xpack.yml index a16f888eff..aa4a46be3a 100644 --- a/.github/workflows/cypress-xpack.yml +++ b/.github/workflows/cypress-xpack.yml @@ -12,18 +12,18 @@ on: description: 'Wazuh Version' default: 'v4.3.4' required: true - elastic-version: + elastic-version: description: 'Elastic Version' default: '7.16.3' required: true - ubuntu-cypress-version: + 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' + 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: @@ -31,84 +31,86 @@ jobs: name: Run setup environment wazuh kibana app runs-on: ubuntu-latest steps: - - name: Step 01 - Set up environment variables - run: | - echo "PATH_TEMPLATE=$GITHUB_WORKSPACE/wazuh-app-environments/templates_elastic_prod/es_xpack-wz_cluster-agent/" >> $GITHUB_ENV + - name: Step 01 - Set up environment variables + run: | + echo "PATH_TEMPLATE=$GITHUB_WORKSPACE/wazuh-app-environments/templates_elastic_prod/es_xpack-wz_cluster-agent/" >> $GITHUB_ENV - echo "Information about the workflow (xpack): - 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 }} - sed -i -e 's|docker-compose exec elasticsearch|docker exec $(docker-compose ps -q elasticsearch)|g' ./setup.sh - sudo sh setup.sh - 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:xpack" | 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" - - name: Step 09 - Archive reports - uses: actions/upload-artifact@v2 - with: - name: cypress-reports_XPACK_${{ 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/slack-github-action@v1.19.0 - with: + echo "Information about the workflow (xpack): + 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@v4 + 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 }} + sed -i -e 's|docker-compose exec elasticsearch|docker exec $(docker-compose ps -q elasticsearch)|g' ./setup.sh + sudo sh setup.sh + 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:xpack" | 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" + - name: Step 09 - Archive reports + uses: actions/upload-artifact@v4 + with: + name: cypress-reports_XPACK_${{ github.event.inputs.wazuh-version }}-${{ github.event.inputs.elastic-version }} + path: ${{ env.PATH_TEMPLATE }}/report/* + overwrite: true + - 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/slack-github-action@v1.19.0 + 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 }} \ No newline at end of file + 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 }} diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index fe461b4243..0d4a01360d 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -15,6 +15,6 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Checkout Repository' - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: 'Dependency Review' - uses: actions/dependency-review-action@v2 + uses: actions/dependency-review-action@v4 diff --git a/.github/workflows/dev-environment.yml b/.github/workflows/dev-environment.yml index 1fd2f9c080..b526d86a43 100644 --- a/.github/workflows/dev-environment.yml +++ b/.github/workflows/dev-environment.yml @@ -68,7 +68,7 @@ jobs: steps: - name: Step 01 - Download the plugin's source code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: wazuh/wazuh-dashboard-plugins ref: ${{ inputs.reference }} @@ -115,11 +115,12 @@ jobs: - name: Step 04 - Upload artifact to GitHub if: ${{ inputs.artifact_name && inputs.artifact_path }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ inputs.artifact_name }}_${{ env.version }}-${{ env.revision }}_${{ inputs.reference }}.zip path: ${{ matrix.plugins.path }}/${{ inputs.artifact_path }} if-no-files-found: 'error' + overwrite: true - name: Step 05 - Upload coverage results to GitHub if: ${{ inputs.notify_jest_coverage_summary && github.event_name == 'pull_request' }} diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index 38954d9028..a5cf29df76 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -19,11 +19,11 @@ jobs: steps: # https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 # - https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#node-version-file - name: Install NodeJS - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' diff --git a/.github/workflows/manual-build.yml b/.github/workflows/manual-build.yml index 4452e637dd..a42e4e4566 100644 --- a/.github/workflows/manual-build.yml +++ b/.github/workflows/manual-build.yml @@ -39,7 +39,7 @@ jobs: steps: - name: Step 01 - Download the plugin's source code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: wazuh/wazuh-dashboard-plugins ref: ${{ inputs.reference }} @@ -53,10 +53,11 @@ jobs: 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 + uses: actions/download-artifact@v4 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 + overwrite: true - name: Step 04 - Build the Docker image run: | diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 23de4aa1e6..4e62af22ed 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -10,11 +10,11 @@ jobs: steps: # https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 # - https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#node-version-file - name: Install NodeJS - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' diff --git a/.github/workflows/wazuh-build-push-docker-action.yml b/.github/workflows/wazuh-build-push-docker-action.yml index 74be8e29e1..e6cbcd66e2 100644 --- a/.github/workflows/wazuh-build-push-docker-action.yml +++ b/.github/workflows/wazuh-build-push-docker-action.yml @@ -56,7 +56,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Step 01 - Download wazuh-kibana-app - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: wazuh-kibana-app - name: Step 02 - Login to quay.io @@ -80,7 +80,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Step 01 - Download wazuh-kibana-app - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: wazuh-kibana-app - name: Step 02 - Login to quay.io @@ -101,7 +101,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Step 01 - Download wazuh-kibana-app - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: wazuh-kibana-app - name: Step 02 - Login to quay.io