Skip to content

Commit

Permalink
Add success/complete counts to dashboard CI stages
Browse files Browse the repository at this point in the history
The HTML dashboard now annotates each CI stage with the number of
completed jobs, across the whole run, that are part of that stage, as
well as the number of jobs within the stage that succeeded.

This allows users to quickly count the number of stages (as opposed to
jobs or pipelines) that failed. Since there is no concept of an
'in-progress stage', a successful run should always display equal
numbers of complete and successful stages, even if some of the jobs
within the stage have not yet completed.

This fixes #50.
  • Loading branch information
karkhaz committed Oct 29, 2021
1 parent f5243c4 commit 52b3828
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
15 changes: 15 additions & 0 deletions lib/litani_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,10 +523,25 @@ def get_summary(run):
"success": 0,
"total": 0,
"fail": 0,
"stages": {
}
}
for pipe in run["pipelines"]:
ret["total"] += 1
ret[pipe["status"]] += 1
for stage in pipe["ci_stages"]:
try:
ret["stages"][stage["name"]]
except KeyError:
ret["stages"][stage["name"]] = {
"completed": 0,
"success": 0,
}
if stage["progress"] != 100:
continue
ret["stages"][stage["name"]]["completed"] += 1
if stage["status"] == "success":
ret["stages"][stage["name"]]["success"] += 1
return ret


Expand Down
15 changes: 14 additions & 1 deletion templates/dashboard.jinja.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@
font-weight: bold;
}

.stage-stats {
font-size: xx-small;
font-style: normal;
}

@media (max-width: 640px){
.pipeline-progress {
width: 10em;
Expand Down Expand Up @@ -375,7 +380,15 @@ <h1>

<div class="pipeline-progress pipeline-header">
{% for stage in run["stages"] %}
<p>{{ stage }}</p>
<div class="stage-box">
<div class="stage-name">
<p>{{ stage }}</p>
</div><!-- class="stage-name" -->
<div class="stage-stats">
<p>{{ summary["stages"][stage]["completed"] }} Completed</p>
<p>{{ summary["stages"][stage]["success"] }} Successful</p>
</div><!-- class="stage-stats" -->
</div><!-- class="stage-box" -->
{% endfor %}{# stage in run["stages"] #}
</div><!-- class="pipeline-progress" -->
</div><!-- class="pipeline-row" -->
Expand Down

0 comments on commit 52b3828

Please sign in to comment.