[codesize] Show diffs for CI jobs
Bug: skia:13704
Change-Id: I54ff2e35fe07292361bee0b2f0ed1b9a1d8a08df
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/581835
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
diff --git a/codesize/modules/binary-diff-page-sk/binary-diff-page-sk.ts b/codesize/modules/binary-diff-page-sk/binary-diff-page-sk.ts
index 93ced22..57dab30 100644
--- a/codesize/modules/binary-diff-page-sk/binary-diff-page-sk.ts
+++ b/codesize/modules/binary-diff-page-sk/binary-diff-page-sk.ts
@@ -10,12 +10,18 @@
export class BinaryDiffPageSk extends ElementSk {
private static template = (el: BinaryDiffPageSk) => {
- if (el.metadata === null) {
+ if (!el.metadata) {
return html`<p>Loading...</p>`;
}
- const clAnchorText = `Issue ${el.metadata?.patch_issue}, PS ${el.metadata?.patch_set}`;
- const clAnchorHref = `https://review.skia.org/${el.metadata?.patch_issue}/${el.metadata?.patch_set}`;
+ const isTryJob = el.metadata.patch_issue || el.metadata.patch_set;
+
+ const anchorText = isTryJob
+ ? `Issue ${el.metadata.patch_issue}, PS ${el.metadata.patch_set}`
+ : el.metadata.revision.substring(0, 7);
+ const anchorHref = isTryJob
+ ? `https://review.skia.org/${el.metadata.patch_issue}/${el.metadata.patch_set}`
+ : `https://skia.googlesource.com/skia/+/${el.metadata.revision}`;
const compileTaskNameHref = `https://task-scheduler.skia.org/task/${el.metadata?.task_id}`;
return html`
@@ -29,7 +35,7 @@
</h2>
<p>
- <a href="${clAnchorHref}">${clAnchorText}</a>
+ <a href="${anchorHref}">${anchorText}</a>
${el.metadata?.subject}
<br/>
<span class="author-and-timestamp">
diff --git a/codesize/modules/index-page-sk/demo_data.ts b/codesize/modules/index-page-sk/demo_data.ts
index ebcac74..8304a61 100644
--- a/codesize/modules/index-page-sk/demo_data.ts
+++ b/codesize/modules/index-page-sk/demo_data.ts
@@ -19,6 +19,7 @@
binary_name: 'dm',
bloaty_cipd_version: 'version:1',
bloaty_args: ['build/dm', '-d', 'compileunits,symbols', '-n', '0', '--tsv'],
+ bloaty_diff_args: ['build/dm', '--', 'build_nopatch/dm'],
patch_issue: '',
patch_server: '',
patch_set: '',
diff --git a/codesize/modules/index-page-sk/index-page-sk.ts b/codesize/modules/index-page-sk/index-page-sk.ts
index efb1b35..e2a294c 100644
--- a/codesize/modules/index-page-sk/index-page-sk.ts
+++ b/codesize/modules/index-page-sk/index-page-sk.ts
@@ -24,7 +24,7 @@
const metadata = binariesFromCommitOrPatchset.binaries[0].metadata;
const isTryJob = metadata.patch_issue || metadata.patch_set;
- const hasDiff = isTryJob && metadata.bloaty_diff_args;
+ const hasDiff = metadata.bloaty_diff_args;
const commitOrCLAnchorText = isTryJob
? `Issue ${metadata.patch_issue}, PS ${metadata.patch_set}`
@@ -58,14 +58,19 @@
return `/binary?${new URLSearchParams(params).toString()}`;
};
- // Only available for tryjobs.
const hrefForBinaryDiff = (output: Binary) => {
const params: Record<string, string> = {
binary_name: output.metadata.binary_name,
compile_task_name: output.metadata.compile_task_name,
- patch_issue: output.metadata.patch_issue,
- patch_set: output.metadata.patch_set,
};
+ if (output.metadata.patch_issue) {
+ // Tryjob data is identified by CL and PS
+ params.patch_issue = output.metadata.patch_issue;
+ params.patch_set = output.metadata.patch_set;
+ } else {
+ // Primary branch data is identified by git revision.
+ params.commit = output.metadata.revision;
+ }
return `/binary_diff?${new URLSearchParams(params).toString()}`;
};