ReleaseEngineering/How To/Enable a branch on buildbot and taskcluster

From MozillaWiki
Jump to: navigation, search

This documentation provides information on how to enable a branch on buildbot and taskcluster. We will consider holly branch as example.

Buildbot steps

  • Enable the branch in /mozilla/project_branches:
'holly': {
    'enable_perproduct_builds': False,
    'lock_platforms': True,
    'enable_opt_unittests': True,
    'enable_talos': False,
    'platforms': {
        'macosx64': {},
        'macosx64-debug': {},
    },
},

Explanation:

- The name of the branch is "holly"

- As you can see it was enable for 2 platforms: "macosx64" and "macosx64-debug"

- Talos tests are disabled through "enable_talos" set to False

- Opt unit tests are enabled through "enable_opt_unittests" set to True

- "lock_platforms" stands for enabling the branch strictly to the platforms written as values for "platforms" key.


  • Add the branch in <your_master>/tools/buildfarm/maintenance/production-branches.json
"holly": {
  "repo": "https://hg.mozilla.org/projects/holly",
  "repo_type": "hg",
  "access": "scm_level_2",
  "features": {
      "taskcluster-cron": true,
      "taskcluster-push": true
  }
},


Taskcluster steps

Note that the holly repository can be found at https://hg.mozilla.org/projects. It can simply be done using git clone or if the repository is larger, you can follow the instructions at https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Source_Code/Mercurial/Bundles


  • Enable the branch in taskcluster by adding the branch in taskcluster/src/config/default.yml from mozilla-taskcluster git repository:
holly:
  level: 2
  scopes:
    - "assume:repo:hg.mozilla.org/projects/holly:*"
    # temporary until this scope is removed from .taskcluster.yml
    - "assume:repo:hg.mozilla.org/try:*"


  • Filter what builds to run on the branch by adding a new target_task to point the builds you need to <branch-name>_tasks in <branch-name>/taskcluster/taskgraph/target_tasks.py

Example for macosx64 builds:

@_target_task('holly_tasks')
def target_tasks_holly(full_task_graph, parameters):
    """Bug <no of bug> - < Summary of bug>""""
    def filter(task):
        platform = task.attributes.get('build_platform')
        # only select macosx platforms, should really just be opt
        if str(platform) not in ('macosx64'):
            return False
        return True
    return [l for l, t in full_task_graph.tasks.iteritems() if filter(t)]


  • The branch needs to be added to PER_PROJECT_PARAMETERS dictionary in in <branch-name>/taskcluster/taskgraph/decision.py
PER_PROJECT_PARAMETERS = {
    'holly': {
        'target_tasks_method': 'holly_tasks',
        'optimize_target_tasks': True,
        'include_nightly': False,
    },
}

Explanation:

- "target_tasks_method" refers to "holly_tasks" which was created at step 2 in target_tasks.py

- "optimize_target_tasks" refers to the set of targeted tasks and all of their dependencies, tasks that have been optimized out are either omitted or replaced with a Task instance containing only a task_id.

- "include nightly" refers to nightly builds. Since it is set to False it means that nightly builds are excluded.


  • Enable the branch in treeherder by modifying the "active_status" flag to "active" in treeherder/model/fixtures/repository.json located in the treeherder git repository:
{
    "pk": 29,
    "model": "model.repository",
    "fields": {
        "dvcs_type": "hg",
        "name": "holly",
        "url": "https://hg.mozilla.org/projects/holly",
        "active_status": "active",
        "codebase": "gecko",
        "repository_group": 6,
        "description": ""
    }
},