Skip to content

Commit ecddf73

Browse files
feat: [DevOps] Slack notification
1 parent 5ad496f commit ecddf73

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

.github/workflows/e2e-test.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,14 @@ jobs:
3939
mvn $MVN_ARGS
4040
4141
- name: "Run tests"
42+
id: run_tests
4243
run: |
4344
MVN_ARGS="${{ env.MVN_MULTI_THREADED_ARGS }} surefire:test -pl :spring-app -DskipTests=false"
44-
mvn $MVN_ARGS "-Daicore.landscape=${{ matrix.environment }}"
45+
mvn $MVN_ARGS "-Daicore.landscape=${{ matrix.environment }}" | tee mvn_output.log # tee writes to both the console and a file
46+
47+
awk '/Results:/, /----/' mvn_output.log > test_error.log || true # true ensures the step doesn't fail if no match is found.
48+
ERROR_MSG=$(cat test_error.log | tail +4 | head -n -4 | sed ':a;N;$!ba;s/\n/\\n/g') # Slack formatting
49+
echo "error_message=$ERROR_MSG" >> $GITHUB_OUTPUT
4550
env:
4651
# See "End-to-end test application instructions" on the README.md to update the secret
4752
AICORE_SERVICE_KEY: ${{ secrets[matrix.secret-name] }}
@@ -75,6 +80,6 @@ jobs:
7580
webhook-type: incoming-webhook
7681
payload: |
7782
{
78-
"text": "⚠️ End-to-end tests failed! 😬 Please inspect & fix by clicking <https://github.com/SAP/ai-sdk-java/actions/runs/${{ github.run_id }}|here>"
83+
"text": "⚠️ End-to-end tests failed! 😬 Please inspect & fix by clicking <https://github.com/SAP/ai-sdk-java/actions/runs/${{ github.run_id }}|here>\n\n*Test Errors:*\n${{ steps.run_tests.outputs.error_message }}"
7984
}
8085

0 commit comments

Comments
 (0)