Skip to content

Commit

Permalink
test 1
Browse files Browse the repository at this point in the history
  • Loading branch information
yenienserrano committed Oct 2, 2024
1 parent a303637 commit cfaef75
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 24 deletions.
68 changes: 50 additions & 18 deletions .github/workflows/build_wazuh_dashboard_with_plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ on:
description: 'Branch/tag/commit of the wazuh-dashboard-plugins repository to build the main plugins'
required: true
default: 'master'
reference_report_plugins:
type: string
description: 'Branch/tag/commit of the wazuh-dashboard-reporting repository to build the report plugin'
required: true
default: 'master'
is_stage:
type: boolean
description: 'Set production nomenclature'
Expand Down Expand Up @@ -72,6 +77,10 @@ on:
type: string
required: true
default: 'master'
reference_report_plugins:
type: string
required: true
default: 'master'
is_stage:
type: boolean
required: true
Expand Down Expand Up @@ -121,6 +130,13 @@ jobs:
with:
reference: ${{ inputs.reference_security_plugins }}

build-report-plugin:
needs: [validate-inputs]
name: Build security plugin
uses: yenienserrano/wazuh-dashboards-reporting/.github/workflows/dashboards-reports-test-and-build-workflow.yml@enhancement/288-enable-notification-plugin-in-reporting
with:
reference: ${{ inputs.reference_report_plugins }}

build-and-test-package:
needs: [build-main-plugins, build-base, build-security-plugin]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -182,11 +198,18 @@ jobs:
name: ${{ env.WAZUH_PLUGINS }}
path: ${{ env.CURRENT_DIR }}/artifacts/plugins

- name: Download report plugin artifact
uses: actions/download-artifact@v3
with:
name: wazuh-dashboard-reporting_${{ env.VERSION }}-${{ env.REVISION }}_${{ inputs.reference_report_plugins }}.zip
path: ${{ env.CURRENT_DIR }}/artifacts/report-plugin

- name: Zip plugins
run: |
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 }}
zip -r -j ${{ env.CURRENT_DIR }}/artifacts/report-package.zip ${{ env.CURRENT_DIR }}/artifacts/report-plugin
- name: Build package
run: |
Expand All @@ -197,6 +220,7 @@ jobs:
-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 \
-rp file://${{env.CURRENT_DIR}}/artifacts/report-package.zip \
--${{ inputs.system }} ${{ env.PRODUCTION }}
- name: Test package
Expand All @@ -207,24 +231,32 @@ jobs:
bash ./test-packages.sh \
-p ${{env.PACKAGE_NAME}}
- name: Set up AWS CLI
uses: aws-actions/configure-aws-credentials@v4
- name: Upload package
uses: actions/upload-artifact@v4
with:
aws-access-key-id: ${{ secrets.CI_INTERNAL_DEVELOPMENT_BUCKET_USER_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.CI_INTERNAL_DEVELOPMENT_BUCKET_USER_SECRET_KEY }}
aws-region: ${{ secrets.CI_AWS_REGION }}
name: wazuh-package-with-report-plugin
path: ${{ env.CURRENT_DIR }}/dev-tools/build-packages/output/

- name: Upload package
run: |
echo "Uploading package"
aws s3 cp ${{ env.CURRENT_DIR }}/dev-tools/build-packages/output/${{ inputs.system }}/${{env.PACKAGE_NAME}} s3://packages-dev.internal.wazuh.com/development/wazuh/4.x/main/packages/
s3uri="s3://packages-dev.internal.wazuh.com/development/wazuh/4.x/main/packages/${{env.PACKAGE_NAME}}"
echo "S3 URI: ${s3uri}"

- name: Upload SHA512
if: ${{ inputs.checksum }}
run: |
echo "Uploading checksum"
aws s3 cp ${{ env.CURRENT_DIR }}/dev-tools/build-packages/output/${{ inputs.system }}/${{env.PACKAGE_NAME}}.sha512 s3://packages-dev.internal.wazuh.com/development/wazuh/4.x/main/packages/
s3uri="s3://packages-dev.internal.wazuh.com/development/wazuh/4.x/main/packages/${{env.PACKAGE_NAME}}.sha512"
echo "S3 sha512 URI: ${s3uri}"

# - name: Set up AWS CLI
# uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-access-key-id: ${{ secrets.CI_INTERNAL_DEVELOPMENT_BUCKET_USER_ACCESS_KEY }}
# aws-secret-access-key: ${{ secrets.CI_INTERNAL_DEVELOPMENT_BUCKET_USER_SECRET_KEY }}
# aws-region: ${{ secrets.CI_AWS_REGION }}

# - name: Upload package
# run: |
# echo "Uploading package"
# aws s3 cp ${{ env.CURRENT_DIR }}/dev-tools/build-packages/output/${{ inputs.system }}/${{env.PACKAGE_NAME}} s3://packages-dev.internal.wazuh.com/development/wazuh/4.x/main/packages/
# s3uri="s3://packages-dev.internal.wazuh.com/development/wazuh/4.x/main/packages/${{env.PACKAGE_NAME}}"
# echo "S3 URI: ${s3uri}"

# - name: Upload SHA512
# if: ${{ inputs.checksum }}
# run: |
# echo "Uploading checksum"
# aws s3 cp ${{ env.CURRENT_DIR }}/dev-tools/build-packages/output/${{ inputs.system }}/${{env.PACKAGE_NAME}}.sha512 s3://packages-dev.internal.wazuh.com/development/wazuh/4.x/main/packages/
# s3uri="s3://packages-dev.internal.wazuh.com/development/wazuh/4.x/main/packages/${{env.PACKAGE_NAME}}.sha512"
# echo "S3 sha512 URI: ${s3uri}"
30 changes: 25 additions & 5 deletions dev-tools/build-packages/base/generate_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ base=""
revision="1"
security=""
version=""
reportPlugin=""

# Paths
current_path="$( cd $(dirname $0) ; pwd -P )"
Expand Down Expand Up @@ -72,7 +73,22 @@ build() {
echo "The given URL or Path to the Wazuh App is not valid: ${app}"
clean 1
fi

echo
echo "Downloading report plugin.."
echo
if [[ $reportPlugin =~ $valid_url ]]; then
if ! curl --output applications/reportPlugin.zip --silent --fail "${reportPlugin}"; then
echo "The given URL or Path to the Wazuh Apps is not working: ${reportPlugin}"
clean 1
else
echo "Extracting applications from reportPlugin.zip"
unzip -q applications/reportPlugin.zip -d applications
rm applications/reportPlugin.zip
fi
else
echo "The given URL or Path to the Wazuh App is not valid: ${reportPlugin}"
clean 1
fi
echo
echo "Downloading dashboards..."
echo
Expand Down Expand Up @@ -150,9 +166,6 @@ build() {
category_explore='{id:"explore",label:"Explore",order:100,euiIconType:"search"}'
category_dashboard_management='{id:"management",label:"Index management",order:5e3,euiIconType:"managementApp"}'

# Replace app category to Reporting app
sed -i -e "s|category:{id:\"opensearch\",label:_i18n.i18n.translate(\"opensearch.reports.categoryName\",{defaultMessage:\"OpenSearch Plugins\"}),order:2e3}|category:${category_explore}|" ./plugins/reportsDashboards/target/public/reportsDashboards.plugin.js

# Replace app category to Alerting app
sed -i -e "s|category:{id:\"opensearch\",label:\"OpenSearch Plugins\",order:2e3}|category:${category_explore}|" ./plugins/alertingDashboards/target/public/alertingDashboards.plugin.js

Expand All @@ -167,7 +180,6 @@ build() {

# Generate compressed files
files_to_recreate=(
./plugins/reportsDashboards/target/public/reportsDashboards.plugin.js
./plugins/alertingDashboards/target/public/alertingDashboards.plugin.js
./plugins/customImportMapDashboards/target/public/customImportMapDashboards.plugin.js
./plugins/notificationsDashboards/target/public/notificationsDashboards.plugin.js
Expand Down Expand Up @@ -253,6 +265,14 @@ main() {
help 0
fi
;;
"-rp" | "--reportPlugin")
if [ -n "${2}" ]; then
reportPlugin="${2}"
shift 2
else
help 0
fi
;;
"-v" | "--version")
if [ -n "${2}" ]; then
version="${2}"
Expand Down
1 change: 0 additions & 1 deletion dev-tools/build-packages/base/plugins
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ customImportMapDashboards
ganttChartDashboards
indexManagementDashboards
notificationsDashboards
reportsDashboards
8 changes: 8 additions & 0 deletions dev-tools/build-packages/build-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ main() {
help 0
fi
;;
"-rp" | "--reportPlugin")
if [ -n "${2}" ]; then
reportPlugin="${2}"
shift 2
else
help 0
fi
;;
"-v" | "--version")
if [ -n "${2}" ]; then
version="${2}"
Expand Down

0 comments on commit cfaef75

Please sign in to comment.