diff --git a/.github/actions/junit2jira/action.yaml b/.github/actions/junit2jira/action.yaml index 6bf0ab1f7a026..481dc9153c7a9 100644 --- a/.github/actions/junit2jira/action.yaml +++ b/.github/actions/junit2jira/action.yaml @@ -21,6 +21,10 @@ inputs: description: 'Minimal number of failed issues that will result in reporting a single cumulative Jira issue.' required: false default: '5' +outputs: + new-jiras: + description: 'Bool indicating if new issues were found' + value: ${{ steps.run.outputs.NEW_JIRAS }} runs: using: "composite" steps: @@ -37,6 +41,7 @@ runs: chmod +x junit2jira fi - name: Check files + id: run shell: bash env: GCP_SERVICE_ACCOUNT_STACKROX_CI: ${{ inputs.gcp-account }} @@ -50,6 +55,7 @@ runs: echo "Will create JIRA issues for JUnit failures found in ${{ inputs.directory }}" fi csv_output="$(mktemp --suffix=.csv)" + summary_file="$(mktemp --suffix=.json)" ./junit2jira \ -base-link "${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}" \ -build-id "${{ github.run_id }}" \ @@ -60,8 +66,11 @@ runs: -junit-reports-dir "${{ inputs.directory }}" \ -orchestrator "${{ runner.name }} ${{ runner.os }}-${{ runner.arch }}" \ -threshold "${{ inputs.threshold }}" \ + -summary-output "${summary_file}" \ "${extra_args[@]}" + echo "NEW_JIRAS=$(jq -r '.newJIRAs > 0' "${summary_file}")" >> "$GITHUB_OUTPUT" + source scripts/ci/lib.sh setup_gcp save_test_metrics "${csv_output}" diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index 83ad271b7165a..0b3abf5760372 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -17,6 +17,8 @@ jobs: matrix: gotags: [ 'GOTAGS=""', 'GOTAGS=release' ] runs-on: ubuntu-latest + outputs: + new-jiras: ${{ steps.junit2jira.outputs.new-jiras }} container: image: quay.io/stackrox-io/apollo-ci:stackrox-test-0.4.4 steps: @@ -68,6 +70,7 @@ jobs: - name: Report test failures to Jira if: (!cancelled()) + id: junit2jira uses: ./.github/actions/junit2jira with: create-jiras: ${{ github.event_name == 'push' }} @@ -80,6 +83,8 @@ jobs: matrix: gotags: [ 'GOTAGS=""', 'GOTAGS=release' ] runs-on: ubuntu-latest + outputs: + new-jiras: ${{ steps.junit2jira.outputs.new-jiras }} container: image: quay.io/stackrox-io/apollo-ci:stackrox-test-0.4.4 steps: @@ -123,6 +128,7 @@ jobs: - name: Report junit failures in jira if: (!cancelled()) + id: junit2jira uses: ./.github/actions/junit2jira with: create-jiras: ${{ github.event_name == 'push' }} @@ -173,6 +179,8 @@ jobs: ui: runs-on: ubuntu-latest + outputs: + new-jiras: ${{ steps.junit2jira.outputs.new-jiras }} container: image: quay.io/stackrox-io/apollo-ci:stackrox-test-0.4.4 steps: @@ -202,6 +210,7 @@ jobs: - name: Report junit failures in jira if: (!cancelled()) + id: junit2jira uses: ./.github/actions/junit2jira with: create-jiras: ${{ github.event_name == 'push' }} @@ -211,6 +220,8 @@ jobs: local-roxctl-tests: runs-on: ubuntu-latest + outputs: + new-jiras: ${{ steps.junit2jira.outputs.new-jiras }} container: image: quay.io/stackrox-io/apollo-ci:stackrox-test-0.4.4 steps: @@ -240,6 +251,7 @@ jobs: - name: Report junit failures in jira if: (!cancelled()) + id: junit2jira uses: ./.github/actions/junit2jira with: create-jiras: ${{ github.event_name == 'push' }} @@ -249,6 +261,8 @@ jobs: shell-unit-tests: runs-on: ubuntu-latest + outputs: + new-jiras: ${{ steps.junit2jira.outputs.new-jiras }} container: image: quay.io/stackrox-io/apollo-ci:stackrox-test-0.4.4 steps: @@ -273,6 +287,7 @@ jobs: - name: Report junit failures in jira if: (!cancelled()) + id: junit2jira uses: ./.github/actions/junit2jira with: create-jiras: ${{ github.event_name == 'push' }} @@ -327,6 +342,7 @@ jobs: - name: Slack message env: GITHUB_CONTEXT: ${{ toJSON(github) }} + mention_author: ${{ needs.go.outputs.new-jiras || needs.go-postgres.outputs.new-jiras || needs.local-roxctl-tests.outputs.new-jiras || needs.ui.outputs.new-jiras || needs.go.outputs.new-jiras || needs.shell-unit-tests.outputs.new-jiras }} run: | source scripts/ci/lib.sh slack_workflow_failure