Skip to content

Commit

Permalink
Better handle weird case failure
Browse files Browse the repository at this point in the history
Sometimes, all the jobs are green but somehow the status is red so we
need to handle this case properly.
  • Loading branch information
gsmet committed Apr 19, 2021
1 parent 792f164 commit 48ac5eb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ public List<WorkflowReportJob> getJobs() {
return jobs;
}

public boolean hasJobsFailing() {
for (WorkflowReportJob job : jobs) {
if (job.isFailing()) {
return true;
}
}
return false;
}

public List<WorkflowReportJob> getJobsWithTestFailures() {
return jobs.stream().filter(j -> j.hasTestFailures()).collect(Collectors.toList());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
:no_entry_sign: This build has been cancelled.

{/if}
{#if report.failure && report.jobs.empty}
{#if report.failure && !report.jobsFailing}
✖ This build has failed but no jobs reported an error. Something weird happened, please check [the workflow run page]({report.workflowRunUrl}) carefully.

{/if}
{#if !report.jobs.empty}
{#if report.jobsFailing}
## <a id="build-summary-top"></a>Failing Jobs - Building {report.sha} - [Back to Pull Request]({pullRequest.htmlUrl})

| Status | Name | Step | Test failures | Logs | Raw logs |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
:no_entry_sign: This workflow run has been cancelled.

{/if}
{#if report.failure && report.jobs.empty}
{#if report.failure && !report.jobsFailing}
✖ This workflow run has failed but no jobs reported an error. Something weird happened, please check [the workflow run page]({report.workflowRunUrl}) carefully: it might be an issue with the workflow configuration itself.

{/if}
{#if !report.jobs.empty}
{#if report.jobsFailing}
## Failing Jobs - Building {report.sha}

{#if !artifactsAvailable}:warning: Artifacts of the workflow run were not available thus the report misses some details.{/if}
Expand Down

0 comments on commit 48ac5eb

Please sign in to comment.