Open Bug 1625033 Opened 6 months ago Updated 4 months ago

Create "built from" url artifact to replace TinderboxPrint log line

Categories

(Thunderbird :: Build Config, task)

task
Not set
normal

Tracking

(Not tracked)

REOPENED

People

(Reporter: sclements, Assigned: rjl)

Details

Attachments

(3 files)

I'm working on a task to discontinue the storage of job artifacts in the Treeherder database. I'd like to switch to retrieving artifacts in the UI directly from a taskcluster API but we're currently only able to retrieve "artifact uploaded" artifacts. A blocker to fully implementing this is TinderboxPrint. Treeherder currently parses[2] raw text logs for TinderboxPrint lines and stores them as artifacts for use in treeherder's job details panel.

[vcs 2020-03-25T18:26:51.244Z] TinderboxPrint:<a href=https://hg.mozilla.org/mozilla-central/rev/c5112a7573ac8a9d388e6253e3305061654b123e title='Built from mozilla-central revision c5112a7573ac8a9d388e6253e3305061654b123e'>c5112a7573ac8a9d388e6253e3305061654b123e</a>
[task 2020-03-25T08:27:34.766Z] 08:27:34     INFO - TinderboxPrint: xpcshell-xpcshell<br/>852/<em class="testfail">1</em>/4
[task 2020-03-25T08:27:34.850Z] 08:27:34     INFO - TinderboxPrint: CPU usage<br/>42.0%
[task 2020-03-25T08:27:34.851Z] 08:27:34     INFO - TinderboxPrint: I/O read bytes / time<br/>133,754,880 / 3,204
[task 2020-03-25T08:27:34.851Z] 08:27:34     INFO - TinderboxPrint: I/O write bytes / time<br/>3,524,530,176 / 514,556
[task 2020-03-25T08:27:34.852Z] 08:27:34     INFO - TinderboxPrint: CPU idle<br/>921.4 (57.6%)
[task 2020-03-25T08:27:34.852Z] 08:27:34     INFO - TinderboxPrint: CPU system<br/>132.4 (8.3%)
[task 2020-03-25T08:27:34.853Z] 08:27:34     INFO - TinderboxPrint: CPU user<br/>539.1 (33.7%)
[task 2020-03-25T08:27:34.853Z] 08:27:34     INFO - TinderboxPrint: Swap in / out<br/>0 / 0

We format them in our API like so:

 {

      "title": "Built from mozilla-central revision c5112a7573ac8a9d388e6253e3305061654b123e",
       "value": "c5112a7573ac8a9d388e6253e3305061654b123e",
       "url": "https://hg.mozilla.org/mozilla-central/rev/c5112a7573ac8a9d388e6253e3305061654b123e "
 }
{
     "title": "Swap in / out",
      "value": "0 / 0",
      "url": null
},

Tom.Prince suggested a structured artifact could be created that supplies that information (ideally for both the "Built by" link and the log lines).

[1] https://searchfox.org/mozilla-central/rev/4d9cd186767978a99dafe77eb536a9525980e118/taskcluster/scripts/run-task#490

[2] https://github.com/mozilla/treeherder/blob/master/treeherder/log_parser/parsers.py#L258

Hopefully some of the existing code in the two links provided could be reused.

Also up for discussion is whether all of that is still needed or should still be supported, since it seems TinderboxPrint is an old/legacy reference.

Ed Morley brought up some really good points about TinderboxPrint 2 years ago per: https://bugzilla.mozilla.org/show_bug.cgi?id=1410737#c7

Blocks: 1342296
No longer blocks: 1603249

Hi Rob, Tom.Prince suggested you are someone who could help with this issue. Specifically creating a structured artifact for the "built from ..." urls that Treeherder is parsing from TinderboxPrint log lines?

Flags: needinfo?(rob)

I'll expand a bit on my suggestion. I'm not necessarily suggesting having a tinderbox print artifact, but that the data that was using that be put into a structured artifact (i.e. json), that treeherder could present, rather than parsing all the logs.

Attached image image.png

I know one of our developers uses those links enough that he noticed when they broke recently. Probably whatever generates the target.txt artifact can produce a JSON file as well. I don't see the lack of pinning on comm-central being resolved anytime soon, though it's been on my mind.

I'll see what I can come up with.

Flags: needinfo?(rob)
Assignee: nobody → rob
Status: NEW → ASSIGNED

Rob, I'll be merging the pr on Thursday that will stop storing that link in our database. Do need more time put a patch together?

Flags: needinfo?(rob)
Treeherder is getting an update later this week that affects the "Built from" links that
appear in the Job Details panel. Rather than parsing log files, a build artifact will be
used to display these links.
The artifact is a JSON file in the suggested format.

The artifact file name is "built_from.json". Sarah, will this work?

I only did this for Thunderbird, I can port for Firefox as well if needed.

Flags: needinfo?(rob)
Attachment #9144209 - Flags: feedback?(sclements)

That works! So from the taskcluster API, it'll look like this?

{ "storageType": "s3", "name": "public/built_from.json", "expires": <date>, "contentType": "application/json" }

Comment on attachment 9144209 [details]
built_from.json sample file

Perfect :)

Attachment #9144209 - Flags: feedback?(sclements) → feedback+

Not sure where 'build' comes from? But it's present in all of the artifacts it looks like.
Here's the try job I ran if it's helpful.
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=8b06fe04af5e470a536432f5d6f654e2c2d95beb

{
  "storageType": "s3",
  "name": "public/build/built_from.json",
  "expires": "2020-05-27T00:51:52.797Z",
  "contentType": "application/json"
},

(In reply to Sarah Clements [:sclements] from comment #9)

That works! So from the taskcluster API, it'll look like this?

{ "storageType": "s3", "name": "public/built_from.json", "expires": <date>, "contentType": "application/json" }

Attachment #9144206 - Flags: review?(geoff)
Comment on attachment 9144206 [details] [diff] [review]
Create build artifact to generate "Built from" links in Treeherder

LGTM!
Attachment #9144206 - Flags: review?(geoff) → review+
Component: Task Configuration → Build Config
Product: Firefox Build System → Thunderbird

Rob, can you let me know when this is change is live (a sample task where it's showing up would be helpful). I want to test the changes I made before I merge it.

Pushed by thunderbird@calypsoblue.org:
https://hg.mozilla.org/comm-central/rev/dce2046514b0
Create build artifact to generate "Built from" links in Treeherder. r=darktrojan CLOSED TREE

Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 77.0

This build will have the artifact.
https://treeherder.mozilla.org/#/jobs?repo=comm-central&selectedTaskRun=QHNQh09ZQha4Hqa5dz-AJg-0&revision=dce2046514b0a603c84bbf6cbf1cbc8730faf35e

It just occurred to me, I only have this artifact on build jobs. It would be useful on the Decision task as well, I'll do that in a follow-up somehow.

I think it would make sense for run-task to be changed to emit this, rather than having it as part of the build process.

Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: Thunderbird 77.0 → ---

Currently run-task doesn't seem to write any artifacts, and it looks like it doesn't really know where the right place to do so would be with the information it has. Is there a predictable way of finding the right path for artifacts?

UPLOAD_DIR is not always set when run-task executes. Can I rely on using /builds/worker/artifacts? (%TASKDIR%\builds\public for generic-workers?)

(In reply to Tom Prince [:tomprince] from comment #16)

I think it would make sense for run-task to be changed to emit this, rather than having it as part of the build process.

Flags: needinfo?(mozilla)

(In reply to Rob Lemley [:rjl] from comment #17)

Is there a predictable way of finding the right path for artifacts?

The predictable way is to add an argument to run-task to say where to put it, and adjust the taskgraph.transforms.job.run_task transform to pass that argument, and add an additional artifact specification to cover the path it uses; (my initial reaction is that run-task should use a different artifact namespace than "user level" things.

Flags: needinfo?(mozilla)
No longer blocks: 1342296
Summary: Create TinderboxPrint artifacts for Treeherder use → Create "built from" url artifact to replace TinderboxPrint log line
You need to log in before you can comment on or make changes to this bug.