diff --git a/.github/workflows/5_pr_check.yml b/.github/workflows/5_pr_check.yml index 6e590412..4579e2d7 100644 --- a/.github/workflows/5_pr_check.yml +++ b/.github/workflows/5_pr_check.yml @@ -44,6 +44,7 @@ jobs: with: image_tag: ${{ needs.prepare-variables.outputs.WAZUH_IMAGE_VERSION }} docker_reference: ${{ github.head_ref || inputs.docker_reference }} + wazuh_automation_reference: 'main' commit_list: '["latest", "latest", "latest", "latest"]' id: ${{ github.run_id }} dev: true diff --git a/.github/workflows/Procedure_push_docker_images.yml b/.github/workflows/Procedure_push_docker_images.yml index 34139c3d..0f2b4113 100644 --- a/.github/workflows/Procedure_push_docker_images.yml +++ b/.github/workflows/Procedure_push_docker_images.yml @@ -13,7 +13,7 @@ on: required: true wazuh_automation_reference: description: 'Branch or tag of the wazuh-automation repository' - required: true + required: false default: 'main' products: description: 'Comma-separated list of the image names to build and push' @@ -46,7 +46,7 @@ on: type: string wazuh_automation_reference: description: 'Branch or tag of the wazuh-automation repository' - required: true + required: false default: 'main' type: string products: @@ -185,6 +185,32 @@ jobs: with: python-version: '3.12' + - name: Install and configure python and workflow dependencies + if: ${{ inputs.dev == true }} + run: | + sudo apt-get update + sudo apt-get install -y jq + # Install yq from a pinned version and verify its checksum + YQ_VERSION="v4.44.3" + YQ_BINARY="yq_linux_amd64" + YQ_BASE_URL="https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}" + wget -q "${YQ_BASE_URL}/checksums" -O /tmp/yq_checksums + wget -q "${YQ_BASE_URL}/${YQ_BINARY}" -O /tmp/${YQ_BINARY} + EXPECTED_SHA256="$(grep " ${YQ_BINARY}$" /tmp/yq_checksums | awk '{print $1}')" + ACTUAL_SHA256="$(sha256sum /tmp/${YQ_BINARY} | awk '{print $1}')" + if [ -z "$EXPECTED_SHA256" ] || [ "$EXPECTED_SHA256" != "$ACTUAL_SHA256" ]; then + echo "yq checksum verification failed" >&2 + exit 1 + fi + sudo mv /tmp/${YQ_BINARY} /usr/bin/yq + sudo chmod +x /usr/bin/yq + rm -f /tmp/yq_checksums + sudo apt-get install -y python3-venv + python3 -m venv ${{ env.WORKFLOW_VENV }} + source ${{ env.WORKFLOW_VENV }}/bin/activate + pip install --upgrade pip + pip install pyyaml + - name: Get Wazuh version if: ${{ inputs.dev == true }} run: | @@ -201,19 +227,6 @@ jobs: LOCAL_AWS_S3_BUCKET_DEV=${{ vars.AWS_S3_BUCKET_DEV }} echo LOCAL_AWS_S3_BUCKET_DEV=$LOCAL_AWS_S3_BUCKET_DEV >> $GITHUB_ENV - - name: Install and configure python and workflow dependencies - if: ${{ inputs.dev == true }} - run: | - sudo apt-get update - sudo apt-get install -y jq - sudo wget -q https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq - sudo chmod +x /usr/bin/yq - sudo apt-get install -y python3-venv - python3 -m venv ${{ env.WORKFLOW_VENV }} - source ${{ env.WORKFLOW_VENV }}/bin/activate - pip install --upgrade pip - pip install pyyaml - - name: Generate presigned URLs for artifacts for dev packages if: ${{ inputs.dev == true }} run: | @@ -225,6 +238,15 @@ jobs: COMPONENTS=($(echo "$WAZUH_COMPONENTS" | jq -r '.[]')) REVISIONS=($(echo "$COMMIT_LIST" | jq -r '.[]')) + # Ensure the number of components matches the number of revisions + if [[ ${#COMPONENTS[@]} -ne ${#REVISIONS[@]} ]]; then + echo "Error: WAZUH_COMPONENTS and COMMIT_LIST length mismatch." >&2 + echo " Components: ${#COMPONENTS[@]}, Revisions: ${#REVISIONS[@]}." >&2 + echo " WAZUH_COMPONENTS=${WAZUH_COMPONENTS}" >&2 + echo " COMMIT_LIST=${COMMIT_LIST}" >&2 + exit 1 + fi + # Map revisions to component names for i in "${!COMPONENTS[@]}"; do case "${COMPONENTS[$i]}" in diff --git a/CHANGELOG.md b/CHANGELOG.md index a8bda688..c3bf3a1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ All notable changes to this project will be documented in this file. ### Changed -- Added script to pre-signed internal packages URLs. ([#2259](https://github.com/wazuh/wazuh-docker/pull/2259)) +- Use URL signing script to generate presigned internal package URLs. ([#2259](https://github.com/wazuh/wazuh-docker/pull/2259)) - Update certificate configuration to use separate IP and DNS fields ([#2253](https://github.com/wazuh/wazuh-docker/pull/2253)) - Modify Healthchecks ([#2252](https://github.com/wazuh/wazuh-docker/pull/2252)) - Add deployment healthchecks ([#2251](https://github.com/wazuh/wazuh-docker/pull/2251))