From 12542eaba5e3b0010d93d96a9f936df423b33f89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Wed, 25 Sep 2024 21:21:28 +0200 Subject: [PATCH] Build & Assemble reporting plugin (#431) * Build & Assemble reporting plugin * Add working-directto ls * Swap reporting plugin in wazuh-indexer package (specs) * Fix changelog chronological order * Normalize artifact names * Use env.plugin_name --- .github/workflows/build.yml | 80 +++++++++++++++---- build-scripts/assemble.sh | 3 +- .../packages/src/deb/debmake_install.sh | 4 +- .../packages/src/rpm/wazuh-indexer.rpm.spec | 18 ++--- 4 files changed, 77 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3a44cd3edc045..93febb2a0ee15 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,8 +35,12 @@ on: description: "ID used to identify the workflow uniquely." type: string required: false - plugins_reference: - description: "Branch, commit or tag for the plugins repository" + wazuh_plugins_ref: + description: "Branch, commit or tag for the wazuh-indexer-plugins repository" + type: string + default: "master" + reporting_plugin_ref: + description: "Branch, commit or tag for the wazuh-indexer-reporting repository" type: string default: "master" workflow_call: @@ -68,8 +72,12 @@ on: id: type: string required: false - plugins_reference: - description: "Branch, commit or tag for the plugins repository" + wazuh_plugins_ref: + description: "Branch, commit or tag for the wazuh-indexer-plugins repository" + type: string + default: "master" + reporting_plugin_ref: + description: "Branch, commit or tag for the wazuh-indexer-reporting repository" type: string default: "master" secrets: @@ -109,18 +117,21 @@ jobs: ) echo "matrix=$matrix" >> $GITHUB_OUTPUT - build-plugins: - if: ${{ inputs.plugins_reference != '' }} + build-wazuh-plugins: + if: ${{ inputs.wazuh_plugins_ref != '' }} strategy: fail-fast: false matrix: plugins: ["setup", "command-manager"] runs-on: ubuntu-latest + env: + plugin_name: wazuh-indexer-${{ matrix.plugins }} steps: - uses: actions/checkout@v4 with: repository: wazuh/wazuh-indexer-plugins - ref: ${{ inputs.plugins_reference }} + ref: ${{ inputs.wazuh_plugins_ref }} + - uses: actions/setup-java@v4 with: distribution: temurin @@ -135,19 +146,55 @@ jobs: - name: Build with Gradle working-directory: ./plugins/${{ matrix.plugins }} - run: | - ./gradlew build -Dversion=${{ steps.version.outputs.version }} -Drevision=${{ inputs.revision }} - ls -lR build/distributions/ + run: ./gradlew build -Dversion=${{ steps.version.outputs.version }} -Drevision=${{ inputs.revision }} + + - run: ls -lR build/distributions + working-directory: ./plugins/${{ matrix.plugins }} + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ env.plugin_name }}-${{ steps.version.outputs.version }}.${{ inputs.revision }}.zip + path: "./plugins/${{ matrix.plugins }}/build/distributions/${{ env.plugin_name }}-${{ steps.version.outputs.version }}.${{ inputs.revision }}.zip" + if-no-files-found: error + + build-reporting-plugin: + if: ${{ inputs.reporting_plugin_ref != '' }} + runs-on: ubuntu-latest + env: + plugin_name: wazuh-indexer-reports-scheduler + steps: + - uses: actions/checkout@v4 + with: + repository: wazuh/wazuh-indexer-reporting + ref: ${{ inputs.reporting_plugin_ref }} + + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + + - name: Setup Gradle # Used for caching + uses: gradle/actions/setup-gradle@v4 + + - name: Get version + id: version + run: echo "version=$(> "$GITHUB_OUTPUT" + + - name: Build with Gradle + run: ./gradlew build -Dversion=${{ steps.version.outputs.version }} -Drevision=${{ inputs.revision }} + + - run: ls -lR build/distributions - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: ${{ matrix.plugins }} - path: "./plugins/${{ matrix.plugins }}/build/distributions/wazuh-indexer-${{ matrix.plugins }}-${{ steps.version.outputs.version }}.${{ inputs.revision }}.zip" + name: ${{ env.plugin_name }}-${{ steps.version.outputs.version }}.${{ inputs.revision }}.zip + path: build/distributions/${{ env.plugin_name }}-${{ steps.version.outputs.version }}.${{ inputs.revision }}.zip if-no-files-found: error build: - needs: [matrix, build-plugins] + needs: [matrix, build-wazuh-plugins, build-reporting-plugin] runs-on: ubuntu-latest strategy: fail-fast: false @@ -156,14 +203,15 @@ jobs: - uses: actions/checkout@v4 # Download plugins - - uses: actions/download-artifact@v4 - if: ${{ inputs.plugins_reference != '' }} + - name: Download plugins + uses: actions/download-artifact@v4 + if: ${{ inputs.wazuh_plugins_ref != '' || inputs.reporting_plugin_ref != ''}} with: path: ./artifacts/plugins merge-multiple: true - name: Display structure of downloaded files - if: ${{ inputs.plugins_reference != '' }} + if: ${{ inputs.wazuh_plugins_ref != '' || inputs.reporting_plugin_ref != ''}} run: ls -lR ./artifacts/plugins - uses: actions/setup-java@v4 diff --git a/build-scripts/assemble.sh b/build-scripts/assemble.sh index ea0b841465d36..a228830ca1e82 100644 --- a/build-scripts/assemble.sh +++ b/build-scripts/assemble.sh @@ -36,13 +36,14 @@ else "notifications" # "opensearch-notifications". Requires "opensearch-notifications-core" "opensearch-observability" "performance-analyzer" # "opensearch-performance-analyzer" - "opensearch-reports-scheduler" "opensearch-security" "opensearch-security-analytics" "opensearch-sql-plugin" # "opensearch-sql" ) wazuh_plugins=( "wazuh-indexer-setup" + "wazuh-indexer-command-manager" + "wazuh-indexer-reports-scheduler" ) fi diff --git a/distribution/packages/src/deb/debmake_install.sh b/distribution/packages/src/deb/debmake_install.sh index 6bc8e89d48f68..132edfeca273d 100644 --- a/distribution/packages/src/deb/debmake_install.sh +++ b/distribution/packages/src/deb/debmake_install.sh @@ -69,8 +69,8 @@ if [ -e "${buildroot}/${config_dir}/opensearch-observability/observability.yml" chmod -c 660 "${buildroot}/${config_dir}/opensearch-observability/observability.yml" fi -if [ -e "${buildroot}/${config_dir}/opensearch-reports-scheduler/reports-scheduler.yml" ]; then - chmod -c 660 "${buildroot}/${config_dir}/opensearch-reports-scheduler/reports-scheduler.yml" +if [ -e "${buildroot}/${config_dir}/wazuh-indexer-reports-scheduler/reports-scheduler.yml" ]; then + chmod -c 660 "${buildroot}/${config_dir}/wazuh-indexer-reports-scheduler/reports-scheduler.yml" fi # Files that need other permissions diff --git a/distribution/packages/src/rpm/wazuh-indexer.rpm.spec b/distribution/packages/src/rpm/wazuh-indexer.rpm.spec index 8aa28bb3c1615..3e1953185d06e 100644 --- a/distribution/packages/src/rpm/wazuh-indexer.rpm.spec +++ b/distribution/packages/src/rpm/wazuh-indexer.rpm.spec @@ -57,7 +57,7 @@ For more information, see: https://www.wazuh.com/ %build %define observability_plugin %( if [ -f %{_topdir}/etc/wazuh-indexer/opensearch-observability/observability.yml ]; then echo "1" ; else echo "0"; fi ) -%define reportsscheduler_plugin %( if [ -f %{_topdir}/etc/wazuh-indexer/opensearch-reports-scheduler/reports-scheduler.yml ]; then echo "1" ; else echo "0"; fi ) +%define reportsscheduler_plugin %( if [ -f %{_topdir}/etc/wazuh-indexer/wazuh-indexer-reports-scheduler/reports-scheduler.yml ]; then echo "1" ; else echo "0"; fi ) %install set -e @@ -77,7 +77,7 @@ fi # Pre-populate the folders to ensure rpm build success even without all plugins mkdir -p %{buildroot}%{config_dir}/opensearch-observability -mkdir -p %{buildroot}%{config_dir}/opensearch-reports-scheduler +mkdir -p %{buildroot}%{config_dir}/wazuh-indexer-reports-scheduler mkdir -p %{buildroot}%{product_dir}/performance-analyzer-rca # Pre-populate PA configs if not present @@ -144,7 +144,7 @@ if [ %observability_plugin -eq 1 ]; then fi if [ %reportsscheduler_plugin -eq 1 ]; then - set -- "$@" "%{config_dir}/opensearch-reports-scheduler/reports-scheduler.yml" + set -- "$@" "%{config_dir}/wazuh-indexer-reports-scheduler/reports-scheduler.yml" fi for i in "$@" @@ -251,7 +251,7 @@ exit 0 %endif %if %reportsscheduler_plugin -%config(noreplace) %attr(660, %{name}, %{name}) %{config_dir}/opensearch-reports-scheduler/reports-scheduler.yml +%config(noreplace) %attr(660, %{name}, %{name}) %{config_dir}/wazuh-indexer-reports-scheduler/reports-scheduler.yml %endif @@ -265,13 +265,13 @@ exit 0 %attr(750, %{name}, %{name}) %{product_dir}/performance-analyzer-rca/bin/* %changelog -* Fri Sep 06 2024 support - 5.0.0 +* Fri Dec 06 2024 support - 5.0.0 - More info: https://documentation.wazuh.com/current/release-notes/release-5.0.0-0.html -* Tue Aug 20 2024 support - 4.10.0 +* Fri Nov 06 2024 support - 4.10.1 +- More info: https://documentation.wazuh.com/current/release-notes/release-4-10-1.html +* Mon Sep 23 2024 support - 4.10.0 - More info: https://documentation.wazuh.com/current/release-notes/release-4-10-0.html -* Fri Sep 06 2024 support - 4.9.2 -- More info: https://documentation.wazuh.com/current/release-notes/release-4-9-1.html -* Thu Aug 15 2024 support - 4.9.1 +* Fri Sep 20 2024 support - 4.9.1 - More info: https://documentation.wazuh.com/current/release-notes/release-4-9-1.html * Thu Aug 15 2024 support - 4.9.0 - More info: https://documentation.wazuh.com/current/release-notes/release-4-9-0.html