Enhance script execution of build and improve docs clarity

This commit is contained in:
Jesus Garcia
2025-12-17 01:37:49 -05:00
parent 424559518e
commit 089ce24ffc
3 changed files with 23 additions and 11 deletions
+10 -3
View File
@@ -42,7 +42,7 @@ build() {
if [ "${WAZUH_DEV_STAGE}" ];then if [ "${WAZUH_DEV_STAGE}" ];then
FILEBEAT_TEMPLATE_BRANCH="v${FILEBEAT_TEMPLATE_BRANCH}-${WAZUH_DEV_STAGE,,}" FILEBEAT_TEMPLATE_BRANCH="v${FILEBEAT_TEMPLATE_BRANCH}-${WAZUH_DEV_STAGE,,}"
if ! curl --output /dev/null --silent --head --fail "https://github.com/wazuh/wazuh/tree/${FILEBEAT_TEMPLATE_BRANCH}"; then if ! curl --output /dev/null --silent --head --fail "https://github.com/wazuh/wazuh/tree/${FILEBEAT_TEMPLATE_BRANCH}"; then
echo "The indicated branch does not exist in the wazuh/wazuh repository: ${FILEBEAT_TEMPLATE_BRANCH}" echo "The indicated branch does not exist in the wazuh/wazuh repository: ${FILEBEAT_TEMPLATE_BRANCH}"
clean 1 clean 1
fi fi
else else
@@ -71,9 +71,16 @@ build() {
set +a set +a
if [ "${MULTIARCH}" ];then if [ "${MULTIARCH}" ];then
docker buildx bake --file build-images.yml --push --set *.platform=linux/amd64,linux/arm64 --no-cache || clean 1 docker buildx bake \
--file build-images.yml \
--push \
--set *.platform=linux/amd64,linux/arm64 \
--no-cache || clean 1
else else
docker buildx bake --file build-images.yml --no-cache|| clean 1 docker buildx bake \
--file build-images.yml \
--load \
--no-cache || clean 1
fi fi
return 0 return 0
} }
+4 -4
View File
@@ -21,7 +21,7 @@ Run the following script to build the wazuh-certs-generator docker image
./build-image.sh -v <IMAGE_TAG> [-m] [-rg <REGISTRY>] ./build-image.sh -v <IMAGE_TAG> [-m] [-rg <REGISTRY>]
``` ```
Replace <IMAGE_TAG> with the new image desired tag. - Replace <IMAGE_TAG> with the new image desired tag.
Use the `-m` flag to build a multi-architecture image (supports both `amd64` and `arm64`) - Use the `-m` flag to build a multi-architecture image (supports both `amd64` and `arm64`)
Use the `-rg <REGISTRY>` parameter to specify a custom Docker registry (default is Docker Hub) - If multiarch build is enabled, the script will attempt to push the image to the specified registry. This image upload will only work if credentials are properly configured.
By default, the script will attempt to push the image to the registry and will only work if credentials are properly configured. - Use the `-rg <REGISTRY>` parameter to specify a custom Docker registry (default is Docker Hub)
+7 -2
View File
@@ -37,11 +37,16 @@ build() {
set +a set +a
if [ "${MULTIARCH}" ]; then if [ "${MULTIARCH}" ]; then
docker buildx bake --file build-image.yml \ docker buildx bake \
--file build-image.yml \
--set *.platform=linux/amd64,linux/arm64 \ --set *.platform=linux/amd64,linux/arm64 \
--push \
--no-cache || clean 1 --no-cache || clean 1
else else
docker buildx bake --file build-image.yml --no-cache || clean 1 docker buildx bake \
--file build-image.yml \
--load \
--no-cache || clean 1
fi fi
return 0 return 0
} }