Skip to content

Commit f28aac7

Browse files
chmouelCursor
andcommitted
fix: Improve E2E failure reporting in GitHub Actions
Added logic to capture and summarize failing tests from E2E runs. This was implemented by redirecting script output to a log file and then parsing this file for Go test failures. The summary is included in the Slack notification when a job fails, providing immediate insight into which specific tests failed for a given provider. Fixes #2283 Co-authored-by: Cursor <cursor@users.noreply.github.com> Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
1 parent 7aa1b46 commit f28aac7

File tree

3 files changed

+37
-9
lines changed

3 files changed

+37
-9
lines changed

.github/workflows/e2e.yaml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ jobs:
175175
TEST_BITBUCKET_SERVER_API_URL: ${{ secrets.BITBUCKET_SERVER_API_URL }}
176176
TEST_BITBUCKET_SERVER_WEBHOOK_SECRET: ${{ secrets.BITBUCKET_SERVER_WEBHOOK_SECRET }}
177177
run: |
178-
./hack/gh-workflow-ci.sh run_e2e_tests
178+
set -o pipefail
179+
LOG_FILE="/tmp/e2e-tests-${{ matrix.provider }}.log"
180+
./hack/gh-workflow-ci.sh run_e2e_tests 2>&1 | tee "${LOG_FILE}"
179181
180182
- name: Run E2E Tests on nightly
181183
# This step still runs specifically for schedule or workflow_dispatch
@@ -194,7 +196,30 @@ jobs:
194196
TEST_BITBUCKET_SERVER_API_URL: ${{ secrets.BITBUCKET_SERVER_API_URL }}
195197
TEST_BITBUCKET_SERVER_WEBHOOK_SECRET: ${{ secrets.BITBUCKET_SERVER_WEBHOOK_SECRET }}
196198
run: |
197-
./hack/gh-workflow-ci.sh run_e2e_tests
199+
set -o pipefail
200+
LOG_FILE="/tmp/e2e-tests-${{ matrix.provider }}.log"
201+
./hack/gh-workflow-ci.sh run_e2e_tests 2>&1 | tee "${LOG_FILE}"
202+
203+
- name: Summarize failing tests
204+
if: ${{ failure() }}
205+
id: failing-tests
206+
run: |
207+
LOG_FILE="/tmp/e2e-tests-${{ matrix.provider }}.log"
208+
if [[ ! -f "${LOG_FILE}" || ! -s "${LOG_FILE}" ]]; then
209+
echo "slack_message=E2E job failed but no test log was captured for provider '${{ matrix.provider }}'." >> "${GITHUB_OUTPUT}"
210+
exit 0
211+
fi
212+
213+
mapfile -t FAILURES < <(grep -E '^--- FAIL: ' "${LOG_FILE}" | sed -E 's/^--- FAIL: ([^[:space:]]+).*/\1/' | sort -u)
214+
215+
if [[ ${#FAILURES[@]} -eq 0 ]]; then
216+
echo "slack_message=E2E job failed without explicit go test failures; check workflow logs for provider '${{ matrix.provider }}'." >> "${GITHUB_OUTPUT}"
217+
exit 0
218+
fi
219+
220+
joined_failures=$(printf '%s, ' "${FAILURES[@]}")
221+
joined_failures=${joined_failures%, }
222+
echo "slack_message=Failing tests for provider ${{ matrix.provider }}: ${joined_failures}" >> "${GITHUB_OUTPUT}"
198223
199224
- name: Collect logs
200225
if: ${{ always() }}
@@ -216,11 +241,14 @@ jobs:
216241
name: logs-e2e-tests-${{ matrix.provider }}
217242
path: /tmp/logs
218243

219-
- name: Report Status
244+
- name: Report E2E test results to Slack
220245
if: ${{ always() && github.ref_name == 'main' && github.event_name == 'schedule' }}
221246
uses: ravsamhq/notify-slack-action@v2
222247
with:
223248
status: ${{ job.status }}
224249
notify_when: "failure"
250+
message_format: |
251+
{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}@{branch}> on <{commit_url}|{commit_sha}>
252+
${{ steps.failing-tests.outputs.slack_message }}
225253
env:
226254
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

docs/content/docs/guide/cli.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ tkn pac cel -b <body.json> -H <headers.txt>
458458
If run in a terminal, you'll get a prompt:
459459

460460
```console
461-
CEL expression>
461+
CEL expression>
462462
```
463463

464464
* Use ↑/↓ arrows to navigate history.
@@ -485,7 +485,7 @@ echo 'event == "pull_request"' | tkn pac cel -b body.json -H headers.txt
485485

486486
* **Webhook payload** (`body.*`): All fields from the webhook JSON.
487487
* **HTTP headers** (`headers.*`): All HTTP headers.
488-
* **Files** (`files.*`): Always empty in CLI mode.
488+
* **Files** (`files.*`): Always empty in CLI mode.
489489
**Note:** `fileChanged`, `fileDeleted`, `fileModified` and similar functions are **not implemented yet** in the CLI.
490490
* **PAC Parameters** (`pac.*`): All variables for backward compatibility.
491491

docs/content/docs/install/settings.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ There are a few things you can configure through the ConfigMap
158158
both a push event and a pull request. If a push event comes from a commit that is
159159
part of an open pull request, the push event will be skipped as it would create
160160
a duplicate PipelineRun.
161-
161+
162162
This feature works by checking if a pushed commit SHA exists in any open pull request,
163163
and if so, skipping the push event processing.
164164

@@ -207,12 +207,12 @@ Pipelines-as-Code supports fetching tasks and pipelines with its remote annotati
207207
* `hub-catalog-type`
208208

209209
The type of hub catalog. Supported values are:
210-
210+
211211
* `artifacthub` - For Artifact Hub (default if not specified)
212212
* `tektonhub` - For Tekton Hub
213213

214214
* By default, both Artifact Hub and Tekton Hub are configured:
215-
215+
216216
* Artifact Hub is the default catalog (no prefix needed, but `artifact://` can be used explicitly)
217217
* Tekton Hub is available using the `tektonhub://` prefix
218218

@@ -223,7 +223,7 @@ Pipelines-as-Code supports fetching tasks and pipelines with its remote annotati
223223
catalog-1-name: "tekton"
224224
catalog-1-url: "https://api.custom.hub/v1"
225225
catalog-1-type: "tektonhub"
226-
226+
227227
catalog-2-id: "artifact"
228228
catalog-2-name: "tekton-catalog-tasks"
229229
catalog-2-url: "https://artifacthub.io"

0 commit comments

Comments
 (0)