From 052fb765ed2d0d10148ff7331b8be666264b1992 Mon Sep 17 00:00:00 2001 From: Jesus Garcia Date: Mon, 9 Feb 2026 13:25:44 -0500 Subject: [PATCH] Compute component references dynamically --- .../workflows/Procedure_push_docker_images.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Procedure_push_docker_images.yml b/.github/workflows/Procedure_push_docker_images.yml index 1546bb6b..3b750ceb 100644 --- a/.github/workflows/Procedure_push_docker_images.yml +++ b/.github/workflows/Procedure_push_docker_images.yml @@ -377,6 +377,19 @@ jobs: name: presigned-artifact-urls-${{ github.run_id }} path: ./build-docker-images + - name: Compute component reference (dev) + if: ${{ inputs.dev == true }} + run: | + COMPONENT='${{ matrix.wazuh_component }}' + WAZUH_COMPONENTS='${{ needs.setup.outputs.WAZUH_COMPONENTS }}' + COMMIT_LIST='${{ needs.setup.outputs.COMMIT_LIST }}' + + idx=$(jq -r --arg c "$COMPONENT" 'index($c)' <<<"$WAZUH_COMPONENTS") + ref=$(jq -r --argjson i "$idx" '.[ $i ]' <<<"$COMMIT_LIST") + + echo "COMPONENT_REFS_JSON=[\"$ref\"]" >> "$GITHUB_ENV" + echo "Using component ref for $COMPONENT: $ref" + - name: Build Wazuh images run: | if [[ "$IMAGE_TAG" == *"-"* ]]; then @@ -394,7 +407,7 @@ jobs: -d $DEV_STAGE \ -rg $IMAGE_REGISTRY \ -m \ - -refs "${{ needs.setup.outputs.COMMIT_LIST }}" \ + -refs "$COMPONENT_REFS_JSON" \ -c ${{ matrix.wazuh_component }} else ./build-images.sh \ @@ -412,7 +425,7 @@ jobs: -r $REVISION \ -rg $IMAGE_REGISTRY \ -m \ - -refs "${{ needs.setup.outputs.COMMIT_LIST }}" \ + -refs "$COMPONENT_REFS_JSON" \ -c ${{ matrix.wazuh_component }} else ./build-images.sh \