2019-09-12 16:45:26 +00:00
|
|
|
# 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 http://mozilla.org/MPL/2.0/.
|
|
|
|
|
|
|
|
from __future__ import absolute_import, print_function, unicode_literals
|
|
|
|
|
2019-09-24 10:52:05 +00:00
|
|
|
import os
|
|
|
|
import re
|
|
|
|
|
|
|
|
from taskgraph.target_tasks import _target_task, filter_for_tasks_for
|
|
|
|
|
|
|
|
|
|
|
|
BETA_SEMVER = re.compile(r'^v\d+\.\d+\.\d+-beta\.\d+$')
|
|
|
|
PRODUCTION_SEMVER = re.compile(r'^v\d+\.\d+\.\d+(-rc\.\d+)?$')
|
2019-09-12 16:45:26 +00:00
|
|
|
|
2019-09-18 09:40:14 +00:00
|
|
|
|
2019-09-12 16:45:26 +00:00
|
|
|
@_target_task('default')
|
|
|
|
def target_tasks_default(full_task_graph, parameters, graph_config):
|
|
|
|
"""Target the tasks which have indicated they should be run on this project
|
|
|
|
via the `run_on_projects` attributes."""
|
|
|
|
|
2019-09-24 10:52:05 +00:00
|
|
|
filter = filter_for_tasks_for
|
|
|
|
if parameters["tasks_for"] == 'github-release':
|
|
|
|
# TODO Move GIT_TAG as to a parameter
|
|
|
|
git_tag = os.environ['GIT_TAG']
|
|
|
|
version = git_tag[1:] # remove prefixed "v"
|
|
|
|
|
|
|
|
if BETA_SEMVER.match(git_tag):
|
|
|
|
def filter(task, params):
|
|
|
|
return task.attributes.get("release-type", "") == "beta"
|
|
|
|
elif PRODUCTION_SEMVER.match(git_tag):
|
|
|
|
def filter(task, params):
|
|
|
|
return task.attributes.get("release-type", "") == "production"
|
|
|
|
else:
|
|
|
|
raise ValueError('Github tag must be in semver format and prefixed with a "v", '
|
|
|
|
'e.g.: "v1.0.0-beta.0" (beta), "v1.0.0-rc.0" (production) or "v1.0.0" (production)')
|
2019-09-18 09:40:14 +00:00
|
|
|
|
2019-09-24 10:52:05 +00:00
|
|
|
return [l for l, t in full_task_graph.tasks.iteritems() if filter(t, parameters)]
|
2019-09-13 10:48:22 +00:00
|
|
|
|
|
|
|
|
2019-09-18 10:49:22 +00:00
|
|
|
@_target_task("nightly")
|
|
|
|
def target_tasks_nightly(full_task_graph, parameters, graph_config):
|
|
|
|
"""Select the set of tasks required for a nightly build."""
|
|
|
|
|
|
|
|
def filter(task, parameters):
|
2019-09-24 10:52:05 +00:00
|
|
|
return task.attributes.get("nightly", False)
|
2019-09-18 10:49:22 +00:00
|
|
|
|
|
|
|
return [l for l, t in full_task_graph.tasks.iteritems() if filter(t, parameters)]
|
2019-09-16 09:03:42 +00:00
|
|
|
|
|
|
|
|
2019-09-13 10:48:22 +00:00
|
|
|
@_target_task('raptor')
|
|
|
|
def target_tasks_raptor(full_task_graph, parameters, graph_config):
|
2019-09-24 10:52:05 +00:00
|
|
|
def filter(task, params):
|
|
|
|
return task.kind == 'raptor'
|
2019-09-18 09:40:14 +00:00
|
|
|
|
|
|
|
return [l for l, t in full_task_graph.tasks.iteritems() if filter(t, parameters)]
|