gecko-dev/taskcluster/taskgraph/util/attributes.py
Justin Wood 07e0d66261 Bug 1352113 - Shippable Builds - Support shippable where 'nightly' is used. r=aki
Makes most kinds that reference nightly attribute reference the shippable attribute.
Also makes most transforms that use nightly use shippable

Transfers dependencies/ownership for some things to shippable from nightly where it was harder to support both.

In no particular order, full list:
Send shippable attribute down to dep tasks.
Set tests as shippable attribute
Add new signing routes
Add shippable routes to repackage_routes transform
Adjust target tasks
Add shippable nightly-l10n
Add nightly-signing and as a side affect add repackage and repackage-signing
Add support for proper balrog platforms for shippable
Add shippable to the nightly sccache guard
Fix TC_PLATFORM_PER_FTP in partners.py to use shippable
Add shippable to mozharness_test variants
Only actually used for android which doesn't have shippable at this time.
Add shippable variant to beetmover transforms
Do nightly signing for mars on shippable
Support shippable in partner-repack transform
Support shippable in amo langpacks transform
Use proper signing for shippable tasks in repackage transforms
Set upload symbols to use shippable too
Use shippable as deps for geckodriver extraction
Use shippable as dep for autograph-stage signing
Do not run beetmover-l10n for shippable
Run shippable style jobs for repackage signing
Set build_platform for update verify and uvc to be shippable
Run repackage-msi for shippable
Add shippable to osx partner repack signing
add shippable to emefree repackage
add shippable to emefree repackage signing
add shippable to beetmover checksums
Add shippable to partner repack repackage signing
add partner repack beetmover
Add shippable to mar signing
Add shippable to mar-signing-l10n
add shippable to eme free beetmover checksums
Add shippable to upload-generated-sources
Add beetmover langpacks to shippable
Add repackage-l10n to shippable
Add shippable to partner repack chunk-dummy
Do eme free builds with shippable
Add signing of language packs to shippable
Add snap repackage for shippable
Add shippable for release-eme-free repack signing
Add partials for shippable
Add partner repack repackage for shippable
Add emefree beetmover for shippable
Add checksums-signing to shippable
Switch partner repacks to shippable
Add shippable to beetmover-repackage
Add secondary update verify configs for shippable
secondary update verify for shippable

Differential Revision: https://phabricator.services.mozilla.com/D24699

--HG--
extra : moz-landing-system : lando
2019-03-27 13:45:40 +00:00

152 lines
4.2 KiB
Python

# 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
import re
INTEGRATION_PROJECTS = {
'mozilla-inbound',
'autoland',
}
TRUNK_PROJECTS = INTEGRATION_PROJECTS | {'mozilla-central', 'comm-central'}
RELEASE_PROJECTS = {
'mozilla-central',
'mozilla-beta',
'mozilla-release',
'mozilla-esr60',
'comm-central',
'comm-beta',
'comm-esr60',
'oak',
}
RELEASE_PROMOTION_PROJECTS = {
'jamun',
'maple',
'try',
'try-comm-central',
} | RELEASE_PROJECTS
_OPTIONAL_ATTRIBUTES = (
'artifact_prefix',
'l10n_chunk',
'locale',
'nightly',
'required_signoffs',
'signed',
'shipping_phase',
'shipping_product',
'stub-installer',
'update-channel',
'shippable',
)
def attrmatch(attributes, **kwargs):
"""Determine whether the given set of task attributes matches. The
conditions are given as keyword arguments, where each keyword names an
attribute. The keyword value can be a literal, a set, or a callable. A
literal must match the attribute exactly. Given a set, the attribute value
must be in the set. A callable is called with the attribute value. If an
attribute is specified as a keyword argument but not present in the
attributes, the result is False."""
for kwkey, kwval in kwargs.iteritems():
if kwkey not in attributes:
return False
attval = attributes[kwkey]
if isinstance(kwval, set):
if attval not in kwval:
return False
elif callable(kwval):
if not kwval(attval):
return False
elif kwval != attributes[kwkey]:
return False
return True
def keymatch(attributes, target):
"""Determine if any keys in attributes are a match to target, then return
a list of matching values. First exact matches will be checked. Failing
that, regex matches and finally a default key.
"""
# exact match
if target in attributes:
return [attributes[target]]
# regular expression match
matches = [v for k, v in attributes.iteritems() if re.match(k + '$', target)]
if matches:
return matches
# default
if 'default' in attributes:
return [attributes['default']]
return []
def match_run_on_projects(project, run_on_projects):
"""Determine whether the given project is included in the `run-on-projects`
parameter, applying expansions for things like "integration" mentioned in
the attribute documentation."""
if 'all' in run_on_projects:
return True
if 'integration' in run_on_projects:
if project in INTEGRATION_PROJECTS:
return True
if 'release' in run_on_projects:
if project in RELEASE_PROJECTS:
return True
if 'trunk' in run_on_projects:
if project in TRUNK_PROJECTS:
return True
return project in run_on_projects
def match_run_on_hg_branches(hg_branch, run_on_hg_branches):
"""Determine whether the given project is included in the `run-on-hg-branches`
parameter. Allows 'all'."""
if 'all' in run_on_hg_branches:
return True
for expected_hg_branch_pattern in run_on_hg_branches:
if re.match(expected_hg_branch_pattern, hg_branch):
return True
return False
def copy_attributes_from_dependent_job(dep_job):
attributes = {
'build_platform': dep_job.attributes.get('build_platform'),
'build_type': dep_job.attributes.get('build_type'),
}
attributes.update({
attr: dep_job.attributes[attr]
for attr in _OPTIONAL_ATTRIBUTES if attr in dep_job.attributes
})
return attributes
def sorted_unique_list(*args):
"""Join one or more lists, and return a sorted list of unique members"""
combined = set().union(*args)
return sorted(combined)
def release_level(project):
"""
Whether this is a staging release or not.
:return six.text_type: One of "production" or "staging".
"""
return 'production' if project in RELEASE_PROJECTS else 'staging'