Closed Bug 1204891 Opened 9 years ago Closed 5 years ago

[tracker] support .taskcluster.yml in hg.mozilla.org repositories without mozilla-taskcluster

Categories

(Taskcluster :: Services, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: pmoore, Assigned: dustin)

References

Details

Like we have in taskcluster-github, but for hg repositories. Eventually then gecko would use this mechanism to trigger taskcluster jobs.
See Also: → 1234890
See Also: 1234890
Component: General → Task Configuration
Component: Task Configuration → Integration
Summary: Support taskcluster.yml in hg.mozilla.org repositories → taskcluster-hg -- support taskcluster.yml in hg.mozilla.org repositories
I'm frustrated enough with m-t to take a go at this.  No promises :)
Assignee: nobody → dustin
I think I'll call it 'taskcluster-mercurial'.  Also, half the work is already done:

https://mozilla-version-control-tools.readthedocs.io/en/latest/hgmo/notifications.html

I'd like to make this compatible with taskcluster-github, in the sense that you can use the same .taskcluster.yml for a repo that's mirrored between github and hg.m.o.  That should be pretty easy, as all of the github config is buried under task.extra.github, so I'll put similar things under task.extra.mercurial.

.taskcluster.yml already has template variables defined for most of the values the decision task needs.  The remainder are `project`, `level`, and `message`.  I think the former can be defined in an in-tree array, and the latter can be determined locally from the hg history.  So I think I will modify the decision tasks to calculate these things in-tree, thereby eliminating the need for any per-tree configuration in taskcluster-mercurial.

One of the cool outcomes of this is that we could, in principle, allow builds of pushes to user repos, too.  We can decide whether that's allowed by assigning scopes via roles.
Oh, duh, I can just implement this as a hook, given bug 1225243 :)
Depends on: 1225243
Blocks: 1181979
Component: Integration → Platform and Services
Assignee: dustin → nobody
Assignee: nobody → alesilva241
Summary: taskcluster-hg -- support taskcluster.yml in hg.mozilla.org repositories → support .taskcluster.yml in hg.mozilla.org repositories without mozilla-taskcluster
Hi Alex, are you still working on this? Thanks!
Flags: needinfo?(alesilva241)
h(In reply to Pete Moore [:pmoore][:pete] from comment #4)
> Hi Alex, are you still working on this? Thanks!

Hi Pete, I am still working on trigger a hook by pulse messages! This task is the next..
Flags: needinfo?(alesilva241)
Assignee: alesilva241 → nobody
Summary: support .taskcluster.yml in hg.mozilla.org repositories without mozilla-taskcluster → [tracker] support .taskcluster.yml in hg.mozilla.org repositories without mozilla-taskcluster
I'll get back into coordinating this.  Hopefully YD will have the hooks functionality for this ready soon :)
Assignee: nobody → dustin

Here's the information provided in the JSON context by mozilla-taskcluster:

{
  // tasks_for (string) - always 'hg-push' for mozilla-taskcluster (this is to
  // distinguish from other tools that might read the same template, such as
  // taskcluster-github)
  tasks_for: 'hg-push',

  push: {
    // push.owner (string) - the hg user that made the push (not always an email)
    owner: '..',

    // push.revision (string) - long hg revision hash
    revision: '..',

    // push.comment (string) - commit comment from the last commit in the push
    comment: '..'

    // push.pushlog_id (number) - id of this push in the hg pushlog; see
    // http://mozilla-version-control-tools.readthedocs.io/en/latest/hgmo/pushlog.html#writing-agents-that-consume-pushlog-data
    pushlog_id: ..,

    // push.pushdate (number) - epoch timestamp when this push occurred
    pushdate: ..,
  },

  repository: {
    // repo.url (string) - repository root URL (begins with `https://`, ends with `/`)
    url: '..',

    // repo.project (string) - alias for this repository
    project: '..',

    // repo.level (number) - SCM level for this repo
    level: ..,
  },

  // now (string) - the current time, useful for reproducible $fromNow invocations
  now: '..',

  // as_slugid (function) - given a label, generate a slugid.  Multiple calls with the
  // same label in the same push will generate the same slugiid, but different slugids
  // in different pushes.  Use this to generate taskIds, etc.
  as_slugid: function(label) { .. },
}

and here's an example v2 message:

{
  "type": "changegroup.1",
  "data": {
    "repo_url": "https://hg.mozilla.org/try",
    "heads": ["eb6d9371407416e488d2b2783a5a79f8364330c8"],
    "pushlog_pushes": [{
      "time": 14609750810,
      "pushid": 120040,
      "user": "tlin@mozilla.com",
      "push_json_url": "https://hg.mozilla.org/try/json-pushes?version=2&startID=120039&endID=120040",
      "push_full_json_url": "https://hg.mozilla.org/try/json-pushes?version=2&full=1&startID=120039&endID=120040"
    }]
  }
}

so I think we need:

  • tasks_for: "hg-push"
  • push:
    • owner: payload.data.pushlog_pushes[0].user
    • revision: payload.data.heads[0]
    • comment: needs to be fetched
    • pushlog_id: payload.data.pushlog_pushes[0].pushid
    • pushdate: payload.data.pushlog_pushes[0].pushlog_id
  • repository: defined in the hook, created by ci-admin
  • now: provided by json-e
  • as_slugid: hooks wants to produce one task with a taskid of its own devising, so this needs revision

We'll need bug 1522891 to allow not creating a task for other events than "changegroup.1". If we can adjust the decision task to fetch the comment on its own, and solve the as_slugid question, then all of the above can be done easily in json-e.

This is my ideal: hooks directly creates the decision task, rather than how we do cron tasks, where a "cron task" task creates a "cron job" task which finally runs ./mach taskgraph decision.

Depends on: 1524358
Depends on: 1522891

Tom, what are your thoughts on the above in light of rTASKGRAPH? Would it make more sense to chain together two tasks in order to support a more general .taskcluster.yml format?

Flags: needinfo?(mozilla)

We chatted about this in IRC. The plan we came up with is:

  • the hooks service will receive pulse message and generate a task from it.
  • the hook will directly generate a decision task directly
  • to start with, ci-admin will populate the hook from .taskcluster.yml
  • we talked about having a higher-level format for describing the tasks, but the details are up in the air.

A few details that we didn't discuss:

  • We probably don't want the pulse message at the top-level, so we can have other things in the context, like the task id.
  • I think ci-admin should wrap the .taskcluster.yml to restructure the input to match the current format (much like actions are here).

At least in the short-term, this will make changing the .taskcluster.yml harder, and not self-serve. I think this is a reasonable trade-off, to get to using pulse.

Flags: needinfo?(mozilla)
Depends on: 1525348
Depends on: 1491371
Component: Platform and Services → Services
Depends on: 1526979
Depends on: 1535635

The way I implemented this ends up not depending on bug 1491371, although I'd still love to see that landed!

No longer depends on: 1491371

I'll loop back to delete the mozilla-taskcluster app (which is already disabled) in a few days, but otherwise this is done.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED

I just deleted the TC creds.

Bug 1538033: delete pulse creds

Bug 1538034: delete treeherder API key

I sent a backup of the config DB to brian and coop, and have a copy myself. Encrypted.

And then I deleted the app. Angels sang.

You need to log in before you can comment on or make changes to this bug.