Skip to content

Commit

Permalink
chore: more debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
devops-chris committed Dec 28, 2023
1 parent f2b6443 commit bb7df22
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 13 deletions.
8 changes: 5 additions & 3 deletions .github/actions/test_matrix/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,12 @@ runs:
echo "DEBUG: Working Directories: ${working_dirs[@]}"
echo "DEBUG: Image Names: ${image_names[@]}"
# # Set matrix outputs as JSON
# matrix_json="{\"components\":\"${components[@]}\",\"paths\":\"${paths[@]}\",\"docker_files\":\"${docker_files[@]}\",\"working_dirs\":\"${working_dirs[@]}\",\"image_names\":\"${image_names[@]}\"}"
# echo "DEBUG: Raw matrix output: $matrix_json"
# echo "::set-output name=matrix::$(echo "$matrix_json" | jq -c)"
# Set matrix outputs as JSON
matrix_json="{\"components\":\"${components[@]}\",\"paths\":\"${paths[@]}\",\"docker_files\":\"${docker_files[@]}\",\"working_dirs\":\"${working_dirs[@]}\",\"image_names\":\"${image_names[@]}\"}"
echo "DEBUG: Raw matrix output: $matrix_json"
echo "::set-output name=matrix::$(echo "$matrix_json" | jq -c)"
echo "matrix=${components[@]}::${paths[@]}::${docker_files[@]}::${working_dirs[@]}::${image_names[@]}" >> $GITHUB_ENV
shell: bash
40 changes: 30 additions & 10 deletions .github/workflows/test_matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,43 @@ jobs:
with:
event: ${{ matrix.event }}

# use-matrix:
# needs: set-matrix
# runs-on: ubuntu-latest
# strategy:
# matrix: ${{fromJson(needs.set-matrix.outputs.matrix)}}
# steps:
# - name: Use matrix
# run: |
# matrix="${{ matrix }}"
# paths="${{ matrix.paths }}"
# docker_files="${{ matrix.docker_files }}"
# working_dirs="${{ matrix.working_dirs }}"
# image_names="${{ matrix.image_names }}"

# echo "Component: $matrix"
# echo "Paths: $paths"
# echo "Dockerfile: $docker_files"
# echo "Working Directory: $working_dirs"
# echo "Image Name: $image_names"

use-matrix:
needs: set-matrix
runs-on: ubuntu-latest
strategy:
matrix: ${{fromJson(needs.set-matrix.outputs.matrix)}}
steps:
- name: Use matrix
run: |
matrix="${{ matrix }}"
paths="${{ matrix.paths }}"
docker_files="${{ matrix.docker_files }}"
working_dirs="${{ matrix.working_dirs }}"
image_names="${{ matrix.image_names }}"
matrix="${{ needs.set-matrix.outputs.matrix }}"
IFS='::' read -ra matrix_values <<< "$matrix"
components="${matrix_values[0]}"
paths="${matrix_values[1]}"
docker_files="${matrix_values[2]}"
working_dirs="${matrix_values[3]}"
image_names="${matrix_values[4]}"

echo "Component: $matrix"
echo "Component: $components"
echo "Paths: $paths"
echo "Dockerfile: $docker_files"
echo "Working Directory: $working_dirs"
echo "Image Name: $image_names"

echo "Image Name: $image_names"

0 comments on commit bb7df22

Please sign in to comment.