From 5a9355c1aeb744fc0e8401dce1e8e93aad0490a0 Mon Sep 17 00:00:00 2001 From: Victor Carlos Erenu Date: Tue, 30 Jun 2026 20:38:52 +0700 Subject: [PATCH] Change upload and download methods --- .github/workflows/4_pr_check.yml | 125 ++++++++++++------------------- CHANGELOG.md | 1 + 2 files changed, 48 insertions(+), 78 deletions(-) diff --git a/.github/workflows/4_pr_check.yml b/.github/workflows/4_pr_check.yml index ece3e842..e5a11083 100644 --- a/.github/workflows/4_pr_check.yml +++ b/.github/workflows/4_pr_check.yml @@ -12,6 +12,14 @@ on: - 'wazuh-agent/**' - '.github/**' +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 }} @@ -41,33 +49,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: ${{ 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 }} @@ -86,32 +78,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 @@ -233,33 +214,21 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - - 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 diff --git a/CHANGELOG.md b/CHANGELOG.md index bd1156ff..31447766 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file. ### Changed +- Change upload and download methods ([#2504](https://github.com/wazuh/wazuh-docker/pull/2504)) - PR revamp modifications 4.x ([#2445](https://github.com/wazuh/wazuh-docker/pull/2445)) ### Fixed