Skip to content

Commit

Permalink
Update Build final package Github action
Browse files Browse the repository at this point in the history
  • Loading branch information
yenienserrano committed Dec 6, 2023
1 parent c0455fe commit 1630e15
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 40 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
name: Build

on:
workflow_call:
inputs:
CHECKOUT_TO: # This is the branch to checkout to. Defaults to 'master'
description: 'The branch/tag/commit to checkout to'
required: true
default: ''
type: string
workflow_dispatch:
inputs:
CHECKOUT_TO: # This is the branch to checkout to. Defaults to 'master'
Expand All @@ -26,6 +33,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: wazuh/wazuh-dashboard
path: ./artifacts
ref: ${{ inputs.CHECKOUT_TO }}

Expand Down
120 changes: 81 additions & 39 deletions .github/workflows/build_wazuh_dashboard_with_plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,50 @@ name: Build final packages
on:
workflow_dispatch:
inputs:
WAZUH_DASHBOARD_PACKAGE_X64:
description: 'Wazuh dashboard package x64'
REFERENCE_SECURITY_PLUGIN:
description: 'Reference Wazuh security packages (branch/tag/commit)'
required: true
default: ''
WAZUH_PLUGINS_PACKAGES:
description: 'Wazuh plugins packages'
REFERENCE_WAZUH_PLUGINS:
description: 'Reference Wazuh plugins (branch/tag/commit)'
required: true
default: ''
WAZUH_SECURITY_PLUGIN_PACKAGES:
description: 'Wazuh security packages'
REFERENCE_WAZUH_DASHBOARD:
description: 'Reference Wazuh dashboard (branch/tag/commit)'
required: true
default: ''
DISTRIBUTION:
description: 'Distribution to build (--deb | --rpm | --tar | --all-platforms)'
required: true
default: ''

jobs:
build-plugins:
name: Build plugins
uses: wazuh/wazuh-dashboard-plugins/.github/workflows/manual-build.yml@6194-updating-github-actions-to-be-able-to-use-them-from-other-repositories
with:
reference: ${{ inputs.REFERENCE_WAZUH_PLUGINS }}

build-dashboard:
name: Build dashboard
uses: yenienserrano/wazuh-dashboard/.github/workflows/build.yml@119-update-packages-generation-tools
with:
CHECKOUT_TO: ${{ inputs.REFERENCE_WAZUH_DASHBOARD }}

build-security-plugin:
name: Build security plugin
uses: wazuh/wazuh-security-dashboards-plugin/.github/workflows/manual-build.yml@32-updating-github-actions-to-be-able-to-use-them-from-other-repositories
with:
reference: ${{ inputs.REFERENCE_SECURITY_PLUGIN }}


Build-final-packages:
needs: [build-plugins, build-dashboard, build-security-plugin]
runs-on: ubuntu-latest
name: Generate final packages
strategy:
fail-fast: false
matrix:
DISTRIBUTION: [ tar.gz, deb, rpm ]
# TODO: Add arm64 support
ARCHITECTURE: [ x64 ]
steps:
Expand All @@ -41,51 +65,69 @@ jobs:
echo "VERSION=$(yarn --silent wzd-version)" >> $GITHUB_ENV
echo "REVISION=$(yarn --silent wzd-revision)" >> $GITHUB_ENV
- name: Build the Wazuh Base x64
- name: Setup packages names
run: |
bash ${{ env.CURRENT_DIR }}/dev-tools/build-packages/base/generate_base.sh \
-v ${{ env.VERSION }} \
-r ${{ env.REVISION }} \
-a ${{ inputs.WAZUH_PLUGINS_PACKAGES }} \
-s ${{ inputs.WAZUH_SECURITY_PLUGIN_PACKAGES }} \
-b ${{ inputs.WAZUH_DASHBOARD_PACKAGE_X64 }}
echo "WAZUH_DASHBOARD_SLIM=wazuh-dashboard_${{ env.VERSION }}-${{ env.REVISION }}_${{ matrix.ARCHITECTURE }}_${{ inputs.REFERENCE_WAZUH_DASHBOARD }}.tar.gz" >> $GITHUB_ENV
echo "WAZUH_SECURITY_PLUGIN=wazuh-security-dashboards-plugin_${{ env.VERSION }}-${{ env.REVISION }}_${{ inputs.REFERENCE_SECURITY_PLUGIN }}.zip" >> $GITHUB_ENV
echo "WAZUH_PLUGINS=wazuh-dashboard-plugins_${{ env.VERSION }}-${{ env.REVISION }}_${{ inputs.REFERENCE_WAZUH_PLUGINS }}.zip" >> $GITHUB_ENV
- name: Get base package name
run: |
echo "WAZUH_BASE=$(ls ${{ env.CURRENT_DIR }}/dev-tools/build-packages/base/output)" >> $GITHUB_ENV
- name: Download dashboard artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.WAZUH_DASHBOARD_SLIM }}
path: ${{ env.CURRENT_DIR }}/artifacts/dashboard

- name: Build the package
if: matrix.DISTRIBUTION != 'tar.gz'
run: |
bash ${{ env.CURRENT_DIR }}/dev-tools/build-packages/${{ matrix.DISTRIBUTION }}/launcher.sh \
-p file://${{ env.CURRENT_DIR }}/dev-tools/build-packages/base/output/${{env.WAZUH_BASE}} \
-v ${{ env.VERSION }} \
-r ${{ env.REVISION }}
- name: Download security plugin artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.WAZUH_SECURITY_PLUGIN }}
path: ${{ env.CURRENT_DIR }}/artifacts/security-plugin

- name: Download plugins artifacts
uses: actions/download-artifact@v3
with:
name: ${{ env.WAZUH_PLUGINS }}
path: ${{ env.CURRENT_DIR }}/artifacts/plugins

- name: Get packages name
if: matrix.DISTRIBUTION != 'tar.gz'
- name: Zip plugins
run: |
echo "WAZUH_PACKAGES=$(find ${{ env.CURRENT_DIR }}/dev-tools/build-packages/${{ matrix.DISTRIBUTION }}/output -name "*.${{ matrix.DISTRIBUTION }}")" >> $GITHUB_ENV
echo "WAZUH_PACKAGE_NAME=wazuh-dashboard_${{ env.VERSION }}-${{ env.REVISION }}_${{ matrix.ARCHITECTURE }}.${{ matrix.DISTRIBUTION }}" >> $GITHUB_ENV
zip -r -j ${{ env.CURRENT_DIR }}/artifacts/wazuh-package.zip ${{ env.CURRENT_DIR }}/artifacts/plugins
zip -r -j ${{ env.CURRENT_DIR }}/artifacts/security-package.zip ${{ env.CURRENT_DIR }}/artifacts/security-plugin
zip -r -j ${{ env.CURRENT_DIR }}/artifacts/dashboard-package.zip ${{ env.CURRENT_DIR }}/artifacts/dashboard/${{ env.WAZUH_DASHBOARD_SLIM }}
- name: Rename ${{ matrix.DISTRIBUTION }} packages
if: matrix.DISTRIBUTION != 'tar.gz'
- name: Build packages
run: |
mv ${{ env.WAZUH_PACKAGES }} ${{ env.CURRENT_DIR }}/dev-tools/build-packages/${{ matrix.DISTRIBUTION }}/output/${{ env.WAZUH_PACKAGE_NAME }}
bash ${{ env.CURRENT_DIR }}/dev-tools/build-packages/base/generate_base.sh \
-v ${{ env.VERSION }} \
-r ${{ env.REVISION }} \
-a file://${{env.CURRENT_DIR}}/artifacts/wazuh-package.zip \
-s file://${{env.CURRENT_DIR}}/artifacts/security-package.zip \
-b file://${{env.CURRENT_DIR}}/artifacts/dashboard-package.zip \
${{ inputs.DISTRIBUTION }}
- name: Upload packages ${{ matrix.DISTRIBUTION }}
- name: Upload tar packages
uses: actions/upload-artifact@v3
if: success() && matrix.DISTRIBUTION != 'tar.gz'
if: success() && ( inputs.DISTRIBUTION == 'tar' || inputs.DISTRIBUTION == 'all-platforms' )
with:
name: Wazuh_dashboard_package_${{ matrix.ARCHITECTURE }}_${{ matrix.DISTRIBUTION }}
path: ${{ env.CURRENT_DIR }}/dev-tools/build-packages/${{ matrix.DISTRIBUTION }}/output/${{ env.WAZUH_PACKAGE_NAME }}
name: wazuh-dashboard-${{ env.VERSION }}-${{ env.REVISION }}-linux-${{ matrix.ARCHITECTURE }}.tar.gz
path: ${{ env.CURRENT_DIR }}/dev-tools/build-packages/output/wazuh-dashboard-${{ env.VERSION }}-${{ env.REVISION }}-linux-${{ matrix.ARCHITECTURE }}.tar.gz
retention-days: 30


- name: Upload packages tar.gz
- name: Upload deb packages
uses: actions/upload-artifact@v3
if: success() && ( inputs.DISTRIBUTION == 'deb' || inputs.DISTRIBUTION == 'all-platforms' )
with:
name: wazuh-dashboard_${{ env.VERSION }}-${{ env.REVISION }}_amd64.deb
path: ${{ env.CURRENT_DIR }}/dev-tools/build-packages/output/wazuh-dashboard_${{ env.VERSION }}-${{ env.REVISION }}_amd64.deb
retention-days: 30

- name: Upload rpm packages
uses: actions/upload-artifact@v3
if: success() && matrix.DISTRIBUTION == 'tar.gz'
if: success() && ( inputs.DISTRIBUTION == 'rpm' || inputs.DISTRIBUTION == 'all-platforms' )
with:
name: ${{env.WAZUH_BASE}}
path: ${{ env.CURRENT_DIR }}/dev-tools/build-packages/base/output/${{env.WAZUH_BASE}}
name: wazuh-dashboard-${{ env.VERSION }}-${{ env.REVISION }}.x86_64.rpm
path: ${{ env.CURRENT_DIR }}/dev-tools/build-packages/output/wazuh-dashboard-${{ env.VERSION }}-${{ env.REVISION }}.x86_64.rpm
retention-days: 30
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"sha": "6cb7fec4e154faa0a4a3fee4b33dfef91b9870d9"
},
"wazuh": {
"version": "4.9.0"
"version": "4.9.0",
"revision": "00"
},
"homepage": "https://opensearch.org",
"bugs": {
Expand Down

0 comments on commit 1630e15

Please sign in to comment.