From f45a8d7899d54bf502dbd122c583ccac4ffc93db Mon Sep 17 00:00:00 2001 From: yenienserrano Date: Wed, 29 Nov 2023 14:30:11 +0100 Subject: [PATCH] Add github action build final wazuh dashboard package --- .../build_wazuh_dashboard_with_plugins.yml | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 .github/workflows/build_wazuh_dashboard_with_plugins.yml diff --git a/.github/workflows/build_wazuh_dashboard_with_plugins.yml b/.github/workflows/build_wazuh_dashboard_with_plugins.yml new file mode 100644 index 000000000000..30d78b4751e1 --- /dev/null +++ b/.github/workflows/build_wazuh_dashboard_with_plugins.yml @@ -0,0 +1,91 @@ +name: Build final packages + +on: + workflow_dispatch: + inputs: + WAZUH_DASHBOARD_PACKAGE_X64: + description: 'Wazuh dashboard package x64' + required: true + default: '' + WAZUH_PLUGINS_PACKAGES: + description: 'Wazuh plugins packages' + required: true + default: '' + WAZUH_SECURITY_PLUGIN_PACKAGES: + description: 'Wazuh security packages' + required: true + default: '' +jobs: + Build-final-packages: + 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: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + registry-url: 'https://registry.npmjs.org' + + - name: Setup variables + run: | + echo "CURRENT_DIR=$(pwd -P)" >> $GITHUB_ENV + echo "VERSION=$(yarn --silent wzd-version)" >> $GITHUB_ENV + echo "REVISION=$(yarn --silent wzd-revision)" >> $GITHUB_ENV + + - name: Build the Wazuh Base x64 + 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 }} + + - name: Get base package name + run: | + echo "WAZUH_BASE=$(ls ${{ env.CURRENT_DIR }}/dev-tools/build-packages/base/output)" >> $GITHUB_ENV + + - 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: Get packages name + if: matrix.DISTRIBUTION != 'tar.gz' + 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 + + - name: Rename ${{ matrix.DISTRIBUTION }} packages + if: matrix.DISTRIBUTION != 'tar.gz' + run: | + mv ${{ env.WAZUH_PACKAGES }} ${{ env.CURRENT_DIR }}/dev-tools/build-packages/${{ matrix.DISTRIBUTION }}/output/${{ env.WAZUH_PACKAGE_NAME }} + + - name: Upload packages ${{ matrix.DISTRIBUTION }} + uses: actions/upload-artifact@v3 + if: success() && matrix.DISTRIBUTION != 'tar.gz' + with: + name: Wazuh_dashboard_package_${{ matrix.ARCHITECTURE }}_${{ matrix.DISTRIBUTION }} + path: ${{ env.CURRENT_DIR }}/dev-tools/build-packages/${{ matrix.DISTRIBUTION }}/output/${{ env.WAZUH_PACKAGE_NAME }} + retention-days: 30 + + + - name: Upload packages tar.gz + uses: actions/upload-artifact@v3 + if: success() && matrix.DISTRIBUTION == 'tar.gz' + with: + name: ${{env.WAZUH_BASE}} + path: ${{ env.CURRENT_DIR }}/dev-tools/build-packages/base/output/${{env.WAZUH_BASE}} + retention-days: 30