Skip to content

Commit

Permalink
Merge branch '4.10.2' into bug/438-review-the-action-of-building-pack…
Browse files Browse the repository at this point in the history
…ages-arm

Signed-off-by: Nicolas Agustin Guevara Pihen <[email protected]>
  • Loading branch information
Tostti authored Dec 16, 2024
2 parents b218461 + f2c6139 commit 89e0186
Show file tree
Hide file tree
Showing 20 changed files with 373 additions and 148 deletions.
42 changes: 23 additions & 19 deletions .github/workflows/build_and_test_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
disk-root: 'C:'

- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup JDK (Windows only)
if: matrix.os == 'windows-latest'
Expand All @@ -72,7 +72,7 @@ jobs:
distribution: 'adopt'

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
Expand All @@ -88,7 +88,7 @@ jobs:
run: echo "YARN_CACHE_LOCATION=$(yarn cache dir)" >> $GITHUB_ENV

- name: Initialize Yarn Cache
uses: actions/cache@v3
uses: actions/cache@v4
if: matrix.os != 'windows-latest'
with:
path: ${{ env.YARN_CACHE_LOCATION }}
Expand Down Expand Up @@ -170,7 +170,7 @@ jobs:
disk-root: 'C:'

- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup JDK (Windows only)
if: matrix.os == 'windows-latest'
Expand All @@ -180,7 +180,7 @@ jobs:
distribution: 'adopt'

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
Expand All @@ -196,7 +196,7 @@ jobs:
run: echo "YARN_CACHE_LOCATION=$(yarn cache dir)" >> $GITHUB_ENV

- name: Initialize Yarn Cache
uses: actions/cache@v3
uses: actions/cache@v4
if: matrix.os != 'windows-latest'
with:
path: ${{ env.YARN_CACHE_LOCATION }}
Expand Down Expand Up @@ -249,13 +249,14 @@ jobs:
JOB: ci${{ matrix.group }}
CACHE_DIR: ciGroup${{ matrix.group }}

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: failure()
with:
name: failure-artifacts-ci${{ matrix.group }}
path: |
test/*/failure_debug/
test/*/screenshots/
overwrite: true

plugin-functional-tests:
name: Run plugin functional tests on ${{ matrix.name }}
Expand Down Expand Up @@ -286,7 +287,7 @@ jobs:
disk-root: 'C:'

- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup JDK (Windows only)
if: matrix.os == 'windows-latest'
Expand All @@ -296,7 +297,7 @@ jobs:
distribution: 'adopt'

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
Expand All @@ -312,7 +313,7 @@ jobs:
run: echo "YARN_CACHE_LOCATION=$(yarn cache dir)" >> $GITHUB_ENV

- name: Initialize Yarn Cache
uses: actions/cache@v3
uses: actions/cache@v4
if: matrix.os != 'windows-latest'
with:
path: ${{ env.YARN_CACHE_LOCATION }}
Expand Down Expand Up @@ -360,13 +361,14 @@ jobs:
id: plugin-ftr-tests
run: node scripts/functional_tests.js --config test/plugin_functional/config.ts

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: failure()
with:
name: failure-artifacts-plugin-functional-${{ matrix.os }}
path: |
test/*/failure_debug/
test/*/screenshots/
overwrite: true

build-min-artifact-tests:
name: Build min release artifacts on ${{ matrix.name }}
Expand Down Expand Up @@ -418,12 +420,12 @@ jobs:
disk-root: 'C:'

- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: ./artifacts

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: './artifacts/.nvmrc'
registry-url: 'https://registry.npmjs.org'
Expand All @@ -439,7 +441,7 @@ jobs:
run: echo "YARN_CACHE_LOCATION=$(yarn cache dir)" >> $GITHUB_ENV

- name: Initialize Yarn Cache
uses: actions/cache@v3
uses: actions/cache@v4
if: matrix.os != 'windows-latest'
with:
path: ${{ env.YARN_CACHE_LOCATION }}
Expand Down Expand Up @@ -473,12 +475,13 @@ jobs:
- name: Build `${{ matrix.name }}`
run: yarn ${{ matrix.script }} --release

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: success()
with:
name: ${{ matrix.suffix }}-${{ env.VERSION }}
path: ./artifacts/target/${{ env.ARTIFACT_BUILD_NAME }}
retention-days: 1
overwrite: true

bwc-tests:
needs: [build-min-artifact-tests]
Expand Down Expand Up @@ -507,15 +510,15 @@ jobs:
]
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: ./artifacts

- run: echo Running backwards compatibility tests for version ${{ matrix.version }}
- run: echo [NOTE] These tests will be ran using Linux x64 release builds without security

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: './artifacts/.nvmrc'
registry-url: 'https://registry.npmjs.org'
Expand Down Expand Up @@ -550,7 +553,7 @@ jobs:
run: echo "BWC_VERSIONS=${{ matrix.version }}" >> $GITHUB_ENV

- name: Download OpenSearch Dashboards
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
id: download
with:
name: linux-x64-${{ env.VERSION }}
Expand All @@ -562,7 +565,7 @@ jobs:
run: |
yarn test:bwc -s false -o ${{ env.OPENSEARCH_URL }} -d ${{ steps.download.outputs.download-path }}/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz -v ${{ matrix.version }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: ${{ failure() && steps.verify-opensearch-exists.outputs.version-exists == 'true' }}
with:
name: ${{ matrix.version }}-test-failures
Expand All @@ -571,3 +574,4 @@ jobs:
./artifacts/bwc_tmp/test/cypress/screenshots/*
./artifacts/bwc_tmp/test/cypress/results/*
retention-days: 1
overwrite: true
7 changes: 4 additions & 3 deletions .github/workflows/build_base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
ref: ${{ inputs.CHECKOUT_TO }}

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: './artifacts/.nvmrc'
registry-url: 'https://registry.npmjs.org'
Expand All @@ -63,7 +63,7 @@ jobs:
run: echo "YARN_CACHE_LOCATION=$(yarn cache dir)" >> $GITHUB_ENV

- name: Initialize Yarn Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ env.YARN_CACHE_LOCATION }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
Expand All @@ -89,9 +89,10 @@ jobs:
- name: Rename artifact
run: mv /home/runner/work/wazuh-dashboard/wazuh-dashboard/artifacts/target/opensearch-dashboards-${{ env.VERSION }}-linux-${{ (inputs.ARCHITECTURE == 'x86_64' || inputs.ARCHITECTURE == 'amd64') && 'x64' || 'arm64' }}.${{ matrix.DISTRIBUTION }} /home/runner/work/wazuh-dashboard/wazuh-dashboard/artifacts/target/${{ env.ARTIFACT_BUILD_NAME }}

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: success()
with:
name: ${{ env.ARTIFACT_BUILD_NAME }}
path: ./artifacts/target/${{ env.ARTIFACT_BUILD_NAME }}
retention-days: 30
overwrite: true
60 changes: 35 additions & 25 deletions .github/workflows/build_wazuh_dashboard_with_plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,21 @@ jobs:
PRODUCTION: ${{ steps.setup-variables.outputs.PRODUCTION }}
WAZUH_DASHBOARD_SLIM: ${{ steps.setup-variables.outputs.WAZUH_DASHBOARD_SLIM }}
WAZUH_SECURITY_PLUGIN: ${{ steps.setup-variables.outputs.WAZUH_SECURITY_PLUGIN }}
WAZUH_PLUGINS: ${{ steps.setup-variables.outputs.WAZUH_PLUGINS }}
WAZUH_PLUGINS_WAZUH: ${{ steps.setup-variables.outputs.WAZUH_PLUGINS_WAZUH }}
WAZUH_PLUGINS_CORE: ${{ steps.setup-variables.outputs.WAZUH_PLUGINS_CORE }}
WAZUH_PLUGINS_CHECK_UPDATES: ${{ steps.setup-variables.outputs.WAZUH_PLUGINS_CHECK_UPDATES }}
PACKAGE_NAME: ${{ steps.setup-variables.outputs.PACKAGE_NAME }}
ARCHITECTURE_FLAG: ${{ steps.setup-variables.outputs.ARCHITECTURE_FLAG }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'

- name: Setup variables
id: setup-variables
run: |
Expand All @@ -117,9 +125,11 @@ jobs:
else
PRODUCTION=""
fi
WAZUH_DASHBOARD_SLIM=wazuh-dashboard_${VERSION}-${REVISION}_${{ (inputs.architecture == 'x86_64' || inputs.architecture == 'amd64') && 'x64' || 'arm64' }}.tar.gz
WAZUH_SECURITY_PLUGIN=wazuh-security-dashboards-plugin_${VERSION}-${REVISION}_${{ inputs.reference_security_plugins }}.zip
WAZUH_PLUGINS=wazuh-dashboard-plugins_${VERSION}-${REVISION}_${{ inputs.reference_wazuh_plugins }}.zip
WAZUH_DASHBOARD_SLIM=wazuh-dashboard_${VERSION}-${REVISION}_x64.tar.gz
WAZUH_SECURITY_PLUGIN=wazuh-security-dashboards-plugin_${VERSION}-${REVISION}_$(echo ${{ inputs.reference_security_plugins }} | sed 's/\//-/g').zip
WAZUH_PLUGINS_WAZUH=wazuh-dashboard-plugins_wazuh_${VERSION}-${REVISION}_$(echo ${{ inputs.reference_wazuh_plugins }} | sed 's/\//-/g').zip
WAZUH_PLUGINS_CORE=wazuh-dashboard-plugins_wazuh-core_${VERSION}-${REVISION}_$(echo ${{ inputs.reference_wazuh_plugins }} | sed 's/\//-/g').zip
WAZUH_PLUGINS_CHECK_UPDATES=wazuh-dashboard-plugins_wazuh-check-updates_${VERSION}-${REVISION}_$(echo ${{ inputs.reference_wazuh_plugins }} | sed 's/\//-/g').zip
if [ "${{ inputs.system }}" = "deb" ]; then
if [ "${{ inputs.is_stage }}" = "true" ]; then
PACKAGE_NAME=wazuh-dashboard_${VERSION}-${{ inputs.revision }}_${{ inputs.architecture }}.deb
Expand All @@ -145,14 +155,16 @@ jobs:
echo "PRODUCTION=$PRODUCTION" >> $GITHUB_OUTPUT
echo "WAZUH_DASHBOARD_SLIM=$WAZUH_DASHBOARD_SLIM" >> $GITHUB_OUTPUT
echo "WAZUH_SECURITY_PLUGIN=$WAZUH_SECURITY_PLUGIN" >> $GITHUB_OUTPUT
echo "WAZUH_PLUGINS=$WAZUH_PLUGINS" >> $GITHUB_OUTPUT
echo "WAZUH_PLUGINS_WAZUH=$WAZUH_PLUGINS_WAZUH" >> $GITHUB_OUTPUT
echo "WAZUH_PLUGINS_CORE=$WAZUH_PLUGINS_CORE" >> $GITHUB_OUTPUT
echo "WAZUH_PLUGINS_CHECK_UPDATES=$WAZUH_PLUGINS_CHECK_UPDATES" >> $GITHUB_OUTPUT
echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_OUTPUT
echo "ARCHITECTURE_FLAG=$ARCHITECTURE_FLAG" >> $GITHUB_OUTPUT
validate-job:
runs-on: ubuntu-latest
needs: setup-variables
name: Validate job
name: Validate inputs
steps:
- name: Validate inputs
run: |
Expand All @@ -172,18 +184,6 @@ jobs:
aws-secret-access-key: ${{ secrets.CI_INTERNAL_DEVELOPMENT_BUCKET_USER_SECRET_KEY }}
aws-region: ${{ secrets.CI_AWS_REGION }}

- name: Verify if package is already built
run: |
set +e
echo "Verifying package"
PACKAGE_NAME=${{ needs.setup-variables.outputs.PACKAGE_NAME }}
exists=$(aws s3 ls s3://packages-dev.internal.wazuh.com/development/wazuh/4.x/main/packages/$PACKAGE_NAME)
if [ -n "$exists" ]; then
echo "Package already exists"
exit 1
fi
set -e
build-base:
needs: [validate-job]
name: Build dashboard
Expand All @@ -208,34 +208,44 @@ jobs:

build-and-test-package:
needs: [setup-variables, build-main-plugins, build-base, build-security-plugin]
runs-on: ${{ (inputs.architecture == 'arm64' || inputs.architecture == 'aarch64') && 'wz-linux-arm64' || 'ubuntu-22.04' }}
runs-on: ubuntu-latest
name: Generate packages
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'

- name: Download dashboard artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ${{ needs.setup-variables.outputs.WAZUH_DASHBOARD_SLIM }}
path: ${{ needs.setup-variables.outputs.CURRENT_DIR }}/artifacts/dashboard

- name: Download security plugin artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ${{ needs.setup-variables.outputs.WAZUH_SECURITY_PLUGIN }}
path: ${{ needs.setup-variables.outputs.CURRENT_DIR }}/artifacts/security-plugin

- name: Download plugins artifacts
uses: actions/download-artifact@v3
- name: Download main plugin's artifact
uses: actions/download-artifact@v4
with:
name: ${{ needs.setup-variables.outputs.WAZUH_PLUGINS_WAZUH }}
path: ${{ needs.setup-variables.outputs.CURRENT_DIR }}/artifacts/plugins
- name: Download core plugin's artifact
uses: actions/download-artifact@v4
with:
name: ${{ needs.setup-variables.outputs.WAZUH_PLUGINS_CORE }}
path: ${{ needs.setup-variables.outputs.CURRENT_DIR }}/artifacts/plugins
- name: Download check update plugin's artifact
uses: actions/download-artifact@v4
with:
name: ${{ needs.setup-variables.outputs.WAZUH_PLUGINS }}
name: ${{ needs.setup-variables.outputs.WAZUH_PLUGINS_CHECK_UPDATES }}
path: ${{ needs.setup-variables.outputs.CURRENT_DIR }}/artifacts/plugins

- name: Zip plugins
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
Loading

0 comments on commit 89e0186

Please sign in to comment.