Skip to content

Commit

Permalink
Merge pull request containers#14896 from edsantiago/logformatter_by_task
Browse files Browse the repository at this point in the history
logformatter: link by *task ID*, not build ID
  • Loading branch information
openshift-ci[bot] authored Jul 12, 2022
2 parents 4d111fa + 3ed323e commit a51a630
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions contrib/cirrus/logformatter
Original file line number Diff line number Diff line change
Expand Up @@ -560,18 +560,14 @@ END_HTML
# See #14569 for more info.
#
# [1] https://cirrus-ci.org/guide/writing-tasks/#latest-build-artifacts
if ($have_formatted_log && $ENV{CIRRUS_BUILD_ID} && $ENV{CIRRUS_TASK_NAME}) {
my $URL_BASE = "https://api.cirrus-ci.com";
my $build_id = $ENV{CIRRUS_BUILD_ID};
my $task_name = $ENV{CIRRUS_TASK_NAME};

# Escape spaces in task names ("int fedora 35 podman root etc")
$task_name =~ s/\s/%20/g;

# URL is long and cumbersome and duplicaty. The task name cannot be
# 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}";
if ($have_formatted_log && $ENV{CIRRUS_TASK_ID}) {
my $URL_BASE = "https://api.cirrus-ci.com";
my $task_id = $ENV{CIRRUS_TASK_ID};

# Link by *taskID*, not buildID + taskname. First, this is shorter
# and less duplicaty. Second, and more important, buildID + taskname
# is non-unique, and a link to a flake log will be clobbered.
my $URL = "${URL_BASE}/v1/artifact/task/$task_id/html/${outfile}";

print "\n\nAnnotated results:\n $URL\n";
}
Expand Down

0 comments on commit a51a630

Please sign in to comment.