From 95e251f2f2417af9206ee6400ee2b89a97d0e250 Mon Sep 17 00:00:00 2001 From: darnodo Date: Sun, 7 Dec 2025 21:06:39 +0100 Subject: [PATCH] ci(workflows): rename output variable `matrix` to `image_list` The variable name `matrix` in the `detect-changes` job output was ambiguous and potentially confusing, as `matrix` is a reserved keyword in Gitea/GitHub Actions syntax for defining job strategies. This change renames the output variable to `image_list` to better reflect its content (a JSON array of image names) and avoid naming conflicts or confusion with the actual `strategy.matrix` configuration. Changes: - Renamed output `matrix` to `image_list` in `detect-changes` job. - Updated all shell script references in the change detection logic. - Updated the consumer job `build-push-images` to use `needs.detect-changes.outputs.image_list`. --- .gitea/workflows/build-images.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/build-images.yml b/.gitea/workflows/build-images.yml index 2e53ad9..a128841 100644 --- a/.gitea/workflows/build-images.yml +++ b/.gitea/workflows/build-images.yml @@ -23,7 +23,7 @@ jobs: container: image: alpine:3.20 outputs: - matrix: ${{ steps.changes.outputs.matrix }} + image_list: ${{ steps.changes.outputs.image_list }} has_changes: ${{ steps.changes.outputs.has_changes }} steps: - name: Install dependencies @@ -49,20 +49,20 @@ jobs: if [ -d "images/$IMAGE" ] && [ -f "images/$IMAGE/Dockerfile" ]; then echo "DEBUG: Image directory and Dockerfile exist." # Use printf for safer output - printf "matrix=[\"%s\"]\n" "$IMAGE" >> $GITHUB_OUTPUT + printf "image_list=[\"%s\"]\n" "$IMAGE" >> $GITHUB_OUTPUT echo "has_changes=true" >> $GITHUB_OUTPUT - echo "DEBUG: Set matrix=['$IMAGE']" + echo "DEBUG: Set image_list=['$IMAGE']" exit 0 else echo "Error: Image '$IMAGE' not found or missing Dockerfile at images/$IMAGE/Dockerfile" echo "has_changes=false" >> $GITHUB_OUTPUT - echo "matrix=[]" >> $GITHUB_OUTPUT + echo "image_list=[]" >> $GITHUB_OUTPUT exit 0 fi else echo "DEBUG: Input image name was empty after trimming." echo "has_changes=false" >> $GITHUB_OUTPUT - echo "matrix=[]" >> $GITHUB_OUTPUT + echo "image_list=[]" >> $GITHUB_OUTPUT exit 0 fi fi @@ -84,18 +84,18 @@ jobs: if [ ! -s valid_images.txt ]; then echo "No valid images detected." echo "has_changes=false" >> $GITHUB_OUTPUT - echo "matrix=[]" >> $GITHUB_OUTPUT + echo "image_list=[]" >> $GITHUB_OUTPUT else # Convert list to JSON array using jq JSON=$(cat valid_images.txt | jq -R -s -c 'split("\n") | map(select(length > 0))') echo "Detected images: $JSON" - echo "matrix=$JSON" >> $GITHUB_OUTPUT + echo "image_list=$JSON" >> $GITHUB_OUTPUT echo "has_changes=true" >> $GITHUB_OUTPUT fi - name: Show detected changes run: | - echo "Matrix: ${{ steps.changes.outputs.matrix }}" + echo "Image List: ${{ steps.changes.outputs.image_list }}" echo "Has changes: ${{ steps.changes.outputs.has_changes }}" # ============================================================================ @@ -109,7 +109,7 @@ jobs: image: docker:cli strategy: matrix: - image: ${{ fromJson(needs.detect-changes.outputs.matrix) }} + image: ${{ fromJson(needs.detect-changes.outputs.image_list) }} fail-fast: false steps: - name: Install dependencies