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 374575 7ab155596912494146faebc0ce30b542e2b730fa
parent 374574 c688b2234591df521e868c5938d63d63135ab272
child 374576 24bea8bde57dcc65ff50b0f349134231372a9091
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmtabara, release
bug 1343585 - add task.payload.version to release beetmover tasks. r=mtabara a=release
--- 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(
@@ -565,27 +565,27 @@ def build_scriptworker_signing_payload(c
         'maxRunTime': worker['max-run-time'],
         'upstreamArtifacts':  worker['upstream-artifacts']
 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)
 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(
-# 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.
         config (dict): the task config that defines the target task method.
         ValueError: if a release graph doesn't define a valid
-        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