[buildbucket] Swap step_text and links in summary_markdown

Bug: 850113
Change-Id: I61f533772e168d036d13d5c105d82f32eda87d84
Reviewed-on: https://chromium-review.googlesource.com/c/1395781
Reviewed-by: Nodir Turakulov <nodir@chromium.org>
Commit-Queue: Ryan Tseng <hinoka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#19779}
diff --git a/appengine/cr-buildbucket/annotations.py b/appengine/cr-buildbucket/annotations.py
index 70f161b..1a66236 100644
--- a/appengine/cr-buildbucket/annotations.py
+++ b/appengine/cr-buildbucket/annotations.py
@@ -77,11 +77,6 @@
     if ann_step.failure_details.text:
       summary_paragraph_lines.append([ann_step.failure_details.text])
 
-    # Parse links.
-    link_lines, logs = self._parse_links(ann_step)
-    summary_paragraph_lines.append(link_lines)
-    ret.logs.extend(logs)
-
     # Parse step text.
     # Although annotation.proto says each line in step_text is a consecutive
     # line and should not contain newlines, in practice they are in HTML format
@@ -93,6 +88,11 @@
     if ann_step.text:
       summary_paragraph_lines.append([' '.join(ann_step.text)])
 
+    # Parse links, place them below the step text.
+    link_lines, logs = self._parse_links(ann_step)
+    summary_paragraph_lines.append(link_lines)
+    ret.logs.extend(logs)
+
     # Compile collected summary.
     assert all(isinstance(lines, list) for lines in summary_paragraph_lines)
     assert all(