Skip to content

Commit 5936441

Browse files
authored
fix: Fix broken parent logs links. (#19435)
As title.
2 parents 3a75ca5 + 26636a5 commit 5936441

File tree

7 files changed

+29
-18
lines changed

7 files changed

+29
-18
lines changed

ci.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ function get_latest_run_id {
6363

6464
# Jobs in the ci dashboards are grouped on a single line by RUN_ID.
6565
export RUN_ID=${RUN_ID:-$(date +%s%3N)}
66-
export PARENT_LOG_URL=http://ci.aztec-labs.com/$RUN_ID
6766

6867
case "$cmd" in
6968
dash)
@@ -101,9 +100,10 @@ case "$cmd" in
101100
export DENOISE=1
102101
export DENOISE_WIDTH=32
103102
run() {
104-
JOB_ID=$1 INSTANCE_POSTFIX=$1 ARCH=$2 exec denoise "bootstrap_ec2 './bootstrap.sh $3'"
103+
PARENT_LOG_ID=$RUN_ID JOB_ID=$1 INSTANCE_POSTFIX=$1 ARCH=$2 exec denoise "bootstrap_ec2 './bootstrap.sh $3'"
105104
}
106105
export -f run
106+
107107
parallel --jobs 10 --termseq 'TERM,10000' --tagstring '{= $_=~s/run (\w+).*/$1/; =}' --line-buffered --halt now,fail=1 ::: \
108108
'run x1-full amd64 ci-full-no-test-cache' \
109109
'run x2-full amd64 ci-full-no-test-cache' \
@@ -157,13 +157,14 @@ case "$cmd" in
157157
export DENOISE=1
158158
export DENOISE_WIDTH=32
159159
run() {
160-
JOB_ID=$1 INSTANCE_POSTFIX=$1 ARCH=$2 exec denoise "bootstrap_ec2 './bootstrap.sh ci-release'"
160+
PARENT_LOG_ID=$RUN_ID JOB_ID=$1 INSTANCE_POSTFIX=$1 ARCH=$2 exec denoise "bootstrap_ec2 './bootstrap.sh ci-release'"
161161
}
162162
export -f run
163-
# We need to run the release flow on both x86 and arm64.
163+
164164
parallel --termseq 'TERM,10000' --tagstring '{= $_=~s/run (\w+).*/$1/; =}' --line-buffered --halt now,fail=1 ::: \
165165
'run x-release amd64' \
166166
'run a-release arm64' | DUP=1 cache_log "Release CI run" $RUN_ID
167+
167168
# If we were triggered by a PR with ci-release-pr label, remove the label now we've succeeded.
168169
if [ -n "${PR_NUMBER:-}" ]; then
169170
gh pr edit $PR_NUMBER --remove-label ci-release-pr || true

ci3/bootstrap_ec2

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ if [ -t 1 ]; then
111111
fi
112112
else
113113
# We're probably running in CI. Handle aws evictions and add timestamps to the logs.
114-
run_cmd="run 2>&1 | ci3/add_timestamps | DUP=1 ci3/cache_log 'CI run' \$ci_log_id"
114+
run_cmd="PARENT_LOG_ID=\$ci_log_id run 2>&1 | ci3/add_timestamps | DUP=1 ci3/cache_log 'CI run' \$ci_log_id"
115115
fi
116116

117117
container_script=$(
@@ -137,7 +137,6 @@ container_script=$(
137137
source ci3/source_redis
138138
source ci3/source_cache
139139
ci_log_id=\$(log_ci_run)
140-
export PARENT_LOG_URL=${PARENT_LOG_URL:-}
141140
142141
if [ -n "\$DOCKERHUB_PASSWORD" ]; then
143142
echo \$DOCKERHUB_PASSWORD | docker login -u \$DOCKERHUB_USERNAME --password-stdin
@@ -280,7 +279,7 @@ function run {
280279
-e REF_NAME=${REF_NAME:-} \
281280
-e TARGET_BRANCH=${TARGET_BRANCH:-} \
282281
-e CI_DASHBOARD=${CI_DASHBOARD:-} \
283-
-e PARENT_LOG_URL=${PARENT_LOG_URL:-} \
282+
-e PARENT_LOG_ID=${PARENT_LOG_ID:-} \
284283
-e NO_CACHE=${NO_CACHE:-} \
285284
-e NO_FAIL_FAST=${NO_FAIL_FAST:-} \
286285
-e CI_USE_BUILD_INSTANCE_KEY=${CI_USE_BUILD_INSTANCE_KEY:-} \

ci3/cache_log

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,15 @@ source $ci3/source_cache
99
name=$1
1010

1111
key=${2:-$(uuid)}
12-
outfile=/tmp/$key
1312
dup=${DUP:-0}
13+
outfile=/tmp/$key
14+
touch $outfile
1415
trap 'rm -f $outfile' EXIT
15-
echo -e "Parent Log: ${PARENT_LOG_URL:-none}" >$outfile
16+
if [ -n "${PARENT_LOG_ID:-}" ]; then
17+
echo -e "Parent Log: $(ci_term_link $PARENT_LOG_ID)" >>$outfile
18+
else
19+
echo -e "Parent Log: none" >>$outfile
20+
fi
1621
echo -e "Started: $(date)" >>$outfile
1722
echo -e "Completed: in-progress" >>$outfile
1823
echo -e "Took: in-progress\n" >>$outfile

ci3/denoise

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ outfile=/tmp/$key
5656
touch $outfile
5757

5858
function format_log_output {
59-
echo "Parent Log: ${PARENT_LOG_URL:-none}"
59+
if [ -n "${PARENT_LOG_ID:-}" ]; then
60+
echo -e "Parent Log: $(ci_term_link $PARENT_LOG_ID)"
61+
fi
6062
echo "Command: $cmd"
6163
echo "Date: $(date)"
6264
echo "Status: $status"
@@ -107,7 +109,7 @@ tail --sleep-interval=0.2 -n +1 -f "$outfile" > >(
107109
tail_pid=$!
108110

109111
# Execute the command in background.
110-
PARENT_LOG_URL=$url bash -c "$cmd" 2>&1 | redact > $outfile &
112+
PARENT_LOG_ID=$key bash -c "$cmd" 2>&1 | redact > $outfile &
111113
job_pid=$!
112114

113115
# Wait for the job to finish and get its exit status.

ci3/filter_cached_test_cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function process_batch {
2222
if [ -z "${results[$i]}" ] || [[ "${lines[$i]}" == *disabled-cache* ]]; then
2323
echo "${lines[$i]}"
2424
else
25-
echo -e "${blue}SKIPPED${reset} (${yellow}$(ci_term_link ${results[$i]})${reset}): ${lines[$i]}" >&3
25+
echo -e "${blue}SKIPPED${reset} ($(ci_term_link ${results[$i]})): ${lines[$i]}" >&3
2626
fi
2727
done
2828
}

ci3/run_test_cmd

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ test_hash=$(hash_str_orig "$test_cmd")
5151
if [ "${USE_TEST_CACHE:-0}" -eq 1 ]; then
5252
log_key=$(redis_cli GET $key)
5353
if [ -n "$log_key" ]; then
54-
log_info=" (${yellow}$(ci_term_link $log_key)${reset})"
54+
log_info=" ($(ci_term_link $log_key))"
5555
echo -e "${blue}SKIPPED${reset}${log_info:-}: $cmd"
5656
exit 0
5757
fi
@@ -84,9 +84,13 @@ trap sig_handler SIGTERM SIGINT
8484
# We cannot use "output=$(timeout ...)" here as it stymies proper signal propagation.
8585
# To ensure we can propagate SIGTERM to timeouts process group we use a temp file and forward the signal.
8686
tmp_file=/tmp/$key
87+
touch $tmp_file
88+
8789
# Print test metadata header.
88-
cat <<EOF >$tmp_file
89-
Parent Log: ${PARENT_LOG_URL:-none}
90+
if [ -n "${PARENT_LOG_ID:-}" ]; then
91+
echo -e "Parent Log: $(ci_term_link $PARENT_LOG_ID)" >>$tmp_file
92+
fi
93+
cat <<EOF >>$tmp_file
9094
Command: $cmd
9195
Commit: https://github.com/AztecProtocol/aztec-packages/commit/$COMMIT_HASH
9296
Env: REF_NAME=$REF_NAME CURRENT_VERSION=$CURRENT_VERSION CI_FULL=$CI_FULL
@@ -129,7 +133,7 @@ function live_publish_log {
129133

130134
if [ "$CI_REDIS_AVAILABLE" -eq 1 ]; then
131135
log_key=$(uuid)
132-
log_info=" (${yellow}$(ci_term_link $log_key)${reset})"
136+
log_info=" ($(ci_term_link $log_key))"
133137

134138
if [ "$CI" -eq 1 ]; then
135139
# If we're in CI, we want to publish the log live.

ci3/source_color

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export link_open='\033]8;;'
2929
export link_close='\x07'
3030

3131
function term_link {
32-
echo -e "${link_open}$1${link_close}$2${link_open}${link_close}"
32+
echo -e "${yellow}${link_open}$1${link_close}$2${link_open}${link_close}${reset}"
3333
}
3434

3535
function ci_term_link {
@@ -41,7 +41,7 @@ function pr_link {
4141
if [[ $line =~ \(#([0-9]+)\) ]]; then
4242
pr_number="${BASH_REMATCH[1]}"
4343
link=$(term_link https://github.com/aztecprotocol/aztec-packages/pull/$pr_number $pr_number)
44-
echo -e "${line/\(#${pr_number}\)/(#${yellow}${link}${reset})}"
44+
echo -e "${line/\(#${pr_number}\)/(#${link})}"
4545
else
4646
echo -e "$line"
4747
fi

0 commit comments

Comments
 (0)