name: "Charts: Test"

on:
  workflow_call:
    inputs:
      checkoutCommit:
        required: true
        type: string
      chartChangesDetected:
        required: true
        type: string
      modifiedCharts:
        required: true
        type: string

jobs:
  generate-install-matrix:
    name: Generate matrix for install
    runs-on:
      group: default
    outputs:
      matrix1: |
        {
          "chart": ${{ steps.list-changed.outputs.charts1 }}
        }
      matrix2: |
        {
          "chart": ${{ steps.list-changed.outputs.charts2 }}
        }
      matrix3: |
        {
          "chart": ${{ steps.list-changed.outputs.charts3 }}
        }
      matrix4: |
        {
          "chart": ${{ steps.list-changed.outputs.charts4 }}
        }
      matrix5: |
        {
          "chart": ${{ steps.list-changed.outputs.charts5 }}
        }
      matrix6: |
        {
          "chart": ${{ steps.list-changed.outputs.charts6 }}
        }
      detected1: ${{ steps.list-changed.outputs.detected1 }}
      detected2: ${{ steps.list-changed.outputs.detected2 }}
      detected3: ${{ steps.list-changed.outputs.detected3 }}
      detected4: ${{ steps.list-changed.outputs.detected4 }}
      detected5: ${{ steps.list-changed.outputs.detected5 }}
      detected6: ${{ steps.list-changed.outputs.detected6 }}
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
        with:
          fetch-depth: 1
          ref: ${{ inputs.checkoutCommit }}

      - name: Install go-yq
        if: inputs.chartChangesDetected == 'true'
        run: |
          mkdir -p $HOME/.local/bin
          wget https://github.com/mikefarah/yq/releases/download/v4.26.1/yq_linux_amd64 -O $HOME/.local/bin/go-yq && \
          chmod +x $HOME/.local/bin/go-yq
          echo "$HOME/.local/bin" >> $GITHUB_PATH

      - name: Run chart-testing (list-changed)
        id: list-changed
        if: inputs.chartChangesDetected == 'true'
        shell: bash
        run: |
          skip_prefix='fix(helm-deps): update chart common'
          pr_title='${{ github.event.pull_request.title }}'
          commit_title="$(git show -s --format=%s)"

          echo "PR title: ${pr_title}"
          echo "Commit title: ${commit_title}"

          if [[ "$pr_title" == "$skip_prefix"* || "$commit_title" == "$skip_prefix"* ]]; then
                echo "Skipping install tests for helm-deps common update; linting only"
                echo "charts1=[]" >> $GITHUB_OUTPUT
                echo "charts2=[]" >> $GITHUB_OUTPUT
                echo "charts3=[]" >> $GITHUB_OUTPUT
                echo "charts4=[]" >> $GITHUB_OUTPUT
                echo "charts5=[]" >> $GITHUB_OUTPUT
                echo "charts6=[]" >> $GITHUB_OUTPUT
                echo "detected1=false" >> $GITHUB_OUTPUT
                echo "detected2=false" >> $GITHUB_OUTPUT
                echo "detected3=false" >> $GITHUB_OUTPUT
                echo "detected4=false" >> $GITHUB_OUTPUT
                echo "detected5=false" >> $GITHUB_OUTPUT
                echo "detected6=false" >> $GITHUB_OUTPUT
                exit 0  # Exit the script
          fi
          CHARTS="${{ inputs.modifiedCharts }}"
          echo "Modified Charts: ${CHARTS}"
          EXCLUDED_JSON=$(go-yq eval -o=json '.excluded-charts // []' .github/ct-install.yaml)
          CHARTS_JSON=$(echo ${CHARTS} | jq --raw-input '.' | jq --compact-output --slurp '.' | jq 'map(. |= split(" "))[]' )
          OUTPUT_JSON=$(echo "{\"excluded\": ${EXCLUDED_JSON}, \"all\": ${CHARTS_JSON}}" | jq --compact-output '.all-.excluded')
          OUTPUT_JSON1=$((echo $OUTPUT_JSON | jq -r -c '.[:50]'; echo $OUTPUT_JSON | jq -r -c '.[301:350]'; echo $OUTPUT_JSON | jq -r -c '.[601:650]'; echo $OUTPUT_JSON | jq -r -c '.[901:950]'; echo $OUTPUT_JSON | jq -r -c '.[1201:1250]') | jq -s add)
          OUTPUT_JSON2=$((echo $OUTPUT_JSON | jq -r -c '.[51:100]'; echo $OUTPUT_JSON | jq -r -c '.[351:400]'; echo $OUTPUT_JSON | jq -r -c '.[651:700]'; echo $OUTPUT_JSON | jq -r -c '.[951:1000]'; echo $OUTPUT_JSON | jq -r -c '.[1251:1300]') | jq -s add)
          OUTPUT_JSON3=$((echo $OUTPUT_JSON | jq -r -c '.[101:150]'; echo $OUTPUT_JSON | jq -r -c '.[401:450]'; echo $OUTPUT_JSON | jq -r -c '.[701:750]'; echo $OUTPUT_JSON | jq -r -c '.[1001:1050]'; echo $OUTPUT_JSON | jq -r -c '.[1301:1350]') | jq -s add)
          OUTPUT_JSON4=$((echo $OUTPUT_JSON | jq -r -c '.[151:200]'; echo $OUTPUT_JSON | jq -r -c '.[451:500]'; echo $OUTPUT_JSON | jq -r -c '.[751:800]'; echo $OUTPUT_JSON | jq -r -c '.[1051:1100]'; echo $OUTPUT_JSON | jq -r -c '.[1351:1400]') | jq -s add)
          OUTPUT_JSON5=$((echo $OUTPUT_JSON | jq -r -c '.[201:250]'; echo $OUTPUT_JSON | jq -r -c '.[501:550]'; echo $OUTPUT_JSON | jq -r -c '.[801:850]'; echo $OUTPUT_JSON | jq -r -c '.[1101:1150]'; echo $OUTPUT_JSON | jq -r -c '.[1401:1450]') | jq -s add)
          OUTPUT_JSON6=$((echo $OUTPUT_JSON | jq -r -c '.[251:300]'; echo $OUTPUT_JSON | jq -r -c '.[551:600]'; echo $OUTPUT_JSON | jq -r -c '.[851:900]'; echo $OUTPUT_JSON | jq -r -c '.[1151:1200]'; echo $OUTPUT_JSON | jq -r -c '.[1451:1500]') | jq -s add)
          echo charts1=${OUTPUT_JSON1} >> $GITHUB_OUTPUT
          echo charts2=${OUTPUT_JSON2} >> $GITHUB_OUTPUT
          echo charts3=${OUTPUT_JSON3} >> $GITHUB_OUTPUT
          echo charts4=${OUTPUT_JSON4} >> $GITHUB_OUTPUT
          echo charts5=${OUTPUT_JSON5} >> $GITHUB_OUTPUT
          echo charts6=${OUTPUT_JSON6} >> $GITHUB_OUTPUT
          if [[ $(echo ${OUTPUT_JSON1} | jq -c '. | length') -gt 0 ]]; then
            echo "detected1=true" >> $GITHUB_OUTPUT
          fi
          if [[ $(echo ${OUTPUT_JSON2} | jq -c '. | length') -gt 0 ]]; then
            echo "detected2=true" >> $GITHUB_OUTPUT
          fi
          if [[ $(echo ${OUTPUT_JSON3} | jq -c '. | length') -gt 0 ]]; then
            echo "detected3=true" >> $GITHUB_OUTPUT
          fi
          if [[ $(echo ${OUTPUT_JSON4} | jq -c '. | length') -gt 0 ]]; then
            echo "detected4=true" >> $GITHUB_OUTPUT
          fi
          if [[ $(echo ${OUTPUT_JSON5} | jq -c '. | length') -gt 0 ]]; then
            echo "detected5=true" >> $GITHUB_OUTPUT
          fi
          if [[ $(echo ${OUTPUT_JSON6} | jq -c '. | length') -gt 0 ]]; then
            echo "detected6=true" >> $GITHUB_OUTPUT
          fi

  install-charts1:
    needs:
      - generate-install-matrix
    if: needs.generate-install-matrix.outputs.detected1 == 'true'
    name: Install charts  Part 1
    strategy:
      matrix: ${{ fromJson(needs.generate-install-matrix.outputs.matrix1) }}
      fail-fast: false
      max-parallel: 4
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
        with:
          fetch-depth: 1
          ref: ${{ inputs.checkoutCommit }}

      - name: Install go-yq
        run: |
          mkdir -p $HOME/.local/bin
          wget https://github.com/mikefarah/yq/releases/download/v4.26.1/yq_linux_amd64 -O $HOME/.local/bin/go-yq && \
          chmod +x $HOME/.local/bin/go-yq
          echo "$HOME/.local/bin" >> $GITHUB_PATH

      - name: Install Helm
        uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5
        with:
          version: v3.18.6

      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
        with:
          python-version: "3.11"

      - name: Set up chart-testing
        uses: helm/chart-testing-action@6ec842c01de15ebb84c8627d2744a0c2f2755c9f # v2.8.0

      - name: Update containerd config
        if: contains(matrix.chart, 'Spegel')
        run: |
          sudo mkdir -p /var/lib/rancher/k3s/agent/etc/containerd/
          sudo tee /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl > /dev/null <<EOL
          [plugins."io.containerd.grpc.v1.cri".registry]
             config_path = "/var/lib/rancher/k3s/agent/etc/containerd/certs.d"
          [plugins."io.containerd.grpc.v1.cri".containerd]
            snapshotter = "overlayfs"
            disable_snapshot_annotations = true
            discard_unpacked_layers = false
          EOL

      - name: Create k3d cluster
        uses: nolar/setup-k3d-k3s@v1
        with:
          version: latest
          # Flags found here https://github.com/k3d-io/k3d
          k3d-args: --k3s-arg --disable=metrics-server@server:*
          github-token: ${{ secrets.GITHUB_TOKEN }}

      - name: Remove node taints
        run: |
          kubectl taint --all=true nodes node.cloudprovider.kubernetes.io/uninitialized- || true

      - name: Prep Helm
        shell: bash
        run: |
          ./.github/scripts/prep_helm.sh

      - name: Add Dependencies
        shell: bash
        run: |
          ./.github/scripts/install_dependencies.sh "${{ matrix.chart }}"

      - name: Run chart-testing (install)
        run: |
          if [ -d "${{ matrix.chart }}/test-chart" ]; then
            ct install --config ".github/ct-install.yaml" --charts "${{ matrix.chart }}/test-chart"
          else
            ct install --config ".github/ct-install.yaml" --charts "${{ matrix.chart }}"
          fi

  install-charts2:
    needs:
      - generate-install-matrix
    if: needs.generate-install-matrix.outputs.detected2 == 'true'
    name: Install charts Part 2
    strategy:
      matrix: ${{ fromJson(needs.generate-install-matrix.outputs.matrix2) }}
      fail-fast: false
      max-parallel: 4
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
        with:
          fetch-depth: 1
          ref: ${{ inputs.checkoutCommit }}

      - name: Install Helm
        uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5
        with:
          version: v3.18.6

      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
        with:
          python-version: "3.11"

      - name: Set up chart-testing
        uses: helm/chart-testing-action@6ec842c01de15ebb84c8627d2744a0c2f2755c9f # v2.8.0

      - name: Update containerd config
        if: contains(matrix.chart, 'Spegel')
        run: |
          sudo mkdir -p /var/lib/rancher/k3s/agent/etc/containerd/
          sudo tee /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl > /dev/null <<EOL
          [plugins."io.containerd.grpc.v1.cri".registry]
             config_path = "/var/lib/rancher/k3s/agent/etc/containerd/certs.d"
          [plugins."io.containerd.grpc.v1.cri".containerd]
            snapshotter = "overlayfs"
            disable_snapshot_annotations = true
            discard_unpacked_layers = false
          EOL

      - name: Create k3d cluster
        uses: nolar/setup-k3d-k3s@v1
        with:
          version: latest
          # Flags found here https://github.com/k3d-io/k3d
          k3d-args: --k3s-arg --disable=metrics-server@server:*
          github-token: ${{ secrets.GITHUB_TOKEN }}

      - name: Remove node taints
        run: |
          kubectl taint --all=true nodes node.cloudprovider.kubernetes.io/uninitialized- || true

      - name: Prep Helm
        shell: bash
        run: |
          ./.github/scripts/prep_helm.sh

      - name: Add Dependencies
        shell: bash
        run: |
          ./.github/scripts/install_dependencies.sh "${{ matrix.chart }}"

      - name: Run chart-testing (install)
        run: |
          if [ -d "${{ matrix.chart }}/test-chart" ]; then
            ct install --config ".github/ct-install.yaml" --charts "${{ matrix.chart }}/test-chart"
          else
            ct install --config ".github/ct-install.yaml" --charts "${{ matrix.chart }}"
          fi

  install-charts3:
    needs:
      - generate-install-matrix
    if: needs.generate-install-matrix.outputs.detected3 == 'true'
    name: Install charts  Part 3
    strategy:
      matrix: ${{ fromJson(needs.generate-install-matrix.outputs.matrix3) }}
      fail-fast: false
      max-parallel: 4
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
        with:
          fetch-depth: 1
          ref: ${{ inputs.checkoutCommit }}

      - name: Install Helm
        uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5
        with:
          version: v3.18.6

      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
        with:
          python-version: "3.11"

      - name: Set up chart-testing
        uses: helm/chart-testing-action@6ec842c01de15ebb84c8627d2744a0c2f2755c9f # v2.8.0

      - name: Update containerd config
        if: contains(matrix.chart, 'Spegel')
        run: |
          sudo mkdir -p /var/lib/rancher/k3s/agent/etc/containerd/
          sudo tee /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl > /dev/null <<EOL
          [plugins."io.containerd.grpc.v1.cri".registry]
             config_path = "/var/lib/rancher/k3s/agent/etc/containerd/certs.d"
          [plugins."io.containerd.grpc.v1.cri".containerd]
            snapshotter = "overlayfs"
            disable_snapshot_annotations = true
            discard_unpacked_layers = false
          EOL

      - name: Create k3d cluster
        uses: nolar/setup-k3d-k3s@v1
        with:
          version: latest
          # Flags found here https://github.com/k3d-io/k3d
          k3d-args: --k3s-arg --disable=metrics-server@server:*
          github-token: ${{ secrets.GITHUB_TOKEN }}

      - name: Remove node taints
        run: |
          kubectl taint --all=true nodes node.cloudprovider.kubernetes.io/uninitialized- || true

      - name: Prep Helm
        shell: bash
        run: |
          ./.github/scripts/prep_helm.sh

      - name: Add Dependencies
        shell: bash
        run: |
          ./.github/scripts/install_dependencies.sh "${{ matrix.chart }}"

      - name: Run chart-testing (install)
        run: |
          if [ -d "${{ matrix.chart }}/test-chart" ]; then
            ct install --config ".github/ct-install.yaml" --charts "${{ matrix.chart }}/test-chart"
          else
            ct install --config ".github/ct-install.yaml" --charts "${{ matrix.chart }}"
          fi

  install-charts4:
    needs:
      - generate-install-matrix
    if: needs.generate-install-matrix.outputs.detected4 == 'true'
    name: Install charts Part 4
    strategy:
      matrix: ${{ fromJson(needs.generate-install-matrix.outputs.matrix4) }}
      fail-fast: false
      max-parallel: 4
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
        with:
          fetch-depth: 1
          ref: ${{ inputs.checkoutCommit }}

      - name: Install Helm
        uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5
        with:
          version: v3.18.6

      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
        with:
          python-version: "3.11"

      - name: Set up chart-testing
        uses: helm/chart-testing-action@6ec842c01de15ebb84c8627d2744a0c2f2755c9f # v2.8.0

      - name: Update containerd config
        if: contains(matrix.chart, 'Spegel')
        run: |
          sudo mkdir -p /var/lib/rancher/k3s/agent/etc/containerd/
          sudo tee /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl > /dev/null <<EOL
          [plugins."io.containerd.grpc.v1.cri".registry]
             config_path = "/var/lib/rancher/k3s/agent/etc/containerd/certs.d"
          [plugins."io.containerd.grpc.v1.cri".containerd]
            snapshotter = "overlayfs"
            disable_snapshot_annotations = true
            discard_unpacked_layers = false
          EOL

      - name: Create k3d cluster
        uses: nolar/setup-k3d-k3s@v1
        with:
          version: latest
          # Flags found here https://github.com/k3d-io/k3d
          k3d-args: --k3s-arg --disable=metrics-server@server:*
          github-token: ${{ secrets.GITHUB_TOKEN }}

      - name: Remove node taints
        run: |
          kubectl taint --all=true nodes node.cloudprovider.kubernetes.io/uninitialized- || true

      - name: Prep Helm
        shell: bash
        run: |
          ./.github/scripts/prep_helm.sh

      - name: Add Dependencies
        shell: bash
        run: |
          ./.github/scripts/install_dependencies.sh "${{ matrix.chart }}"

      - name: Run chart-testing (install)
        run: |
          if [ -d "${{ matrix.chart }}/test-chart" ]; then
            ct install --config ".github/ct-install.yaml" --charts "${{ matrix.chart }}/test-chart"
          else
            ct install --config ".github/ct-install.yaml" --charts "${{ matrix.chart }}"
          fi

  install-charts5:
    needs:
      - generate-install-matrix
    if: needs.generate-install-matrix.outputs.detected5 == 'true'
    name: Install charts  Part 5
    strategy:
      matrix: ${{ fromJson(needs.generate-install-matrix.outputs.matrix5) }}
      fail-fast: false
      max-parallel: 4
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
        with:
          fetch-depth: 1
          ref: ${{ inputs.checkoutCommit }}

      - name: Install Helm
        uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5
        with:
          version: v3.18.6

      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
        with:
          python-version: "3.11"

      - name: Set up chart-testing
        uses: helm/chart-testing-action@6ec842c01de15ebb84c8627d2744a0c2f2755c9f # v2.8.0

      - name: Update containerd config
        if: contains(matrix.chart, 'Spegel')
        run: |
          sudo mkdir -p /var/lib/rancher/k3s/agent/etc/containerd/
          sudo mkdir -p /var/lib/rancher/k3s/agent/etc/containerd/certs.d/
          sudo tee /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl > /dev/null <<EOL
          [plugins."io.containerd.grpc.v1.cri".registry]
             config_path = "/var/lib/rancher/k3s/agent/etc/containerd/certs.d"
          [plugins."io.containerd.grpc.v1.cri".containerd]
            snapshotter = "overlayfs"
            disable_snapshot_annotations = true
            discard_unpacked_layers = false
          EOL

      - name: Create k3d cluster
        uses: nolar/setup-k3d-k3s@v1
        with:
          version: latest
          # Flags found here https://github.com/k3d-io/k3d
          k3d-args: --k3s-arg --disable=metrics-server@server:*
          github-token: ${{ secrets.GITHUB_TOKEN }}

      - name: Remove node taints
        run: |
          kubectl taint --all=true nodes node.cloudprovider.kubernetes.io/uninitialized- || true

      - name: Prep Helm
        shell: bash
        run: |
          ./.github/scripts/prep_helm.sh

      - name: Add Dependencies
        shell: bash
        run: |
          ./.github/scripts/install_dependencies.sh "${{ matrix.chart }}"

      - name: Run chart-testing (install)
        run: |
          if [ -d "${{ matrix.chart }}/test-chart" ]; then
            ct install --config ".github/ct-install.yaml" --charts "${{ matrix.chart }}/test-chart"
          else
            ct install --config ".github/ct-install.yaml" --charts "${{ matrix.chart }}"
          fi

  install-charts6:
    needs:
      - generate-install-matrix
    if: needs.generate-install-matrix.outputs.detected6 == 'true'
    name: Install charts Part 6
    strategy:
      matrix: ${{ fromJson(needs.generate-install-matrix.outputs.matrix6) }}
      fail-fast: false
      max-parallel: 4
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
        with:
          fetch-depth: 1
          ref: ${{ inputs.checkoutCommit }}

      - name: Install Helm
        uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5
        with:
          version: v3.18.6

      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
        with:
          python-version: "3.11"

      - name: Set up chart-testing
        uses: helm/chart-testing-action@6ec842c01de15ebb84c8627d2744a0c2f2755c9f # v2.8.0

      - name: Update containerd config
        if: contains(matrix.chart, 'Spegel')
        run: |
          sudo mkdir -p /var/lib/rancher/k3s/agent/etc/containerd/
          sudo tee /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl > /dev/null <<EOL
          [plugins."io.containerd.grpc.v1.cri".registry]
             config_path = "/var/lib/rancher/k3s/agent/etc/containerd/certs.d"
          [plugins."io.containerd.grpc.v1.cri".containerd]
            snapshotter = "overlayfs"
            disable_snapshot_annotations = true
            discard_unpacked_layers = false
          EOL

      - name: Create k3d cluster
        uses: nolar/setup-k3d-k3s@v1
        with:
          version: latest
          # Flags found here https://github.com/k3d-io/k3d
          k3d-args: --k3s-arg --disable=metrics-server@server:*
          github-token: ${{ secrets.GITHUB_TOKEN }}

      - name: Remove node taints
        run: |
          kubectl taint --all=true nodes node.cloudprovider.kubernetes.io/uninitialized- || true

      - name: Prep Helm
        shell: bash
        run: |
          ./.github/scripts/prep_helm.sh

      - name: Add Dependencies
        shell: bash
        run: |
          ./.github/scripts/install_dependencies.sh "${{ matrix.chart }}"

      - name: Run chart-testing (install)
        run: |
          if [ -d "${{ matrix.chart }}/test-chart" ]; then
            ct install --config ".github/ct-install.yaml" --charts "${{ matrix.chart }}/test-chart"
          else
            ct install --config ".github/ct-install.yaml" --charts "${{ matrix.chart }}"
          fi

  # Summarize matrix https://github.community/t/status-check-for-a-matrix-jobs/127354/7
  install_success:
    needs:
      - generate-install-matrix
      - install-charts1
      - install-charts2
      - install-charts3
      - install-charts4
      - install-charts5
      - install-charts6
    if: ${{ always() }}
    name: Install successful
    runs-on:
      group: default
    steps:
      - name: Check install matrix status
        run: |
          res1="${{needs.install-charts1.result}}"
          res2="${{needs.install-charts2.result}}"
          res3="${{needs.install-charts3.result}}"
          res4="${{needs.install-charts4.result}}"
          res5="${{needs.install-charts5.result}}"
          res6="${{needs.install-charts6.result}}"

          if [[ $res1 == "success" || $res1 == "skipped" ]]; then
            echo "Install test suite [1] was successful..."
          else
            echo "Install test suite [1] failed, stopping..."
            exit 1
          fi

          if [[ $res2 == "success" || $res2 == "skipped" ]]; then
            echo "Install test suite [2] was successful..."
          else
            echo "Install test suite [2] failed, stopping..."
            exit 1
          fi

          if [[ $res3 == "success" || $res3 == "skipped" ]]; then
            echo "Install test suite [3] was successful..."
          else
            echo "Install test suite [3] failed, stopping..."
            exit 1
          fi

          if [[ $res4 == "success" || $res4 == "skipped" ]]; then
            echo "Install test suite [4] was successful..."
          else
            echo "Install test suite [4] failed, stopping..."
            exit 1
          fi

          if [[ $res5 == "success" || $res5 == "skipped" ]]; then
            echo "Install test suite [5] was successful..."
          else
            echo "Install test suite [5] failed, stopping..."
            exit 1
          fi

          if [[ $res6 == "success" || $res6 == "skipped" ]]; then
            echo "Install test suite [6] was successful..."
          else
            echo "Install test suite [6] failed, stopping..."
            exit 1
          fi
