Skip to content

Commit

Permalink
tests: do not mention on known CI failures (stackrox#12572)
Browse files Browse the repository at this point in the history
Signed-off-by: Tomasz Janiszewski <[email protected]>
Co-authored-by: Marcin Owsiany <[email protected]>
  • Loading branch information
janisz and porridge committed Sep 12, 2024
1 parent 1be1821 commit 529f395
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/actions/junit2jira/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}
Expand All @@ -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 }}" \
Expand All @@ -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}"
16 changes: 16 additions & 0 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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' }}
Expand All @@ -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:
Expand Down Expand Up @@ -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' }}
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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' }}
Expand All @@ -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:
Expand Down Expand Up @@ -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' }}
Expand All @@ -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:
Expand All @@ -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' }}
Expand Down Expand Up @@ -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

0 comments on commit 529f395

Please sign in to comment.