Skip to content

Commit baaa514

Browse files
committed
Set project name from build-scans.csv in scripts
1 parent b072ac9 commit baaa514

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

components/scripts/lib/build-scan-online.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@ read_build_scan_metadata() {
2424
debug ""
2525
fi
2626

27-
while IFS=, read -r run_num field_1 field_2 field_3; do
28-
base_urls[$run_num]="$field_1"
29-
build_scan_urls[$run_num]="$field_2"
30-
build_scan_ids[$run_num]="$field_3"
27+
local run_num base_url build_scan_url build_scan_id project_name
28+
29+
# shellcheck disable=SC2034
30+
while IFS=, read -r run_num base_url build_scan_url build_scan_id project_name; do
31+
base_urls[$run_num]="${base_url}"
32+
build_scan_urls[$run_num]="${build_scan_url}"
33+
build_scan_ids[$run_num]="${build_scan_id}"
34+
project_names[$run_num]="${project_name}"
3135
done <<< "${build_scan_metadata}"
3236
fi
3337
}

components/scripts/lib/build-scan-parse.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,17 @@ parse_build_scan_row() {
8080
while IFS=, read -r run_num field_1 field_2 field_3 field_4 field_5 field_6 field_7 field_8 field_9 field_10 field_11 field_12 field_13 field_14 field_15 field_16 field_17 field_18 field_19 field_20 field_21; do
8181
debug "Build Scan $field_4 is for build $run_num"
8282

83-
project_names[run_num]="${field_1}"
83+
# The project_name should be overridden by Build Scan data if it is
84+
# available. This is so that the project names displayed in the summary are
85+
# consistent with what is shown in the Build Scan.
86+
87+
if [ -n "${field_1}" ]; then
88+
project_names[run_num]="${field_1}"
89+
fi
90+
91+
# If the following fields are already valued, then they should not be
92+
# overridden by Build Scan data. For locally executed builds, this data is
93+
# determined by the scripts as a result of execution.
8494

8595
if [ -z "${base_urls[run_num]}" ]; then
8696
base_urls[run_num]="${field_2}"
@@ -90,8 +100,6 @@ parse_build_scan_row() {
90100
build_scan_urls[run_num]="${field_3}"
91101
fi
92102

93-
build_scan_ids[run_num]="${field_4}"
94-
95103
if [ -z "${git_repos[run_num]}" ]; then
96104
git_repos[run_num]="${field_5}"
97105
fi
@@ -112,6 +120,11 @@ parse_build_scan_row() {
112120
build_outcomes[run_num]="${field_9}"
113121
fi
114122

123+
# The below fields are always set by Build Scan data regardless of their
124+
# previous value and are always safe to override.
125+
126+
build_scan_ids[run_num]="${field_4}"
127+
115128
remote_build_cache_urls[run_num]="${field_10}"
116129
remote_build_cache_shards[run_num]="${field_11}"
117130

0 commit comments

Comments
 (0)