Bug 1431397 - Pass release_eta down from action task input r=bhearsum a=release
authorJohan Lorenzo <jlorenzo@mozilla.com>
Thu, 18 Jan 2018 15:10:53 +0100
changeset 454511 290a7ceb3d5ba5686cbdb50e0d649fdcf3d39605
parent 454510 4aedb56b41c7fbc4af895f829f26edb2b9d796d2
child 454512 4320ff21043330b71defec7a93448c4bf25f339e
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbhearsum, release
bugs1431397
milestone59.0
Bug 1431397 - Pass release_eta down from action task input r=bhearsum a=release This commit includes part2: fix release_eta when it's None p=aki r=jlorenzo MozReview-Commit-ID: Ggybpiv5XQo
taskcluster/ci/release-balrog-publishing/kind.yml
taskcluster/docs/parameters.rst
taskcluster/taskgraph/actions/release_promotion.py
taskcluster/taskgraph/decision.py
taskcluster/taskgraph/parameters.py
taskcluster/taskgraph/transforms/job/buildbot.py
taskcluster/taskgraph/transforms/release_balrog_publishing.py
taskcluster/taskgraph/transforms/task.py
taskcluster/taskgraph/util/schema.py
--- a/taskcluster/ci/release-balrog-publishing/kind.yml
+++ b/taskcluster/ci/release-balrog-publishing/kind.yml
@@ -1,16 +1,17 @@
 # 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/.
 
 loader: taskgraph.loader.transform:loader
 
 transforms:
    - taskgraph.transforms.release_deps:transforms
+   - taskgraph.transforms.release_balrog_publishing:transforms
    - taskgraph.transforms.job:transforms
    - taskgraph.transforms.task:transforms
 
 kind-dependencies:
    - release-uptake-monitoring
 
 job-defaults:
    description: Schedule publishing in balrog
--- a/taskcluster/docs/parameters.rst
+++ b/taskcluster/docs/parameters.rst
@@ -146,16 +146,19 @@ Release Promotion
 
 ``next_version``
    Specify the next version for version bump tasks.
 
 ``desktop_release_type``
    The type of desktop release being promoted. One of "beta", "devedition", "esr", "rc",
    or "release".
 
+ ``release_eta``
+   The time and date when a release is scheduled to live. This value is passed to Balrog.
+
 Comm Push Information
 ---------------------
 
 These parameters correspond to the repository and revision of the comm-central
 repository to checkout. Their meaning is the same as the corresponding
 parameters for the gecko repository above. They are optional, but if any of
 them are specified, they must all be specified.
 
--- a/taskcluster/taskgraph/actions/release_promotion.py
+++ b/taskcluster/taskgraph/actions/release_promotion.py
@@ -206,16 +206,21 @@ def is_release_promotion_available(param
                 },
                 'default': [],
             },
 
             'desktop_release_type': {
                 'type': 'string',
                 'default': '',
             },
+
+            'release_eta': {
+                'type': 'string',
+                'default': '',
+            },
         },
         "required": ['release_promotion_flavor', 'build_number'],
     }
 )
 def release_promotion_action(parameters, input, task_group_id, task_id, task):
     release_promotion_flavor = input['release_promotion_flavor']
     release_history = {}
     desktop_release_type = None
@@ -300,13 +305,14 @@ def release_promotion_action(parameters,
         combined_full_task_graph, previous_graph_ids, rebuild_kinds
     )
     parameters['do_not_optimize'] = do_not_optimize
     parameters['target_tasks_method'] = target_tasks_method
     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['release_eta'] = input.get('release_eta', '')
 
     # make parameters read-only
     parameters = Parameters(**parameters)
 
     taskgraph_decision({}, parameters=parameters)
--- a/taskcluster/taskgraph/decision.py
+++ b/taskcluster/taskgraph/decision.py
@@ -190,16 +190,17 @@ def get_decision_parameters(options):
         'check_servo',
         'target_tasks_method',
     ]
     parameters['existing_tasks'] = {}
     parameters['do_not_optimize'] = []
     parameters['build_number'] = 1
     parameters['next_version'] = None
     parameters['desktop_release_type'] = ''
+    parameters['release_eta'] = ''
 
     # owner must be an email, but sometimes (e.g., for ffxbld) it is not, in which
     # case, fake it
     if '@' not in parameters['owner']:
         parameters['owner'] += '@noreply.mozilla.org'
 
     # use the pushdate as build_date if given, else use current time
     parameters['build_date'] = parameters['pushdate'] or int(time.time())
--- a/taskcluster/taskgraph/parameters.py
+++ b/taskcluster/taskgraph/parameters.py
@@ -44,16 +44,17 @@ PARAMETERS = {
     'message': '',
     'moz_build_date': lambda: datetime.now().strftime("%Y%m%d%H%M%S"),
     'next_version': None,
     'optimize_target_tasks': True,
     'owner': 'nobody@mozilla.com',
     'project': 'mozilla-central',
     'pushdate': lambda: int(time.time()),
     'pushlog_id': '0',
+    'release_eta': '',
     'release_history': {},
     'target_tasks_method': 'default',
     'try_mode': None,
     'try_options': None,
     'try_task_config': None,
 }
 
 COMM_PARAMETERS = {
--- a/taskcluster/taskgraph/transforms/job/buildbot.py
+++ b/taskcluster/taskgraph/transforms/job/buildbot.py
@@ -26,16 +26,18 @@ buildbot_run_schema = Schema({
     Required('buildername'): basestring,
 
     # the product to use
     Required('product'): Any('firefox', 'mobile', 'fennec', 'devedition', 'thunderbird'),
 
     Optional('channels'): optionally_keyed_by('project', basestring),
 
     Optional('release-promotion'): bool,
+
+    Optional('release-eta'): basestring,
 })
 
 
 def _get_balrog_api_root(branch):
     if branch in ('mozilla-beta', 'mozilla-release') or branch.startswith('mozilla-esr'):
         return 'https://aus4-admin.mozilla.org/api'
     else:
         return 'https://balrog-admin.stage.mozaws.net/api'
@@ -57,16 +59,20 @@ def bb_release_worker(config, worker, ru
 
     if 'channels' in run:
         release_props['channels'] = run['channels']
         resolve_keyed_by(release_props, 'channels', 'channels', **config.params)
 
     if product in ('devedition', 'firefox'):
         release_props['balrog_api_root'] = _get_balrog_api_root(branch)
 
+    if run.get('release-eta'):
+        # TODO Use same property name when we move away from BuildBot
+        release_props['schedule_at'] = run['release-eta']
+
     worker['properties'].update(release_props)
     # Setting script_repo_revision to the gecko revision doesn't work for
     # jobs that clone build/tools or other repos instead of gecko.
     if 'script_repo_revision' not in worker['properties']:
         worker['properties']['script_repo_revision'] = revision
 
 
 def bb_ci_worker(config, worker):
new file mode 100644
--- /dev/null
+++ b/taskcluster/taskgraph/transforms/release_balrog_publishing.py
@@ -0,0 +1,21 @@
+# 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/.
+"""
+Add from parameters.yml into Balrog publishing tasks.
+"""
+
+from __future__ import absolute_import, print_function, unicode_literals
+
+from taskgraph.transforms.base import TransformSequence
+
+transforms = TransformSequence()
+
+
+@transforms.add
+def add_release_eta(config, jobs):
+    for job in jobs:
+        if config.params['release_eta']:
+            job['run']['release-eta'] = config.params['release_eta']
+
+        yield job
--- a/taskcluster/taskgraph/transforms/task.py
+++ b/taskcluster/taskgraph/transforms/task.py
@@ -444,16 +444,17 @@ task_description_schema = Schema({
             Optional('project'): basestring,
         },
         Required('properties'): {
             'product': basestring,
             Optional('build_number'): int,
             Optional('release_promotion'): bool,
             Optional('generate_bz2_blob'): bool,
             Optional('tuxedo_server_url'): optionally_keyed_by('project', basestring),
+            Optional('release_eta'): basestring,
             Extra: taskref_or_string,  # additional properties are allowed
         },
     }, {
         Required('implementation'): 'native-engine',
         Required('os'): Any('macosx', 'linux'),
 
         # A link for an executable to download
         Optional('context'): basestring,
--- a/taskcluster/taskgraph/util/schema.py
+++ b/taskcluster/taskgraph/util/schema.py
@@ -146,16 +146,17 @@ def resolve_keyed_by(item, field, item_n
 WHITELISTED_SCHEMA_IDENTIFIERS = [
     # upstream-artifacts are handed directly to scriptWorker, which expects interCaps
     lambda path: "[u'upstream-artifacts']" in path,
     # bbb release promotion properties
     lambda path: path.endswith("[u'build_number']"),
     lambda path: path.endswith("[u'tuxedo_server_url']"),
     lambda path: path.endswith("[u'release_promotion']"),
     lambda path: path.endswith("[u'generate_bz2_blob']"),
+    lambda path: path.endswith("[u'release_eta']"),
 ]
 
 
 def check_schema(schema):
     identifier_re = re.compile('^[a-z][a-z0-9-]*$')
 
     def whitelisted(path):
         return any(f(path) for f in WHITELISTED_SCHEMA_IDENTIFIERS)