diff --git a/.github/workflows/backend-unit-tests.yml b/.github/workflows/backend-unit-tests.yml index bf5f13d63c7..47cd082b38b 100644 --- a/.github/workflows/backend-unit-tests.yml +++ b/.github/workflows/backend-unit-tests.yml @@ -132,3 +132,30 @@ jobs: environment: "dev" # Can be dev/prod (defaults to dev) path: ${{ env.RESULTS_FILE }} bucket_path: ${{ env.BUCKET_PATH }} + + # This is the job that is actually required by rulesets. + # We need to require EITHER the OSS or the Enterprise job to pass. + # However, if one is skipped, GitHub won't flat-map the shards, + # so they won't be accepted by a ruleset. + required-backend-unit-tests: + needs: + - grafana + - grafana-enterprise + # always() is the best function here. + # success() || failure() will skip this function if any need is also skipped. + # That means conditional test suites will fail the entire requirement check. + if: always() + + name: All backend unit tests complete + runs-on: ubuntu-latest + steps: + - name: Check test suites + env: + NEEDS: ${{ toJson(needs) }} + run: | + FAILURES="$(echo "$NEEDS" | jq 'with_entries(select(.value.result == "failure")) | map_values(.result)')" + echo "$FAILURES" + if [ "$(echo "$FAILURES" | jq '. | length')" != "0" ]; then + exit 1 + fi + echo "All OK!"