Skip to content

Commit 40dac86

Browse files
Merge 4.14.9 into 5.0.0 (#1563)
Merge 4.14.8 into 4.14.9 (#1562) Merge pull request #1507 from wazuh/change/1506-add-dev-image-construction-in-4x Add dev image build tooling for 4.14.x # Conflicts: # dev-tools/build-dev-image/README.md # dev-tools/build-dev-image/build-multiarch.sh # dev-tools/build-dev-image/install-plugins.sh # dev-tools/build-dev-image/plugins # dev-tools/build-dev-image/warmup-opensearch_dashboards.yml # dev-tools/build-dev-image/warmup-optimizer.sh # dev-tools/build-dev-image/wzd.dockerfile
1 parent b3e783b commit 40dac86

1 file changed

Lines changed: 148 additions & 0 deletions

File tree

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# This workflow automates the build and push of Wazuh dashboard development
2+
# Docker images for different architectures (amd64 and arm64).
3+
#
4+
# This workflow:
5+
# - Builds multi-architecture Docker images for Wazuh dashboard development.
6+
# - Pushes individual architecture images to Quay.io registry.
7+
# - Creates and pushes a multi-arch manifest combining both architectures.
8+
# - Automatically extracts the Node.js version from .nvmrc and the OpenSearch
9+
# Dashboards version from package.json.
10+
# - Uses the branch the workflow runs on for wazuh-dashboard, and a single
11+
# optional input for the branch/tag of the plugin repositories
12+
# (wazuh-security-dashboards-plugin and wazuh-dashboard-plugins), which
13+
# defaults to that same branch when not provided.
14+
15+
name: (4.14.x) Build and Push Dev Image
16+
17+
on:
18+
workflow_dispatch:
19+
inputs:
20+
plugins_branch:
21+
description: 'Branch/tag/commit of wazuh-security-dashboards-plugin and wazuh-dashboard-plugins (defaults to the branch this workflow runs on)'
22+
required: false
23+
default: ''
24+
type: string
25+
tag:
26+
description: 'Tag for the Docker image'
27+
required: false
28+
default: ''
29+
type: string
30+
31+
jobs:
32+
extract-versions:
33+
runs-on: codebuild-github-actions-codebuild-runner-dashboard-amd-${{ github.run_id }}-${{ github.run_attempt }}
34+
outputs:
35+
node_version: ${{ steps.versions.outputs.node_version }}
36+
opensearch_version: ${{ steps.versions.outputs.opensearch_version }}
37+
tag: ${{ steps.versions.outputs.tag }}
38+
wazuh_branch: ${{ steps.versions.outputs.wazuh_branch }}
39+
plugins_branch: ${{ steps.versions.outputs.plugins_branch }}
40+
steps:
41+
- name: Checkout code
42+
uses: actions/checkout@v4
43+
44+
- name: Extract versions from repository
45+
id: versions
46+
run: |
47+
OPENSEARCH_VERSION=$(node -p "require('./package.json').version")
48+
NODE_VERSION=$(cat .nvmrc)
49+
50+
WAZUH_BRANCH="${{ github.ref_name }}"
51+
PLUGINS_BRANCH="${{ inputs.plugins_branch || github.ref_name }}"
52+
53+
TAG="${{ inputs.tag }}"
54+
if [ -z "$TAG" ]; then
55+
TAG="$OPENSEARCH_VERSION"
56+
fi
57+
58+
echo "node_version=${NODE_VERSION}" >> $GITHUB_OUTPUT
59+
echo "opensearch_version=${OPENSEARCH_VERSION}" >> $GITHUB_OUTPUT
60+
echo "tag=${TAG}" >> $GITHUB_OUTPUT
61+
echo "wazuh_branch=${WAZUH_BRANCH}" >> $GITHUB_OUTPUT
62+
echo "plugins_branch=${PLUGINS_BRANCH}" >> $GITHUB_OUTPUT
63+
64+
echo "📦 OpenSearch Dashboards Version: ${OPENSEARCH_VERSION}"
65+
echo "🏷️ Tag: ${TAG}"
66+
echo "📟 Node Version: ${NODE_VERSION}"
67+
echo "🌿 Wazuh Dashboard Branch: ${WAZUH_BRANCH}"
68+
echo "🌿 Plugins Branch: ${PLUGINS_BRANCH}"
69+
70+
build:
71+
runs-on: ${{ matrix.runner }}
72+
needs: [extract-versions]
73+
strategy:
74+
matrix:
75+
include:
76+
- platform: linux/amd64
77+
runner: ${{ format('codebuild-github-actions-codebuild-runner-dashboard-amd-{0}-{1}', github.run_id, github.run_attempt) }}
78+
arch: amd64
79+
- platform: linux/arm64
80+
runner: ${{ format('codebuild-github-actions-codebuild-runner-dashboard-arm-{0}-{1}', github.run_id, github.run_attempt) }}
81+
arch: arm64
82+
steps:
83+
- name: Checkout code
84+
uses: actions/checkout@v4
85+
86+
# Workaround: AWS CodeBuild runners do not start the Docker daemon automatically
87+
- name: Start Docker daemon
88+
run: |
89+
sudo nohup dockerd --storage-driver vfs > /var/log/dockerd.log 2>&1 &
90+
timeout 60 bash -c 'until docker info &>/dev/null 2>&1; do sleep 1; done'
91+
92+
- name: Set up Docker Buildx
93+
uses: docker/setup-buildx-action@v3
94+
with:
95+
driver-opts: |
96+
network=host
97+
98+
- name: Login to Quay.io
99+
uses: docker/login-action@v3
100+
with:
101+
registry: quay.io
102+
username: ${{ secrets.QUAY_USERNAME }}
103+
password: ${{ secrets.QUAY_TOKEN }}
104+
105+
- name: Build ${{ matrix.arch }} image
106+
run: |
107+
chmod +x ./dev-tools/build-dev-image/build-multiarch.sh
108+
cd ./dev-tools/build-dev-image
109+
110+
./build-multiarch.sh \
111+
--node-version "${{ needs.extract-versions.outputs.node_version }}" \
112+
--wazuh-branch "${{ needs.extract-versions.outputs.wazuh_branch }}" \
113+
--security-branch "${{ needs.extract-versions.outputs.plugins_branch }}" \
114+
--plugins-branch "${{ needs.extract-versions.outputs.plugins_branch }}" \
115+
--tag "${{ needs.extract-versions.outputs.tag }}-${{ matrix.arch }}" \
116+
--platform "${{ matrix.platform }}" \
117+
--push
118+
119+
create-manifest:
120+
runs-on: codebuild-github-actions-codebuild-runner-dashboard-amd-${{ github.run_id }}-${{ github.run_attempt }}
121+
needs: [extract-versions, build]
122+
steps:
123+
# Workaround: AWS CodeBuild runners do not start the Docker daemon automatically
124+
- name: Start Docker daemon
125+
run: |
126+
sudo nohup dockerd --storage-driver vfs > /var/log/dockerd.log 2>&1 &
127+
timeout 60 bash -c 'until docker info &>/dev/null 2>&1; do sleep 1; done'
128+
129+
- name: Set up Docker Buildx
130+
uses: docker/setup-buildx-action@v3
131+
132+
- name: Login to Quay.io
133+
uses: docker/login-action@v3
134+
with:
135+
registry: quay.io
136+
username: ${{ secrets.QUAY_USERNAME }}
137+
password: ${{ secrets.QUAY_TOKEN }}
138+
139+
- name: Create and push multi-arch manifest
140+
run: |
141+
TAG="${{ needs.extract-versions.outputs.tag }}"
142+
143+
docker buildx imagetools create -t quay.io/wazuh/osd-dev:${TAG} \
144+
quay.io/wazuh/osd-dev:${TAG}-amd64 \
145+
quay.io/wazuh/osd-dev:${TAG}-arm64
146+
147+
echo "✅ Multi-arch manifest created and pushed!"
148+
echo "📦 Image available at: quay.io/wazuh/osd-dev:${TAG}"

0 commit comments

Comments
 (0)