Skip to content

Commit bcadbb4

Browse files
committed
Only print realized build time savings when effective task execution durations exist
1 parent a3d5985 commit bcadbb4

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

components/scripts/lib/info.sh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,22 @@ print_performance_characteristics_header() {
154154
}
155155

156156
print_realized_build_time_savings() {
157-
local value
158-
value=""
157+
# Do not print realized build time savings at all if these values do not exist
158+
# This can happen since build-scan-support-tool does not yet support these fields
159159
if [[ -n "${effective_task_execution_duration[0]}" && -n "${effective_task_execution_duration[1]}" ]]; then
160-
local first_build second_build realized_savings
161-
first_build=$(format_duration "${effective_task_execution_duration[0]}")
162-
second_build=$(format_duration "${effective_task_execution_duration[1]}")
163-
realized_savings=$(format_duration effective_task_execution_duration[0]-effective_task_execution_duration[1])
164-
value="${realized_savings} wall-clock time (from ${first_build} to ${second_build})"
160+
local value
161+
value=""
162+
# Only calculate realized build time savings when these values are non-zero
163+
# These values can be returned as zero when an error occurs processing the Build Scan data
164+
if [[ "${effective_task_execution_duration[0]}" && "${effective_task_execution_duration[1]}" ]]; then
165+
local first_build second_build realized_savings
166+
first_build=$(format_duration "${effective_task_execution_duration[0]}")
167+
second_build=$(format_duration "${effective_task_execution_duration[1]}")
168+
realized_savings=$(format_duration effective_task_execution_duration[0]-effective_task_execution_duration[1])
169+
value="${realized_savings} wall-clock time (from ${first_build} to ${second_build})"
170+
fi
171+
summary_row "Realized build time savings:" "${value}"
165172
fi
166-
summary_row "Realized build time savings:" "${value}"
167173
}
168174

169175
print_build_caching_leverage_metrics() {

0 commit comments

Comments
 (0)