Revision control

Copy as Markdown

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at
import os
import re
from taskgraph.filter_tasks import filter_task
REPO_RE = r'((?P<owner>[\.\w-]+)[/:])?(?P<branch>[\.\w-]+)'
FIREFOX_IOS_BRANCH_RE = re.compile(r'\[firefox-ios:\s*' + REPO_RE + r'\]')
FIREFOX_ANDROID_BRANCH_RE = re.compile(r'\[firefox-android:\s*' + REPO_RE + r'\]')
def calc_branch_build_param(parameters):
title = os.environ.get("APPSERVICES_PULL_REQUEST_TITLE", "")
branch_build = {}
firefox_android_branch_match =
if firefox_android_branch_match:
branch_build['firefox-android'] = {
'owner': calc_owner(firefox_android_branch_match),
firefox_ios_branch_match =
if firefox_ios_branch_match:
branch_build['firefox-ios'] = {
'owner': calc_owner(firefox_ios_branch_match),
return branch_build
def calc_owner(match):
return 'mozilla-mobile'
def filter_branch_build_tasks(full_task_graph, parameters, graph_config):
def should_keep_task(task):
task_branch_build = task.attributes.get("branch-build")
if task_branch_build is None:
# Don't filter out tasks without a `branch-build` attribute
return True
# For tasks with a `branch-build` attribute, include them if there's a matching
# parameter
return task_branch_build in parameters.get('branch-build', {})
return [l for l, task in full_task_graph.tasks.items() if should_keep_task(task)]