bug 1431799 - add version input to release promotion action. r=bhearsum

also clean up and move more config to the promotion config.

MozReview-Commit-ID: FmTWNNPcEaZ

--HG--
extra : rebase_source : 40431217fafb6796dbd65c7dfeab0e891ac1bbd4
extra : source : 0f5418a83477c1b6b221e4d28515792410e504d0
This commit is contained in:
Aki Sasaki 2018-01-26 13:09:35 -08:00
parent a455ebaa63
commit 5795b692ae
7 changed files with 69 additions and 86 deletions

View File

@ -144,6 +144,12 @@ Release Promotion
``build_number``
Specify the release promotion build number.
``version``
Specify the version for release tasks.
``app_version``
Specify the application version for release tasks. For releases, this is often a less specific version number than ``version``.
``next_version``
Specify the next version for version bump tasks.

View File

@ -8,6 +8,9 @@ import os
GECKO = os.path.realpath(os.path.join(__file__, '..', '..', '..'))
APP_VERSION_PATH = os.path.join(GECKO, "browser", "config", "version.txt")
VERSION_PATH = os.path.join(GECKO, "browser", "config", "version_display.txt")
# Maximum number of dependencies a single task can have
# https://docs.taskcluster.net/reference/platform/taskcluster-queue/references/api#createTask
# specifies 100, but we also optionally add the decision task id as a dep in

View File

@ -23,27 +23,45 @@ from taskgraph.util.attributes import RELEASE_PROMOTION_PROJECTS
RELEASE_PROMOTION_CONFIG = {
'promote_fennec': {
'target_tasks_method': 'promote_fennec',
'product': 'fennec',
},
'ship_fennec': {
'target_tasks_method': 'ship_fennec',
'product': 'fennec',
},
'promote_firefox': {
'target_tasks_method': 'promote_firefox',
'product': 'firefox',
},
'push_firefox': {
'target_tasks_method': 'push_firefox',
'product': 'firefox',
},
'ship_firefox': {
'target_tasks_method': 'ship_firefox',
'product': 'firefox',
},
'promote_firefox_rc': {
'target_tasks_method': 'promote_firefox',
'product': 'firefox',
'desktop_release_type': 'rc',
},
'ship_firefox_rc': {
'target_tasks_method': 'ship_firefox',
'product': 'firefox',
'desktop_release_type': 'rc',
},
'promote_devedition': {
'target_tasks_method': 'promote_devedition',
'product': 'devedition',
},
'push_devedition': {
'target_tasks_method': 'push_devedition',
'product': 'devedition',
},
'ship_devedition': {
'target_tasks_method': 'ship_devedition',
'product': 'devedition',
},
}
@ -60,27 +78,10 @@ UPTAKE_MONITORING_PLATFORMS_FLAVORS = (
PARTIAL_UPDATES_FLAVORS = UPTAKE_MONITORING_PLATFORMS_FLAVORS + (
'promote_firefox',
'promote_firefox_rc',
'promote_devedition',
)
DESKTOP_RELEASE_TYPE_FLAVORS = (
'promote_firefox',
'push_firefox',
'ship_firefox',
'promote_devedition',
'push_devedition',
'ship_devedition',
)
VALID_DESKTOP_RELEASE_TYPES = (
'beta',
'devedition',
'esr',
'release',
'rc',
)
def is_release_promotion_available(parameters):
return parameters['project'] in RELEASE_PROMOTION_PROJECTS
@ -127,12 +128,6 @@ def is_release_promotion_available(parameters):
'description': 'The flavor of release promotion to perform.',
'enum': sorted(RELEASE_PROMOTION_CONFIG.keys()),
},
'target_tasks_method': {
'type': 'string',
'title': 'target task method',
'description': ('Optional: the target task method to use to generate '
'the new graph.'),
},
'rebuild_kinds': {
'type': 'array',
'description': ('Optional: an array of kinds to ignore from the previous '
@ -150,9 +145,19 @@ def is_release_promotion_available(parameters):
'type': 'string',
},
},
'version': {
'type': 'string',
'description': ('Optional: override the version for release promotion. '
"Occasionally we'll land a taskgraph fix in a later "
'commit, but want to act on a build from a previous '
'commit. If a version bump has landed in the meantime, '
'relying on the in-tree version will break things.'),
'default': '',
},
'next_version': {
'type': 'string',
'description': 'Next version.',
'description': ('Next version. Required in the following flavors: '
'{}'.format(sorted(VERSION_BUMP_FLAVORS))),
'default': '',
},
@ -169,7 +174,8 @@ def is_release_promotion_available(parameters):
# }
'partial_updates': {
'type': 'object',
'description': 'Partial updates.',
'description': ('Partial updates. Required in the following flavors: '
'{}'.format(sorted(PARTIAL_UPDATES_FLAVORS))),
'default': {},
'additionalProperties': {
'type': 'object',
@ -207,11 +213,6 @@ def is_release_promotion_available(parameters):
'default': [],
},
'desktop_release_type': {
'type': 'string',
'default': '',
},
'release_eta': {
'type': 'string',
'default': '',
@ -222,8 +223,9 @@ def is_release_promotion_available(parameters):
)
def release_promotion_action(parameters, input, task_group_id, task_id, task):
release_promotion_flavor = input['release_promotion_flavor']
promotion_config = RELEASE_PROMOTION_CONFIG[release_promotion_flavor]
release_history = {}
desktop_release_type = None
product = promotion_config['product']
next_version = str(input.get('next_version') or '')
if release_promotion_flavor in VERSION_BUMP_FLAVORS:
@ -234,12 +236,7 @@ def release_promotion_action(parameters, input, task_group_id, task_id, task):
"targets." % ', '.join(VERSION_BUMP_FLAVORS)
)
if release_promotion_flavor in DESKTOP_RELEASE_TYPE_FLAVORS:
desktop_release_type = input.get('desktop_release_type', None)
if desktop_release_type not in VALID_DESKTOP_RELEASE_TYPES:
raise Exception("`desktop_release_type` must be one of: %s" %
", ".join(VALID_DESKTOP_RELEASE_TYPES))
if product in ('firefox', 'devedition'):
if release_promotion_flavor in PARTIAL_UPDATES_FLAVORS:
partial_updates = json.dumps(input.get('partial_updates', {}))
if partial_updates == "{}":
@ -247,9 +244,7 @@ def release_promotion_action(parameters, input, task_group_id, task_id, task):
"`partial_updates` property needs to be provided for %s "
"targets." % ', '.join(PARTIAL_UPDATES_FLAVORS)
)
balrog_prefix = 'Firefox'
if desktop_release_type == 'devedition':
balrog_prefix = 'Devedition'
balrog_prefix = product.title()
os.environ['PARTIAL_UPDATES'] = partial_updates
release_history = populate_release_history(
balrog_prefix, parameters['project'],
@ -267,9 +262,8 @@ def release_promotion_action(parameters, input, task_group_id, task_id, task):
promotion_config = RELEASE_PROMOTION_CONFIG[release_promotion_flavor]
target_tasks_method = input.get(
'target_tasks_method',
promotion_config['target_tasks_method'].format(project=parameters['project'])
target_tasks_method = promotion_config['target_tasks_method'].format(
project=parameters['project']
)
rebuild_kinds = input.get(
'rebuild_kinds', promotion_config.get('rebuild_kinds', [])
@ -309,8 +303,10 @@ def release_promotion_action(parameters, input, task_group_id, task_id, task):
parameters['build_number'] = int(input['build_number'])
parameters['next_version'] = next_version
parameters['release_history'] = release_history
parameters['desktop_release_type'] = desktop_release_type
parameters['desktop_release_type'] = promotion_config.get('desktop_release_type', '')
parameters['release_eta'] = input.get('release_eta', '')
if input['version']:
parameters['version'] = input['version']
# make parameters read-only
parameters = Parameters(**parameters)

View File

@ -14,7 +14,7 @@ import yaml
from .generator import TaskGraphGenerator
from .create import create_tasks
from .parameters import Parameters
from .parameters import Parameters, get_version, get_app_version
from .taskgraph import TaskGraph
from .try_option_syntax import parse_message
from .actions import render_actions_json
@ -193,6 +193,8 @@ def get_decision_parameters(options):
parameters['existing_tasks'] = {}
parameters['do_not_optimize'] = []
parameters['build_number'] = 1
parameters['version'] = get_version()
parameters['app_version'] = get_app_version()
parameters['next_version'] = None
parameters['desktop_release_type'] = ''
parameters['release_eta'] = ''

View File

@ -6,6 +6,7 @@
from __future__ import absolute_import, print_function, unicode_literals
import functools
import json
import time
import yaml
@ -14,7 +15,7 @@ from datetime import datetime
from mozbuild.util import ReadOnlyDict, memoize
from mozversioncontrol import get_repository_object
from . import GECKO
from . import APP_VERSION_PATH, GECKO, VERSION_PATH
class ParameterMismatch(Exception):
@ -26,9 +27,20 @@ def get_head_ref():
return get_repository_object(GECKO).head_ref
def get_contents(path):
with open(path, "r") as fh:
contents = fh.readline().rstrip()
return contents
get_version = functools.partial(get_contents, VERSION_PATH)
get_app_version = functools.partial(get_contents, APP_VERSION_PATH)
# Please keep this list sorted and in sync with taskcluster/docs/parameters.rst
# Parameters are of the form: {name: default}
PARAMETERS = {
'app_version': get_app_version(),
'base_repository': 'https://hg.mozilla.org/mozilla-unified',
'build_date': lambda: int(time.time()),
'build_number': 1,
@ -55,6 +67,7 @@ PARAMETERS = {
'try_mode': None,
'try_options': None,
'try_task_config': None,
'version': get_version(),
}
COMM_PARAMETERS = {

View File

@ -343,10 +343,6 @@ def target_tasks_promote_firefox(full_task_graph, parameters, graph_config):
task.attributes.get('shipping_phase') == 'promote':
return True
# TODO: funsize, all but balrog submission
# TODO: bouncer sub
# TODO: recompression tasks
return [l for l, t in full_task_graph.tasks.iteritems() if filter(t)]
@ -365,11 +361,6 @@ def target_tasks_push_firefox(full_task_graph, parameters, graph_config):
if task.attributes.get('shipping_product') == 'firefox' and \
task.attributes.get('shipping_phase') == 'push':
return True
# TODO: add beetmover push-to-releases
# TODO: publish to balrog
# TODO: funsize balrog submission
# TODO: recompression push-to-releases + balrog
# TODO: checksums
return [l for l, t in full_task_graph.tasks.iteritems() if filter(t)]
@ -389,11 +380,6 @@ def target_tasks_ship_firefox(full_task_graph, parameters, graph_config):
if task.attributes.get('shipping_product') == 'firefox' and \
task.attributes.get('shipping_phase') == 'ship':
return True
# TODO: add beetmover push-to-releases
# TODO: publish to balrog
# TODO: funsize balrog submission
# TODO: recompression push-to-releases + balrog
# TODO: checksums
return [l for l, t in full_task_graph.tasks.iteritems() if filter(t)]
@ -431,11 +417,6 @@ def target_tasks_promote_devedition(full_task_graph, parameters, graph_config):
task.attributes.get('shipping_phase') == 'promote':
return True
# TODO: funsize, all but balrog submission
# TODO: binary transparency
# TODO: bouncer sub
# TODO: recompression tasks
return [l for l, t in full_task_graph.tasks.iteritems() if filter(t)]
@ -454,11 +435,6 @@ def target_tasks_push_devedition(full_task_graph, parameters, graph_config):
if task.attributes.get('shipping_product') == 'devedition' and \
task.attributes.get('shipping_phase') == 'push':
return True
# TODO: add beetmover push-to-releases
# TODO: publish to balrog
# TODO: funsize balrog submission
# TODO: recompression push-to-releases + balrog
# TODO: checksums
return [l for l, t in full_task_graph.tasks.iteritems() if filter(t)]
@ -478,11 +454,6 @@ def target_tasks_ship_devedition(full_task_graph, parameters, graph_config):
if task.attributes.get('shipping_product') == 'devedition' and \
task.attributes.get('shipping_phase') == 'ship':
return True
# TODO: add beetmover push-to-releases
# TODO: publish to balrog
# TODO: funsize balrog submission
# TODO: recompression push-to-releases + balrog
# TODO: checksums
return [l for l, t in full_task_graph.tasks.iteritems() if filter(t)]

View File

@ -22,10 +22,6 @@ import os
# constants {{{1
GECKO = os.path.realpath(os.path.join(__file__, '..', '..', '..', '..'))
VERSION_PATH = os.path.join(GECKO, "browser", "config", "version_display.txt")
APP_VERSION_PATH = os.path.join(GECKO, "browser", "config", "version.txt")
"""Map signing scope aliases to sets of projects.
Currently m-c and DevEdition on m-b use nightly signing; Beta on m-b and m-r
@ -473,12 +469,8 @@ def get_release_config(config):
if release_config['platforms'] == "[]":
del release_config['platforms']
with open(VERSION_PATH, "r") as fh:
version = fh.readline().rstrip()
release_config['version'] = version
with open(APP_VERSION_PATH, "r") as fh:
appVersion = fh.readline().rstrip()
release_config['appVersion'] = appVersion
release_config['version'] = str(config.params['version'])
release_config['appVersion'] = str(config.params['app_version'])
release_config['next_version'] = str(config.params['next_version'])
release_config['build_number'] = config.params['build_number']