Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actions and workflows according to convention #545

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Copy link
Member

@Desvelao Desvelao Feb 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: For the wazuh repository, they do not use wazuh in the workflow filename: https://github.com/wazuh/wazuh/pull/28233/files, so we could only keep the stack component instead (dashboard).

suggestion: We could reference to dashboard_core in this workflow.

Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# This is a basic workflow that is manually triggered
#
# This workflow automates the build of Wazuh Dashboard for different
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# This workflow automates the build of Wazuh Dashboard for different
# This workflow automates the build of Wazuh dashboard core for different

# architectures and distributions.
#
# This workflow:
# - Clones, configures, builds and packages the Wazuh Dashboard.
# - Is customizable in architecture and reference (`branch/tag/commit`).
# - Uploads the final package with a structured name.
Comment on lines +7 to +9
Copy link
Member

@Desvelao Desvelao Feb 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# - Clones, configures, builds and packages the Wazuh Dashboard.
# - Is customizable in architecture and reference (`branch/tag/commit`).
# - Uploads the final package with a structured name.
# - Clone, configure, build and package the Wazuh dashboard core.
# - Customizable in architecture and reference (`branch/tag/commit`).
# - Upload the final package with a structured name.


name: Build base
name: Build Wazuh dashboard

on:
workflow_call:
Expand Down
Copy link
Member

@Desvelao Desvelao Feb 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: For the wazuh repository, they do not use wazuh in the workflow filename: https://github.com/wazuh/wazuh/pull/28233/files, so we could only keep the stack component instead (dashboard). If you rename the 5_builderpackage_wazuh_dashboard.yml to 5_builderpackage_wazuh_dashboard_core.yml, maybe you could rename this to 5_builderpackage_wazuh_dashboard.yml.

Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# This workflow automates the build of the Wazuh Dashboard package along with
# its plugins.
#
# This workflow:
# - Downloads, builds, packages, tests, and uploads the Wazuh Dashboard along
# with its plugins.
# - Is customizable through inputs to adapt to different environments
# (production, staging, various architectures).
# - Ensures that each component is built with the exact reference provided and
# validated before the final packaging.
Comment on lines +5 to +10
Copy link
Member

@Desvelao Desvelao Feb 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# - Downloads, builds, packages, tests, and uploads the Wazuh Dashboard along
# with its plugins.
# - Is customizable through inputs to adapt to different environments
# (production, staging, various architectures).
# - Ensures that each component is built with the exact reference provided and
# validated before the final packaging.
# - Download, build, package, test, and upload the Wazuh dashboard along
# with its plugins.
# - Customizable through inputs to adapt to different environments
# (production, staging, various architectures).
# - Ensure that each component is built with the exact reference provided and
# validated before the final packaging.

#
# - Allows customization of:
# - Operating system (`deb` or `rpm`)
# - Architecture (`amd64`, `x86_64`, `aarch64`, `arm64`)
# - Package revision
# - Plugin references (branches, tags, or commits)
# - Staging, upload, and checksum options.

run-name: Build ${{ inputs.system }} wazuh-dashboard on ${{ inputs.architecture }} ${{ inputs.is_stage && '- is stage' || '' }} ${{ inputs.checksum && '- checksum' || '' }} ${{ inputs.id }}
name: Build Wazuh dashboard with plugins

Expand Down Expand Up @@ -104,6 +122,11 @@ on:

jobs:
setup-variables:
# 1. Clone plugin repositories and get SHA for each one.
# 2. Configure key variables such as:
# - Final package name based on system, architecture and stage.
# - Architecture flags.
# - Version, revision and commit SHA information.
runs-on: ubuntu-latest
name: Setup variables
outputs:
Expand Down Expand Up @@ -206,6 +229,8 @@ jobs:
echo "ARCHITECTURE_FLAG=$ARCHITECTURE_FLAG" >> $GITHUB_OUTPUT
validate-job:
# 1. Validates valid combinations of system and architecture.
# 2. Sets up AWS CLI for future uploads if needed.
runs-on: ubuntu-latest
needs: setup-variables
name: Validate job
Expand All @@ -231,32 +256,40 @@ jobs:
build-base:
needs: [validate-job]
name: Build dashboard
uses: wazuh/wazuh-dashboard/.github/workflows/build_base.yml@main
uses: wazuh/wazuh-dashboard/.github/workflows/5_builderpackage_wazuh_dashboard.yml@main
with:
CHECKOUT_TO: ${{ github.head_ref || github.ref_name }}
ARCHITECTURE: ${{ inputs.architecture }}

build-main-plugins:
needs: [validate-job]
name: Build plugins
uses: wazuh/wazuh-dashboard-plugins/.github/workflows/manual-build.yml@main
uses: wazuh/wazuh-dashboard-plugins/.github/workflows/5_builderpackage_manual-build.yml@main
with:
reference: ${{ inputs.reference_wazuh_plugins }}

build-security-plugin:
needs: [validate-job]
name: Build security plugin
uses: wazuh/wazuh-security-dashboards-plugin/.github/workflows/manual-build.yml@main
uses: wazuh/wazuh-security-dashboards-plugin/.github/workflows/5_builderpackage_manual-build.yml@main
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: rename the "target" (manual-build) in the workflow naming convention to something like plugins instead.

with:
reference: ${{ inputs.reference_security_plugins }}

build-report-plugin:
needs: [validate-job]
name: Build reporting plugin
uses: wazuh/wazuh-dashboards-reporting/.github/workflows/manual-build.yml@main
uses: wazuh/wazuh-dashboards-reporting/.github/workflows/5_builderpackage_manual-build.yml@main
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: rename the "target" (manual-build) in the workflow naming convention to something like plugins instead.

with:
reference: ${{ inputs.reference_report_plugins }}

build-and-test-package:
# 1. Downloads previously built artifacts.
# 2. Packages the plugins and dashboard into `.zip` files.
# 3. Executes the build script to generate the final package (`.deb` or `.rpm`).
# 4. Performs tests on the generated package.
# 5. Renames the package with the appropriate final name.
# 6. If requested, generates the `.sha512` checksum file.
# 7. Finally, uploads the resulting package as an artifact.
Comment on lines +286 to +292
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# 1. Downloads previously built artifacts.
# 2. Packages the plugins and dashboard into `.zip` files.
# 3. Executes the build script to generate the final package (`.deb` or `.rpm`).
# 4. Performs tests on the generated package.
# 5. Renames the package with the appropriate final name.
# 6. If requested, generates the `.sha512` checksum file.
# 7. Finally, uploads the resulting package as an artifact.
# 1. Download previously built artifacts.
# 2. Package the plugins and dashboard into `.zip` files.
# 3. Execute the build script to generate the final package (`.deb` or `.rpm`).
# 4. Perform tests on the generated package.
# 5. Rename the package with the appropriate final name.
# 6. If requested, generate the `.sha512` checksum file.
# 7. Finally, upload the resulting package as an artifact.

needs:
[setup-variables, build-main-plugins, build-base, build-security-plugin, build-report-plugin]
runs-on: ${{ (inputs.architecture == 'arm64' || inputs.architecture == 'aarch64') && 'wz-linux-arm64' || 'ubuntu-22.04' }}
Expand Down
87 changes: 87 additions & 0 deletions .github/workflows/5_codequality_codeql.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: codequality in the filename is not listed in the examples. I am not sure if we should use another that could be similar instead.

Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# CodeQL Workflow Configuration
#
# This workflow file will work for most projects without modifications; simply
# commit it to your repository.
#
# ## Optional Customization
# You may modify this file to:
# - Adjust the set of analyzed languages.
# - Add custom queries.
# - Include custom build logic.
#
# ## ⚠️ Important Note
# An attempt has been made to automatically detect the languages in your
# repository. Please review the `language` matrix defined below to ensure it
# includes the correct set of supported CodeQL languages.
#
# This workflow is used to perform code analysis with CodeQL:
#
# - 📅 Weekly analysis of code for vulnerabilities.
# - 🔐 Applies static security analysis using CodeQL for JavaScript and
# TypeScript.

name: Code analysis

on:
push:
branches: [ "main", "[0-9].[0-9]", "[0-9].x" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '0 8 * * 5'
workflow_dispatch:

jobs:
analyze:
name: Analyze
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: ['javascript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

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

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
77 changes: 0 additions & 77 deletions .github/workflows/codeql.yml

This file was deleted.

Loading