Closed Bug 1204490 Opened 4 years ago Closed 3 years ago

Tasks spawned from Gecko tree pushes should have a link to treeherder results for push

Categories

(Firefox Build System :: Task Configuration, task)

task
Not set

Tracking

(Not tracked)

RESOLVED FIXED
mozilla53

People

(Reporter: ted, Assigned: wlach, Mentored)

Details

(Keywords: good-first-bug)

Attachments

(1 file)

Not sure if this is the right component, feel free to move.

If a task is spawned from a Gecko tree push (doesn't matter what the repo is), it would be nice if the task had a link to the treeherder results for the push that you could easily click in the Task Inspector.

Right now Treeherder has a link to the Task Inspector, but there's no link to go the other way.
Hi Ed, (or please point us to the right person) 

Can we get a link to the treeherder results for a Gecko tree push from an API? Happy for just a docs link if it is. If not, is this a reasonable thing to ask to add to the roadmap? Thank you!

-selena
Flags: needinfo?(emorley)
The URL for Treeherder is deterministic - no API is required to generate it. ie:
https://treeherder.mozilla.org/#/jobs?repo=REPO&revision=REVISION

eg:
https://treeherder.mozilla.org/#/jobs?repo=mozilla-inbound&revision=adac35e4feeb

Using revision + repo name a link to Treeherder could be added to either the task page:
https://github.com/taskcluster/taskcluster-tools/blob/master/lib/ui/taskinfo.jsx

Or the run page:
https://github.com/taskcluster/taskcluster-tools/blob/master/lib/ui/runinfo.jsx
Flags: needinfo?(emorley)
Rather than making TaskCluster do this (which requires some pretty hackish introspection of the task payload to guess if it's a gecko job or not), I think the right thing to do is to have the decision task set the `source` link in the task description to point to this URL.  Right now that's just a dummy URL (http://todo.com/soon): https://tools.taskcluster.net/task-inspector/#N52EjyJRQhyIfBFtXBF4xw/
Whiteboard: [good-first-bug][mentor=dustin]
Whiteboard: [good-first-bug][mentor=dustin] → [good-first-bug]
Mentor: dustin
Component: Integration → Platform and Services
The source URL now points to the source for the task (the kind.yml file, at least).  I don't necessarily want to re-use that, after all, treeherder is not the source.

We could add some gecko-specific code to the tools UI that looks for `task.extra.treeherder` and, if present, tries to invent a treeherder URL as described in comment 2.
Component: Platform and Services → Tools
My 2 cents...

So, while I don't like adding treeherder-specific code to tools for when TaskCluster is not just a platform for projects reporting to treeherder, it would be doable with going through some hoops.

For tasks originating from hg pushes, we could parse the route to find the repo and revision to construct the URL.  Right now there is a direct mapping of repo (such as mozilla-inbound) to project name in TH.  However if you want to have a link back to a particular job in TH that represents the task you're inspecting, that's a little trickier I think.  As far as I know, there is not a URL that allows one to specify the job GUID to link back.  I believe it's an internal ID to TH. To discover what that is, we would need to query TH to find out that job ID for the particular task before constructing the URL.

Then for tasks reporting to treeherder from Github, that gets a little trickier.  Github repos are mapped to a TH project by looking at the user, repo, and branch.  For instance something like https://github.com/mozilla-bteam/bmo has two TH projects.  One is bmo-master for the master branch and bmo-try for the development branch.  The tasks do not know of this, neither does taskcluster-treeherder.  Treeherder will look at the user, repo, and branch information provided by taskcluster-treeherder to find the corresponding TH project.  I'm not sure if this is exposed via an API yet.
This is done now, isn't it?
I suspect the more useful link would be the push view in TH, anyway.  But you're right about github pushes.

Maybe this *would* be better accomplished in the decision task -- we could certainly re-purpose "source" to that end.

So, the steps would be as follows:

 * figure out where task.metadata.source is set in the in-tree taskgraph generation code
 * modify that to create a treeherder URL as described in comment 2
 * push to try to test
 * get review
 * land
Component: Tools → Task Configuration
Keywords: good-first-bug
Whiteboard: [good-first-bug]
I'm going to try and do this.
Assignee: nobody → wlachance
(In reply to William Lachance (:wlach) from comment #10)
> https://treeherder.mozilla.org/#/jobs?repo=try&revision=851013bd9d62

I spent some time building an extension to the task schema to accept an arbitrary set of links (https://github.com/taskcluster/taskcluster-queue/pull/138), which seems to work ok, but might be overkill.

So on irc jonasfj suggested adding the treeherder push to the description field, which I think looks pretty reasonable:

https://tools.taskcluster.net/task-inspector/#VxjeP8fXSBq36kiJlkIt1g/

Does this seem like an ok solution Dustin? If so, I'll post the (trivial) patch for review.
Flags: needinfo?(dustin)
Works for me.  I was fine with putting it in the "source" field, and this is way better :)
Flags: needinfo?(dustin)
Comment on attachment 8828069 [details]
Bug 1204490 - Add link to treeherder to taskcluster task descriptions

https://reviewboard.mozilla.org/r/105588/#review106426
Attachment #8828069 - Flags: review?(dustin) → review+
Pushed by wlachance@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/05ba56765a31
Add link to treeherder to taskcluster task descriptions r=dustin
https://hg.mozilla.org/mozilla-central/rev/05ba56765a31
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
Product: TaskCluster → Firefox Build System
You need to log in before you can comment on or make changes to this bug.