forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/4.10.2' into merge-4.10.1-into-4…
….10.2
- Loading branch information
Showing
30 changed files
with
827 additions
and
946 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,8 @@ on: | |
options: | ||
- amd64 | ||
- x86_64 | ||
- aarch64 | ||
- arm64 | ||
default: amd64 | ||
revision: | ||
type: string | ||
|
@@ -159,11 +161,11 @@ jobs: | |
steps: | ||
- name: Validate inputs | ||
run: | | ||
if [ "${{ inputs.architecture }}" = "amd64" ] && [ "${{ inputs.system }}" = "rpm" ]; then | ||
if [[ "${{ inputs.architecture }}" == "amd64" || "${{ inputs.architecture }}" == "arm64" ]] && [[ "${{ inputs.system }}" == "rpm" ]]; then | ||
echo "Invalid combination of architecture and system" | ||
exit 1 | ||
fi | ||
if [ "${{ inputs.architecture }}" = "x86_64" ] && [ "${{ inputs.system }}" = "deb" ]; then | ||
if [[ "${{ inputs.architecture }}" == "x86_64" || "${{ inputs.architecture }}" == "aarch64" ]] && [[ "${{ inputs.system }}" == "deb" ]]; then | ||
echo "Invalid combination of architecture and system" | ||
exit 1 | ||
fi | ||
|
@@ -178,21 +180,22 @@ jobs: | |
build-base: | ||
needs: [validate-job] | ||
name: Build dashboard | ||
uses: wazuh/wazuh-dashboard/.github/workflows/[email protected].1 | ||
uses: wazuh/wazuh-dashboard/.github/workflows/[email protected].2 | ||
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/[email protected].1 | ||
uses: wazuh/wazuh-dashboard-plugins/.github/workflows/[email protected].2 | ||
with: | ||
reference: ${{ inputs.reference_wazuh_plugins }} | ||
|
||
build-security-plugin: | ||
needs: [validate-job] | ||
name: Build security plugin | ||
uses: wazuh/wazuh-security-dashboards-plugin/.github/workflows/[email protected].1 | ||
uses: wazuh/wazuh-security-dashboards-plugin/.github/workflows/[email protected].2 | ||
with: | ||
reference: ${{ inputs.reference_security_plugins }} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v4.10.1 | ||
v4.10.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,56 @@ | ||
# Package building | ||
This folder contains tools used to create `rpm` and `deb` packages. | ||
|
||
This folder contains tools used to create `tar`, `rpm` and `deb` packages. | ||
|
||
## Requirements | ||
- A system with Docker. | ||
- Internet connection (to download the docker images the first time). | ||
|
||
## Builders | ||
- A system with Docker. | ||
- Internet connection (to download the docker images the first time). | ||
|
||
### Tarball | ||
## How to build packages | ||
|
||
To system packages (deb and rpm), a tarball of Wazuh dashboard `.tar.gz` is required. | ||
This tarball contains the [Wazuh plugin][wazuh-plugin], the [Wazuh Security plugin][wazuh-security-plugin], | ||
a set of OpenSearch plugins and the default configuration for the app. | ||
The script `build-packages.sh` is in charge of coordinating the different steps to build each type of packages. | ||
|
||
The `generate_base.sh` script generates a `.tar.gz` file using the following inputs: | ||
- `-a` | `--app`: URL to the zipped Wazuh plugin.* | ||
- `-b` | `--base`: URL to the Wazuh dashboard `.tar.gz`, as generated with `yarn build --skip-os-packages --release`.* | ||
- `-s` | `--security`: URL to the zipped Wazuh Security plugin, as generated with `yarn build`.* | ||
- `-v` | `--version`: the Wazuh version of the package. | ||
- `-r` | `--revision`: [Optional] Set the revision of the build. By default, it is set to 1. | ||
- `-o` | `--output` [Optional] Set the destination path of package. By default, an output folder will be created in the same directory as the script. | ||
### Pre-requisites | ||
|
||
*Note:* use `file://<absolute_path>` to indicate a local file. Otherwise, the script will try to download the file from the given URL. | ||
The script needs 3 different zip files, containing the following respectively: | ||
|
||
Example: | ||
```bash | ||
bash generate_base.sh \ | ||
--app https://packages-dev.wazuh.com/pre-release/ui/dashboard/wazuh-4.6.0-1.zip \ | ||
--base file:///home/user/wazuh-dashboard/target/opensearch-dashboards-2.4.1-linux-x64.tar.gz \ | ||
--security file:///home/user/wazuh-security-dashboards-plugin/build/security-dashboards-2.4.1.0.zip \ | ||
--version 4.6.0 | ||
``` | ||
- The base of Wazuh Dashboard, generated by running `yarn build --linux --skip-os-packages --release` or `yarn build --linux-arm --skip-os-packages --release` for arm packages | ||
- The build of each plugin in `wazuh-dashboard-plugins` repo | ||
- The build of the `wazuh-security-dashboards-plugin` repo | ||
|
||
### DEB | ||
### Building packages | ||
|
||
The `launcher.sh` script generates a `.deb` package based on the previously generated `.tar.gz`. | ||
A Docker container is used to generate the package. It takes the following inputs: | ||
- `-v` | `--version`: the Wazuh version of the package. | ||
- `-p` | `--package`: the location of the `.tar.gz` file. It can be a URL or a PATH, with the format `file://<absolute_path>` | ||
- `-r` | `--revision`: [Optional] Set the revision of the build. By default, it is set to 1. | ||
- `-o` | `--output` [Optional] Set the destination path of package. By default, an output folder will be created in the same directory as the script. | ||
- `--dont-build-docker`: [Optional] Locally built Docker image will be used instead of generating a new one. | ||
The script can build a `.tar.gz` (former base), and `rpm` and `deb` packages. This can be for x64 and arm architectures (it is not cross-architecture building. You need to run the script in a machine of the same architecture that you are building). | ||
|
||
Example: | ||
```bash | ||
bash launcher.sh \ | ||
--version 4.6.0 \ | ||
--package file:///home/user/wazuh-dashboard/dev_tools/build_packages/base/output/wazuh-dashboard-4.6.0-1-linux-x64.tar.gz | ||
``` | ||
The inputs are the following: | ||
|
||
- `-a`, `--app`: URL or path to the zip that contains the `wazuh-dashboard-plugins` plugins build. | ||
- `-b`, `--base`: URL or path to the zip that contains the `wazuh-dashboard build`. | ||
- `-s`, `--security`: URL or path to the zip that contains the `wazuh-security-dashboards-plugin` build. | ||
- `-v`, `--version`: Set the version of this build. | ||
- `-r`, `--revision`: [Optional] Set the revision of this build. By default, it is set to 1. | ||
- `--all-platforms`: Build all platforms. | ||
- `--deb`: Build deb. | ||
- `--rpm`: Build rpm. | ||
- `--tar`: Build tar.gz. | ||
- `--production`:[Optional] The naming of the package will be ready for production. Otherwise, it will include the hash of the current commit. | ||
- `--arm`: [Optional] Build for arm64 instead of x64. | ||
- `--debug`: [Optional] Enables debug mode, which will show detailed information during the script run. | ||
- `--silent`: [Optional] Enables silent mode, which will show the minimum possible information during the script run. `--debug` has priority over this. | ||
|
||
### RPM | ||
> [!IMPORTANT] | ||
> In the inputs where a local path is available, use `file://<absolute_path>` to indicate it. | ||
The `launcher.sh` script generates a `.rpm` package based on the previously generated `.tar.gz`. | ||
A Docker container is used to generate the package. It takes the following inputs: | ||
- `-v` | `--version`: the Wazuh version of the package. | ||
- `-p` | `--package`: the location of the `.tar.gz` file. It can be a URL or a PATH, with the format `file://<absolute_path>` | ||
- `-r` | `--revision`: [Optional] Set the revision of the build. By default, it is set to 1. | ||
- `-o` | `--output` [Optional] Set the destination path of package. By default, an output folder will be created in the same directory as the script. | ||
- `--dont-build-docker`: [Optional] Locally built Docker image will be used instead of generating a new one. | ||
> [!WARNING] | ||
> To build `arm` packages, you need to run the script in an arm machine, and use an arm build of the wazuh-dashboard base with `-b` | ||
Example: | ||
|
||
```bash | ||
bash launcher.sh \ | ||
--version 4.6.0 \ | ||
--package file:///home/user/wazuh-dashboard/dev_tools/build_packages/base/output/wazuh-dashboard-4.6.0-1-linux-x64.tar.gz | ||
bash build-packages.sh \ | ||
--app file:///home/user/packages/wazuh-package.zip \ | ||
--base file:///home/user/packages/dashboard-package.zip \ | ||
--security file:///home/user/packages/security-package.zip \ | ||
--version 4.10.0 --revision 2 --deb --silent | ||
``` | ||
|
||
[wazuh-plugin]: https://github.com/wazuh/wazuh-kibana-app | ||
[wazuh-security-plugin]: https://github.com/wazuh/wazuh-security-dashboards-plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Package building | ||
|
||
This folder contains the tools used to create packages from the different repositories necessary for the creation of deb and rpm packages. | ||
|
||
## Requirements | ||
|
||
- A system with Docker. | ||
- Internet connection (to download the docker images the first time). | ||
|
||
## How to build packages | ||
|
||
The script `run-docker-compose.sh` is in charge of coordinating the different steps to build each package. | ||
|
||
### Building packages | ||
|
||
The script can build a `.tar.gz` (former base), and `rpm` and `deb` packages. This can be for x64 and arm architectures (it is not cross-architecture building. You need to run the script in a machine of the same architecture that you are building). | ||
|
||
The inputs are the following: | ||
|
||
- `-a`, `--app`: Set the `wazuh-dashboard-plugins` branch. | ||
- `-b`, `--base`: Set the `wazuh-dashboard` branch. | ||
- `-s`, `--security`: Set the `wazuh-security-dashboards-plugin` branch. | ||
- `--node-version`: [Optional] Set the node version. | ||
- `--arm`: [Optional] Build for arm64 instead of x64. | ||
|
||
Example: | ||
|
||
```bash | ||
bash run-docker-compose.sh \ | ||
--app 4.10.2 \ | ||
--base 4.10.2 \ | ||
--security 4.10.2 \ | ||
--arm \ | ||
--node-version 18.19.0 | ||
``` | ||
|
||
This example will create a packages folder that inside will have the packages divided by repository of the 4.10.2 branch of each one. |
31 changes: 31 additions & 0 deletions
31
dev-tools/build-packages/base-packages-to-base/base-packages.Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Usage: | ||
# docker build \ | ||
# --build-arg NODE_VERSION=18.19.0 \ | ||
# --build-arg WAZUH_DASHBOARD_BRANCH=4.10.2 \ | ||
# --build-arg WAZUH_DASHBOARD_SECURITY_BRANCH=4.10.2 \ | ||
# --build-arg WAZUH_DASHBOARD_PLUGINS_BRANCH=4.10.2 \ | ||
# --build-arg ARCHITECTURE=arm \ | ||
# -t wazuh-packages-to-base:4.10.2 \ | ||
# -f base-packages.Dockerfile . | ||
|
||
ARG NODE_VERSION=18.19.0 | ||
FROM node:${NODE_VERSION} AS base | ||
ARG ARCHITECTURE='amd' | ||
ARG WAZUH_DASHBOARD_BRANCH | ||
ARG WAZUH_DASHBOARD_SECURITY_BRANCH | ||
ARG WAZUH_DASHBOARD_PLUGINS_BRANCH | ||
ENV OPENSEARCH_DASHBOARDS_VERSION=2.16.0 | ||
ENV ENV_ARCHITECTURE=${ARCHITECTURE} | ||
USER root | ||
RUN apt-get update && apt-get install -y jq | ||
USER node | ||
ADD ./clone-plugins.sh /home/node/clone-plugins.sh | ||
ADD ./repositories/wazuh-dashboard.sh /home/node/repositories/wazuh-dashboard.sh | ||
ADD ./repositories/plugins/wazuh-security-dashboards-plugin.sh /home/node/repositories/plugins/wazuh-security-dashboards-plugin.sh | ||
ADD ./repositories/plugins/wazuh-dashboard-plugins.sh /home/node/repositories/plugins/wazuh-dashboard-plugins.sh | ||
RUN bash /home/node/clone-plugins.sh | ||
|
||
FROM node:${NODE_VERSION} | ||
USER node | ||
COPY --chown=node:node --from=base /home/node/packages /home/node/packages | ||
WORKDIR /home/node/packages |
16 changes: 16 additions & 0 deletions
16
dev-tools/build-packages/base-packages-to-base/clone-plugins.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
base_path_plugins="/home/node/app/plugins" | ||
base_path_repositories_scripts="/home/node/repositories" | ||
base_path_repositories_plugins_scripts="/home/node/repositories/plugins" | ||
plugins=$(ls $base_path_repositories_plugins_scripts) | ||
|
||
mkdir /home/node/packages | ||
echo "Cloning Wazuh dashboards" | ||
source $base_path_repositories_scripts/wazuh-dashboard.sh | ||
|
||
for plugin in $plugins; do | ||
echo "Cloning $plugin" | ||
source $base_path_repositories_plugins_scripts/$plugin | ||
done | ||
|
||
|
||
|
22 changes: 22 additions & 0 deletions
22
dev-tools/build-packages/base-packages-to-base/docker-compose.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
services: | ||
base: | ||
image: base-${WAZUH_DASHBOARD_BRANCH}-${WAZUH_SECURITY_PLUGIN_BRANCH}-${WAZUH_DASHBOARD_PLUGINS_BRANCH}-${ARCHITECTURE} | ||
build: | ||
context: . | ||
dockerfile: base-packages.Dockerfile | ||
args: | ||
NODE_VERSION: ${NODE_VERSION} | ||
WAZUH_DASHBOARD_BRANCH: ${WAZUH_DASHBOARD_BRANCH} | ||
WAZUH_DASHBOARD_SECURITY_BRANCH: ${WAZUH_SECURITY_PLUGIN_BRANCH} | ||
WAZUH_DASHBOARD_PLUGINS_BRANCH: ${WAZUH_DASHBOARD_PLUGINS_BRANCH} | ||
ARCHITECTURE: ${ARCHITECTURE} | ||
container_name: base-${WAZUH_DASHBOARD_BRANCH}-${WAZUH_SECURITY_PLUGIN_BRANCH}-${WAZUH_DASHBOARD_PLUGINS_BRANCH}-${ARCHITECTURE} | ||
environment: | ||
OPENSEARCH_DASHBOARDS_VERSION: 2.16.0 | ||
volumes: | ||
- ./:/home/node/output | ||
command: > | ||
bash -c ' | ||
cp -r /home/node/packages /home/node/output | ||
' |
17 changes: 17 additions & 0 deletions
17
...ools/build-packages/base-packages-to-base/repositories/plugins/wazuh-dashboard-plugins.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
base_path_plugins="/home/node/app/plugins" | ||
cd $base_path_plugins | ||
git clone --depth 1 --branch ${WAZUH_DASHBOARD_PLUGINS_BRANCH} https://github.com/wazuh/wazuh-dashboard-plugins.git | ||
wazuh_dashboard_plugins=$(ls $base_path_plugins/wazuh-dashboard-plugins/plugins) | ||
mv wazuh-dashboard-plugins/plugins/* ./ | ||
mkdir /home/node/packages/wazuh-dashboard-plugins | ||
for wazuh_dashboard_plugin in $wazuh_dashboard_plugins; do | ||
cd $base_path_plugins/$wazuh_dashboard_plugin | ||
yarn install | ||
echo "Building $wazuh_dashboard_plugin" | ||
yarn build | ||
echo "Copying $wazuh_dashboard_plugin" | ||
package_name=$(jq -r '.id' ./opensearch_dashboards.json) | ||
cp $base_path_plugins/$wazuh_dashboard_plugin/build/$package_name-$OPENSEARCH_DASHBOARDS_VERSION.zip /home/node/packages/wazuh-dashboard-plugins/$package_name-$OPENSEARCH_DASHBOARDS_VERSION.zip | ||
done | ||
cd $base_path_plugins | ||
rm -rf wazuh-dashboard-plugins |
10 changes: 10 additions & 0 deletions
10
...d-packages/base-packages-to-base/repositories/plugins/wazuh-security-dashboards-plugin.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Clone the Wazuh security plugin | ||
cd /home/node/app/plugins | ||
git clone --depth 1 --branch ${WAZUH_DASHBOARD_SECURITY_BRANCH} https://github.com/wazuh/wazuh-security-dashboards-plugin.git | ||
cd wazuh-security-dashboards-plugin | ||
yarn install | ||
echo "Building Wazuh security plugin" | ||
yarn build | ||
echo "Copying Wazuh security plugin" | ||
mkdir /home/node/packages/wazuh-security-dashboards-plugin | ||
cp -r build/* /home/node/packages/wazuh-security-dashboards-plugin |
Oops, something went wrong.