diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 156323c6..f3d6bd69 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -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: ${{ 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: ${{ 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 @@ -223,33 +204,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: ${{ 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 f9ef5e3f..8799adf1 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 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