logformatter: link by *task ID*, not build ID

Reason: task IDs are unique and permanent; linking by
build ID and task name is non-unique, because Re-run.

Fixes: #14863

Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
Ed Santiago
2022-07-11 12:54:16 -06:00
committed by Matthew Heon
parent cfb768a36d
commit b2f3b28c6a

View File

@ -560,18 +560,14 @@ END_HTML
# See #14569 for more info. # See #14569 for more info.
# #
# [1] https://cirrus-ci.org/guide/writing-tasks/#latest-build-artifacts # [1] https://cirrus-ci.org/guide/writing-tasks/#latest-build-artifacts
if ($have_formatted_log && $ENV{CIRRUS_BUILD_ID} && $ENV{CIRRUS_TASK_NAME}) { if ($have_formatted_log && $ENV{CIRRUS_TASK_ID}) {
my $URL_BASE = "https://api.cirrus-ci.com"; my $URL_BASE = "https://api.cirrus-ci.com";
my $build_id = $ENV{CIRRUS_BUILD_ID}; my $task_id = $ENV{CIRRUS_TASK_ID};
my $task_name = $ENV{CIRRUS_TASK_NAME};
# Escape spaces in task names ("int fedora 35 podman root etc") # Link by *taskID*, not buildID + taskname. First, this is shorter
$task_name =~ s/\s/%20/g; # and less duplicaty. Second, and more important, buildID + taskname
# is non-unique, and a link to a flake log will be clobbered.
# URL is long and cumbersome and duplicaty. The task name cannot be my $URL = "${URL_BASE}/v1/artifact/task/$task_id/html/${outfile}";
# reduced; the file name could, but I choose to leave it because I
# sometimes download HTML logs and oh how I hate "log.html" filenames.
my $URL = "${URL_BASE}/v1/artifact/build/$build_id/$task_name/html/${outfile}";
print "\n\nAnnotated results:\n $URL\n"; print "\n\nAnnotated results:\n $URL\n";
} }