Skip to content

Commit c1ea02b

Browse files
committed
Fix missing duration format
1 parent 176668c commit c1ea02b

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

components/scripts/lib/info.sh

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -208,35 +208,39 @@ print_build_caching_leverage_metrics() {
208208
}
209209

210210
print_avoided_cacheable_tasks() {
211-
local value task_count_padding="$1"
211+
local value
212212
if [[ -n "${avoided_from_cache_num_tasks[1]}" && -n "${avoided_from_cache_avoidance_savings[1]}" ]]; then
213-
local task_count
214-
task_count="$(printf "%${task_count_padding}s" "${avoided_from_cache_num_tasks[1]}" )"
215-
value="${task_count} ${BUILD_TOOL_TASK}s, ${avoided_from_cache_avoidance_savings[1]} total saved execution time"
213+
printf -v value "%$1s %ss, %s total saved execution time" \
214+
"${avoided_from_cache_num_tasks[1]}" \
215+
"${BUILD_TOOL_TASK}" \
216+
"$(format_duration avoided_from_cache_avoidance_savings[1])"
216217
fi
217218
summary_row "Avoided cacheable ${BUILD_TOOL_TASK}s:" "${value}"
218219
}
219220

220221
print_executed_cacheable_tasks() {
221-
local value task_count_padding="$1"
222+
local value
222223
if [[ -n "${executed_cacheable_num_tasks[1]}" && -n "${executed_cacheable_duration[1]}" ]]; then
223-
local summary_color task_count
224+
local summary_color
224225
if (( executed_cacheable_num_tasks[1] > 0)); then
225226
summary_color="${WARN_COLOR}"
226227
fi
227228

228-
task_count="$(printf "%${task_count_padding}s" "${executed_cacheable_num_tasks[1]}" )"
229-
value="${summary_color}${task_count} ${BUILD_TOOL_TASK}s, ${executed_cacheable_duration[1]} total execution time${RESTORE}"
229+
printf -v value "${summary_color}%$1s %ss, %s total execution time${RESTORE}" \
230+
"${executed_cacheable_num_tasks[1]}" \
231+
"${BUILD_TOOL_TASK}" \
232+
"$(format_duration executed_cacheable_duration[1])"
230233
fi
231234
summary_row "Executed cacheable ${BUILD_TOOL_TASK}s:" "${value}"
232235
}
233236

234237
print_executed_non_cacheable_tasks() {
235-
local value task_count_padding="$1"
238+
local value
236239
if [[ -n "${executed_not_cacheable_num_tasks[1]}" && -n "${executed_not_cacheable_duration[1]}" ]]; then
237-
local task_count
238-
task_count="$(printf "%${task_count_padding}s" "${executed_not_cacheable_num_tasks[1]}" )"
239-
value="${task_count} ${BUILD_TOOL_TASK}s, ${executed_not_cacheable_duration[1]} total execution time"
240+
printf -v value "%$1s %ss, %s total execution time" \
241+
"${executed_not_cacheable_num_tasks[1]}" \
242+
"${BUILD_TOOL_TASK}" \
243+
"$(format_duration executed_not_cacheable_duration[1])"
240244
fi
241245
summary_row "Executed non-cacheable ${BUILD_TOOL_TASK}s:" "${value}"
242246
}

0 commit comments

Comments
 (0)