bug 1343585 - add task.payload.version to release beetmover tasks. r=mtabara a=release
authorAki Sasaki <asasaki@mozilla.com>
Wed, 01 Mar 2017 17:49:57 -0800
changeset 345393 7ab155596912494146faebc0ce30b542e2b730fa
parent 345392 c688b2234591df521e868c5938d63d63135ab272
child 345394 24bea8bde57dcc65ff50b0f349134231372a9091
push id87591
push userasasaki@mozilla.com
push dateThu, 02 Mar 2017 01:50:27 +0000
treeherdermozilla-inbound@7ab155596912 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmtabara, release
bugs1343585
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1343585 - add task.payload.version to release beetmover tasks. r=mtabara a=release
taskcluster/taskgraph/transforms/task.py
taskcluster/taskgraph/util/scriptworker.py
--- a/taskcluster/taskgraph/transforms/task.py
+++ b/taskcluster/taskgraph/transforms/task.py
@@ -11,17 +11,17 @@ complexities of worker implementations, 
 from __future__ import absolute_import, print_function, unicode_literals
 
 import json
 import time
 
 from taskgraph.util.treeherder import split_symbol
 from taskgraph.transforms.base import TransformSequence
 from taskgraph.util.schema import validate_schema
-from taskgraph.util.scriptworker import get_release_build_number
+from taskgraph.util.scriptworker import get_release_config
 from voluptuous import Schema, Any, Required, Optional, Extra
 
 from .gecko_v2_whitelist import JOB_NAME_WHITELIST, JOB_NAME_WHITELIST_ERROR
 
 
 # shortcut for a string where task references are allowed
 taskref_or_string = Any(
     basestring,
@@ -565,27 +565,27 @@ def build_scriptworker_signing_payload(c
         'maxRunTime': worker['max-run-time'],
         'upstreamArtifacts':  worker['upstream-artifacts']
     }
 
 
 @payload_builder('beetmover')
 def build_beetmover_payload(config, task, task_def):
     worker = task['worker']
-    build_number = get_release_build_number(config)
+    release_config = get_release_config(config)
 
     task_def['payload'] = {
         'maxRunTime': worker['max-run-time'],
         'upload_date': config.params['build_date'],
         'upstreamArtifacts':  worker['upstream-artifacts']
     }
     if worker.get('locale'):
         task_def['payload']['locale'] = worker['locale']
-    if build_number:
-        task_def['payload']['build_number'] = build_number
+    if release_config:
+        task_def['payload'].update(release_config)
 
 
 @payload_builder('balrog')
 def build_balrog_payload(config, task, task_def):
     worker = task['worker']
 
     task_def['payload'] = {
         'upstreamArtifacts':  worker['upstream-artifacts']
--- a/taskcluster/taskgraph/util/scriptworker.py
+++ b/taskcluster/taskgraph/util/scriptworker.py
@@ -13,16 +13,20 @@ In the future, we may adjust scopes by o
 scopes for `push-to-candidates` rather than `push-to-releases`, even if both
 happen on mozilla-beta and mozilla-release.
 """
 from __future__ import absolute_import, print_function, unicode_literals
 import functools
 import os
 
 
+# constants {{{1
+GECKO = os.path.realpath(os.path.join(__file__, '..', '..', '..', '..'))
+VERSION_PATH = os.path.join(GECKO, "browser", "config", "version_display.txt")
+
 """Map signing scope aliases to sets of projects.
 
 Currently m-c and m-a use nightly signing; m-b and m-r use release signing.
 We will need to add esr support at some point. Eventually we want to add
 nuance so certain m-b and m-r tasks use dep or nightly signing, and we only
 release sign when we have a signed-off set of candidate builds.  This current
 approach works for now, though.
 
@@ -228,29 +232,35 @@ get_beetmover_action_scope = functools.p
 
 get_balrog_server_scope = functools.partial(
     get_scope_from_project,
     BALROG_SCOPE_ALIAS_TO_PROJECT,
     BALROG_SERVER_SCOPES
 )
 
 
-# build_number {{{1
-def get_release_build_number(config):
-    """Get the build number for a release task.
+# release_config {{{1
+def get_release_config(config):
+    """Get the build number and version for a release task.
 
     Currently only applies to beetmover tasks.
 
     Args:
         config (dict): the task config that defines the target task method.
 
     Raises:
         ValueError: if a release graph doesn't define a valid
             `os.environ['BUILD_NUMBER']`
 
     Returns:
-        int: the build number, if applicable.
+        dict: containing both `build_number` and `version`.  This can be used to
+            update `task.payload`.
     """
+    release_config = {}
     if config.params['target_tasks_method'] in BEETMOVER_RELEASE_TARGET_TASKS:
         build_number = str(os.environ.get("BUILD_NUMBER", ""))
         if not build_number.isdigit():
             raise ValueError("Release graphs must specify `BUILD_NUMBER` in the environment!")
-        return int(build_number)
+        release_config['build_number'] = int(build_number)
+        with open(VERSION_PATH, "r") as fh:
+            version = fh.readline().rstrip()
+        release_config['version'] = version
+    return release_config