Skip to content

Commit a699e8e

Browse files
hpohekarpyansys-ci-botmkundu1
authored
ci: Fix notifications [skip tests] (#4560)
## Context Notifications job is skipped every time which is not expected. ## Change Summary We are sending notifications for both success and failure. ## Rationale The condition job.status != 'success' will always be false when evaluated. The job.status is not available during step execution and only becomes available in post-job hooks. ## Impact `Send GitHub Actions Run Status Adaptive Card to Teams via Power Automate` step only. --------- Co-authored-by: pyansys-ci-bot <[email protected]> Co-authored-by: Mainak Kundu <[email protected]>
1 parent 7327f5d commit a699e8e

File tree

5 files changed

+12
-13
lines changed

5 files changed

+12
-13
lines changed

.github/workflows/test-podman-compose.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,10 @@ jobs:
111111
make install > /dev/null
112112
113113
- name: Run Fluent test script
114+
id: fluent_test
114115
run: |
115116
python tests/podman_compose.py
117+
continue-on-error: true
116118

117119
- name: Cleanup previous containers
118120
if: always()
@@ -121,13 +123,9 @@ jobs:
121123
sudo podman system prune -af
122124
123125
- name: Send GitHub Actions Run Status Adaptive Card to Teams via Power Automate
124-
if: github.event_name == 'schedule' && job.status != 'success'
126+
if: github.event_name == 'schedule' && steps.fluent_test.outcome != 'success'
125127
run: | # zizmor: ignore[template-injection]
126-
STATUS="Success"
127-
if [ "${{ job.status }}" != "success" ]; then
128-
STATUS="Failure"
129-
fi
130-
128+
STATUS="Failure"
131129
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
132130
COMMIT_URL="https://github.com/${{ github.repository }}/commit/${{ github.sha }}"
133131

.github/workflows/test-run-dev-version-nightly.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,14 @@ jobs:
8888
make install > /dev/null
8989
9090
- name: Unit Testing
91+
id: unittest
9192
run: |
9293
make install-test
9394
make unittest-all-${VERSION}
9495
env:
9596
VERSION: ${{ env.FLUENT_VERSION }}
9697
FLUENT_IMAGE_TAG: ${{ env.FLUENT_IMAGE_TAG }}
98+
continue-on-error: true
9799

98100
- name: Cleanup previous docker containers
99101
if: always()
@@ -103,7 +105,7 @@ jobs:
103105
env:
104106
GITHUB_TOKEN: ${{ secrets.ADMIN_ACCESS_TOKEN }}
105107
IMAGE_TAG: ${{ env.FLUENT_IMAGE_TAG }}
106-
if: github.ref == 'refs/heads/main'
108+
if: github.ref == 'refs/heads/main' && steps.unittest.outcome == 'success'
107109
run: |
108110
DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' ghcr.io/ansys/fluent:${IMAGE_TAG} | sed 's/.*@//')
109111
gh variable set FLUENT_STABLE_IMAGE_DEV --body $DIGEST
@@ -113,13 +115,9 @@ jobs:
113115
run: make docker-clean-images
114116

115117
- name: Send GitHub Actions Run Status Adaptive Card to Teams via Power Automate
116-
if: github.event_name == 'schedule' && job.status != 'success'
118+
if: github.event_name == 'schedule' && steps.fluent_test.outcome != 'success'
117119
run: | # zizmor: ignore[template-injection]
118-
STATUS="Success"
119-
if [ "${{ job.status }}" != "success" ]; then
120-
STATUS="Failure"
121-
fi
122-
120+
STATUS="Failure"
123121
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
124122
COMMIT_URL="https://github.com/${{ github.repository }}/commit/${{ github.sha }}"
125123
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix notifications [skip tests]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Notify only when job fails
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Notify only when job fails

0 commit comments

Comments
 (0)