Compare commits

...
3 changed files with 73 additions and 94 deletions
+4 -6
View File
@@ -6,9 +6,8 @@ if [ -z "$MASTER_CONTAINERS" ]; then
echo "No containers were found with 'master' in their name."
else
for MASTER_CONTAINERS in $MASTER_CONTAINERS; do
FILEBEAT_OUTPUT=$(docker exec "$MASTER_CONTAINERS" $COMMAND_TO_EXECUTE)
FILEBEAT_STATUS=$(echo "${FILEBEAT_OUTPUT}" | grep -c OK)
if [[ $FILEBEAT_STATUS -eq 7 ]]; then
docker exec "$MASTER_CONTAINERS" $COMMAND_TO_EXECUTE
if [[ $? -eq 0 ]]; then
echo "No errors in filebeat"
echo "${FILEBEAT_OUTPUT}"
else
@@ -25,9 +24,8 @@ if [ -z "$MASTER_CONTAINERS" ]; then
echo "No containers were found with 'worker' in their name."
else
for MASTER_CONTAINERS in $MASTER_CONTAINERS; do
FILEBEAT_OUTPUT=$(docker exec "$MASTER_CONTAINERS" $COMMAND_TO_EXECUTE)
FILEBEAT_STATUS=$(echo "${FILEBEAT_OUTPUT}" | grep -c OK)
if [[ $FILEBEAT_STATUS -eq 7 ]]; then
docker exec "$MASTER_CONTAINERS" $COMMAND_TO_EXECUTE
if [[ $? -eq 0 ]]; then
echo "No errors in filebeat"
echo "${FILEBEAT_OUTPUT}"
else
+68 -88
View File
@@ -2,6 +2,14 @@ name: Wazuh Docker pipeline
on: [pull_request]
env:
ARTIFACTS_LOCAL_DIR: /home/runner/work/wazuh-docker/wazuh-docker/docker-images
ARTIFACT_NAMES: |
wazuh-manager.tar
wazuh-indexer.tar
wazuh-dashboard.tar
wazuh-agent.tar
jobs:
build-docker-images:
runs-on: codebuild-github-actions-codebuild-runner-devops-amd-${{ github.run_id }}-${{ github.run_attempt }}
@@ -31,33 +39,17 @@ jobs:
docker save wazuh/wazuh-dashboard:${{env.WAZUH_IMAGE_VERSION}} -o /home/runner/work/wazuh-docker/wazuh-docker/docker-images/wazuh-dashboard.tar
docker save wazuh/wazuh-agent:${{env.WAZUH_IMAGE_VERSION}} -o /home/runner/work/wazuh-docker/wazuh-docker/docker-images/wazuh-agent.tar
- name: Temporarily save Wazuh manager Docker image
uses: actions/upload-artifact@v7
with:
name: docker-artifact-manager
path: /home/runner/work/wazuh-docker/wazuh-docker/docker-images/wazuh-manager.tar
retention-days: 1
- name: Temporarily save Wazuh indexer Docker image
uses: actions/upload-artifact@v7
with:
name: docker-artifact-indexer
path: /home/runner/work/wazuh-docker/wazuh-docker/docker-images/wazuh-indexer.tar
retention-days: 1
- name: Temporarily save Wazuh dashboard Docker image
uses: actions/upload-artifact@v7
with:
name: docker-artifact-dashboard
path: /home/runner/work/wazuh-docker/wazuh-docker/docker-images/wazuh-dashboard.tar
retention-days: 1
- name: Temporarily save Wazuh agent Docker image
uses: actions/upload-artifact@v7
with:
name: docker-artifact-agent
path: /home/runner/work/wazuh-docker/wazuh-docker/docker-images/wazuh-agent.tar
retention-days: 1
- name: Temporarily save Wazuh Docker images
env:
S3_ARTIFACTS_PATH: s3://${{ secrets.CI_DEV_INTERNAL_S3_BUCKET }}/wazuh-docker/4_pr_check/${{ github.run_id }}
run: |
echo "Uploading Docker image artifacts to S3..."
while IFS= read -r artifact; do
[ -z "$artifact" ] && continue
echo " Uploading: $artifact"
aws s3 cp "${ARTIFACTS_LOCAL_DIR}/${artifact}" "${S3_ARTIFACTS_PATH}/${artifact}"
done <<< "$ARTIFACT_NAMES"
echo "All artifacts uploaded successfully."
check-single-node:
runs-on: codebuild-github-actions-codebuild-runner-devops-amd-${{ github.run_id }}-${{ github.run_attempt }}
@@ -76,32 +68,21 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Retrieve saved Wazuh indexer Docker image
uses: actions/download-artifact@v8
with:
name: docker-artifact-indexer
- name: Retrieve saved Wazuh manager Docker image
uses: actions/download-artifact@v8
with:
name: docker-artifact-manager
- name: Retrieve saved Wazuh dashboard Docker image
uses: actions/download-artifact@v8
with:
name: docker-artifact-dashboard
- name: Retrieve saved Wazuh agent Docker image
uses: actions/download-artifact@v8
with:
name: docker-artifact-agent
- name: Docker load
- name: Retrieve saved Wazuh Docker images and load them into Docker
env:
S3_ARTIFACTS_PATH: s3://${{ secrets.CI_DEV_INTERNAL_S3_BUCKET }}/wazuh-docker/4_pr_check/${{ github.run_id }}
ARTIFACTS_LOCAL_DIR: /home/runner/work/wazuh-docker/wazuh-docker/docker-images
run: |
docker load --input ./wazuh-indexer.tar
docker load --input ./wazuh-dashboard.tar
docker load --input ./wazuh-manager.tar
docker load --input ./wazuh-agent.tar
mkdir -p "${ARTIFACTS_LOCAL_DIR}"
echo "Downloading and loading Docker image artifacts from S3..."
while IFS= read -r artifact; do
[ -z "$artifact" ] && continue
echo " Downloading: $artifact"
aws s3 cp "${S3_ARTIFACTS_PATH}/${artifact}" "${ARTIFACTS_LOCAL_DIR}/${artifact}"
echo " Loading into Docker: $artifact"
docker load -i "${ARTIFACTS_LOCAL_DIR}/${artifact}"
done <<< "$ARTIFACT_NAMES"
echo "All artifacts downloaded and loaded successfully."
- name: Create single node certficates
run: docker compose -f single-node/generate-indexer-certs.yml run --rm generator
@@ -112,6 +93,11 @@ jobs:
- name: Check Wazuh indexer start
run: |
sleep 60
timeout 600 bash -c 'until curl -XGET "https://localhost:9200/_cluster/health" -u admin:SecretPassword -k -s | grep "green"; do sleep 5; done'
if [ $? -ne 0 ]; then
docker ps -a
exit 1
fi
status_green="`curl -XGET "https://0.0.0.0:9200/_cluster/health" -u admin:SecretPassword -k -s | grep green | wc -l`"
if [[ $status_green -eq 1 ]]; then
curl -XGET "https://0.0.0.0:9200/_cluster/health" -u admin:SecretPassword -k -s
@@ -121,6 +107,7 @@ jobs:
fi
status_index="`curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:SecretPassword -k -s | wc -l`"
status_index_green="`curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:SecretPassword -k -s | grep "green" | wc -l`"
timeout 120 bash -c 'until [ $status_index_green -eq $status_index ]; do sleep 5; done'
if [[ $status_index_green -eq $status_index ]]; then
curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:SecretPassword -k -s
else
@@ -141,6 +128,7 @@ jobs:
- name: Check Wazuh templates
run: |
timeout 360 bash -c 'until templates=$(curl -XGET "https://0.0.0.0:9200/_cat/templates" -u admin:SecretPassword -k -s | grep "wazuh" | wc -l); echo "Templates: $templates"; [ $templates -ge 3 ]; do sleep 5; done'
qty_templates="`curl -XGET "https://0.0.0.0:9200/_cat/templates" -u admin:SecretPassword -k -s | grep -P "wazuh|wazuh-agent|wazuh-statistics" | wc -l`"
templates="`curl -XGET "https://0.0.0.0:9200/_cat/templates" -u admin:SecretPassword -k -s | grep -P "wazuh|wazuh-agent|wazuh-statistics"`"
if [[ $qty_templates -gt 3 ]]; then
@@ -222,34 +210,25 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Set vm.max_map_count
run: sysctl -w vm.max_map_count=262144
- name: Retrieve saved Wazuh dashboard Docker image
uses: actions/download-artifact@v8
with:
name: docker-artifact-dashboard
- name: Retrieve saved Wazuh manager Docker image
uses: actions/download-artifact@v8
with:
name: docker-artifact-manager
- name: Retrieve saved Wazuh indexer Docker image
uses: actions/download-artifact@v8
with:
name: docker-artifact-indexer
- name: Retrieve saved Wazuh agent Docker image
uses: actions/download-artifact@v8
with:
name: docker-artifact-agent
- name: Docker load
- name: Retrieve saved Wazuh Docker images and load them into Docker
env:
S3_ARTIFACTS_PATH: s3://${{ secrets.CI_DEV_INTERNAL_S3_BUCKET }}/wazuh-docker/4_pr_check/${{ github.run_id }}
ARTIFACTS_LOCAL_DIR: /home/runner/work/wazuh-docker/wazuh-docker/docker-images
run: |
docker load --input ./wazuh-manager.tar
docker load --input ./wazuh-indexer.tar
docker load --input ./wazuh-dashboard.tar
docker load --input ./wazuh-agent.tar
rm -rf wazuh-manager.tar wazuh-indexer.tar wazuh-dashboard.tar wazuh-agent.tar
mkdir -p "${ARTIFACTS_LOCAL_DIR}"
echo "Downloading and loading Docker image artifacts from S3..."
while IFS= read -r artifact; do
[ -z "$artifact" ] && continue
echo " Downloading: $artifact"
aws s3 cp "${S3_ARTIFACTS_PATH}/${artifact}" "${ARTIFACTS_LOCAL_DIR}/${artifact}"
echo " Loading into Docker: $artifact"
docker load -i "${ARTIFACTS_LOCAL_DIR}/${artifact}"
done <<< "$ARTIFACT_NAMES"
echo "All artifacts downloaded and loaded successfully."
- name: Create multi node certficates
run: docker compose -f multi-node/generate-indexer-certs.yml run --rm generator
@@ -259,13 +238,12 @@ jobs:
- name: Check Wazuh indexer start
run: |
until [[ `curl -XGET "https://0.0.0.0:9200/_cluster/health" -u admin:SecretPassword -k -s | grep green | wc -l` -eq 1 ]]
do
echo 'Waiting for Wazuh indexer start'
free -m
df -h
sleep 120
done
sleep 120
timeout 600 bash -c 'until curl -XGET "https://localhost:9200/_cluster/health" -u admin:SecretPassword -k -s | grep -v "yellow"; do sleep 5; done'
if [ $? -ne 0 ]; then
docker ps -a
exit 1
fi
status_green="`curl -XGET "https://0.0.0.0:9200/_cluster/health" -u admin:SecretPassword -k -s | grep green | wc -l`"
if [[ $status_green -eq 1 ]]; then
curl -XGET "https://0.0.0.0:9200/_cluster/health" -u admin:SecretPassword -k -s
@@ -274,7 +252,8 @@ jobs:
exit 1
fi
status_index="`curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:SecretPassword -k -s | wc -l`"
status_index_green="`curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:SecretPassword -k -s | grep -E "green" | wc -l`"
status_index_green="`curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:SecretPassword -k -s | grep "green" | wc -l`"
timeout 120 bash -c 'until [ $status_index_green -eq $status_index ]; do sleep 5; done'
if [[ $status_index_green -eq $status_index ]]; then
curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:SecretPassword -k -s
else
@@ -294,6 +273,7 @@ jobs:
- name: Check Wazuh templates
run: |
timeout 360 bash -c 'until templates=$(curl -XGET "https://0.0.0.0:9200/_cat/templates" -u admin:SecretPassword -k -s | grep "wazuh" | wc -l); echo "Templates: $templates"; [ $templates -ge 3 ]; do sleep 5; done'
qty_templates="`curl -XGET "https://0.0.0.0:9200/_cat/templates" -u admin:SecretPassword -k -s | grep "wazuh" | wc -l`"
templates="`curl -XGET "https://0.0.0.0:9200/_cat/templates" -u admin:SecretPassword -k -s | grep "wazuh"`"
if [[ $qty_templates -gt 3 ]]; then
@@ -312,7 +292,7 @@ jobs:
echo "Wazuh Manager Services: ${services}"
echo "OK"
else
echo "Wazuh indexer nodes: ${nodes}"
echo "Wazuh Manager Services: ${services}"
curl -k -s -X GET "https://0.0.0.0:55000/manager/status?pretty=true" -H "Authorization: Bearer ${{env.TOKEN}}" | jq -r .data.affected_items
exit 1
fi
@@ -330,7 +310,7 @@ jobs:
run: ./.github/multi-node-filebeat-check.sh
- name: Check Wazuh dashboard service URL
run: |
run: |
status=$(curl -XGET --silent https://0.0.0.0:443/app/status -k -u admin:SecretPassword -I | grep -E "^HTTP" | awk '{print $2}')
if [[ $status -eq 200 ]]; then
echo "Wazuh dashboard status: ${status}"
+1
View File
@@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
### Changed
- Change artifact upload and download 4.14.6 ([#2503](https://github.com/wazuh/wazuh-docker/pull/2503))
- Change runners on repository workflows ([#2470](https://github.com/wazuh/wazuh-docker/pull/2470))
### Fixed