Bug 1475101 - add mark-as-started task. r=rail a=release
authorMihai Tabara <mtabara@mozilla.com>
Wed, 12 Sep 2018 08:58:52 -0400
changeset 500481 e87d7028568e721e8d297ce62f9622e74d29bb37
parent 500480 379d79841c5d439654d77f264f7c9d730863059e
child 500482 bb430eaf5521aa8ab233a45b585ff9e5dfecf4c9
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrail, release
bugs1475101
milestone64.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 1475101 - add mark-as-started task. r=rail a=release
taskcluster/ci/release-mark-as-started/kind.yml
taskcluster/docs/kinds.rst
taskcluster/taskgraph/transforms/release_mark_as_started.py
taskcluster/taskgraph/transforms/task.py
taskcluster/taskgraph/util/scriptworker.py
new file mode 100644
--- /dev/null
+++ b/taskcluster/ci/release-mark-as-started/kind.yml
@@ -0,0 +1,43 @@
+# 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_mark_as_started:transforms
+   - taskgraph.transforms.task:transforms
+
+job-defaults:
+   description: mark release as started in Ship-It v1
+   worker-type:
+      by-project:
+         mozilla-beta: scriptworker-prov-v1/shipit-v1
+         default: scriptworker-prov-v1/shipit-dev
+   worker:
+      implementation: shipit-started
+   scopes:
+      by-project:
+         mozilla-beta:
+            - project:releng:ship-it:server:production
+            - project:releng:ship-it:action:mark-as-started
+         default:
+            - project:releng:ship-it:server:staging
+            - project:releng:ship-it:action:mark-as-started
+   run-on-projects: []
+   shipping-phase: promote
+   locales-file: browser/locales/l10n-changesets.json
+
+jobs:
+   fennec:
+      name: release-fennec_mark_as_started
+      shipping-product: fennec
+      locales-file: mobile/locales/l10n-changesets.json
+
+   firefox:
+      name: release-firefox_mark_as_started
+      shipping-product: firefox
+
+   devedition:
+      name: release-devedition_mark_as_started
+      shipping-product: devedition
--- a/taskcluster/docs/kinds.rst
+++ b/taskcluster/docs/kinds.rst
@@ -290,16 +290,20 @@ Notify when a release has been promoted.
 release-bouncer-sub
 -------------------
 Submits bouncer updates for releases.
 
 release-mark-as-shipped
 -----------------------
 Marks releases as shipped in Ship-It v1
 
+release-mark-as-started
+-----------------------
+Marks releases as started in Ship-It v1
+
 release-bouncer-aliases
 -----------------------
 Update Bouncer's (download.mozilla.org) "latest" aliases.
 
 cron-bouncer-check
 ------------------
 Checks Bouncer (download.mozilla.org) uptake.
 
new file mode 100644
--- /dev/null
+++ b/taskcluster/taskgraph/transforms/release_mark_as_started.py
@@ -0,0 +1,57 @@
+
+# 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
+
+import json
+
+from taskgraph.transforms.base import TransformSequence
+from taskgraph.transforms.l10n import parse_locales_file
+from taskgraph.util.schema import resolve_keyed_by
+from taskgraph.util.scriptworker import get_release_config
+
+transforms = TransformSequence()
+
+
+@transforms.add
+def make_task_description(config, jobs):
+    release_config = get_release_config(config)
+    for job in jobs:
+        resolve_keyed_by(
+            job, 'worker-type', item_name=job['name'], project=config.params['project']
+        )
+        resolve_keyed_by(
+            job, 'scopes', item_name=job['name'], project=config.params['project']
+        )
+
+        job['worker']['release-name'] = '{product}-{version}-build{build_number}'.format(
+            product=job['shipping-product'].capitalize(),
+            version=release_config['version'],
+            build_number=release_config['build_number']
+        )
+        job['worker']['product'] = job['shipping-product']
+        branch = config.params['head_repository'].split('https://hg.mozilla.org/')[1]
+        job['worker']['branch'] = branch
+
+        # locales files has different structure between mobile and desktop
+        locales_file = job['locales-file']
+        all_locales = {}
+
+        if job['shipping-product'] == 'fennec':
+            with open(locales_file, mode='r') as f:
+                all_locales = json.dumps(json.load(f))
+        else:
+            all_locales = "\n".join([
+                "{} {}".format(locale, revision)
+                for locale, revision in sorted(parse_locales_file(job['locales-file']).items())
+            ])
+
+        job['worker']['locales'] = all_locales
+        del job['locales-file']
+
+        yield job
--- a/taskcluster/taskgraph/transforms/task.py
+++ b/taskcluster/taskgraph/transforms/task.py
@@ -612,16 +612,22 @@ task_description_schema = Schema({
             Required('taskId'): taskref_or_string,
             Required('taskType'): basestring,
             Required('paths'): [basestring],
         }],
     }, {
         Required('implementation'): 'shipit-shipped',
         Required('release-name'): basestring,
     }, {
+        Required('implementation'): 'shipit-started',
+        Required('release-name'): basestring,
+        Required('product'): basestring,
+        Required('branch'): basestring,
+        Required('locales'): basestring,
+    }, {
         Required('implementation'): 'treescript',
         Required('tags'): [Any('buildN', 'release', None)],
         Required('bump'): bool,
         Optional('bump-files'): [basestring],
         Optional('repo-param-prefix'): basestring,
         Optional('dontbuild'): bool,
         Required('force-dry-run', default=True): bool,
         Required('push', default=False): bool
@@ -1246,16 +1252,33 @@ def build_push_snap_payload(config, task
 def build_ship_it_shipped_payload(config, task, task_def):
     worker = task['worker']
 
     task_def['payload'] = {
         'release_name': worker['release-name']
     }
 
 
+@payload_builder('shipit-started')
+def build_ship_it_started_payload(config, task, task_def):
+    worker = task['worker']
+    release_config = get_release_config(config)
+
+    task_def['payload'] = {
+        'release_name': worker['release-name'],
+        'product': worker['product'],
+        'version': release_config['version'],
+        'build_number': release_config['build_number'],
+        'branch': worker['branch'],
+        'revision': get_branch_rev(config),
+        'partials': release_config.get('partial_versions', ""),
+        'l10n_changesets': worker['locales'],
+    }
+
+
 @payload_builder('sign-and-push-addons')
 def build_sign_and_push_addons_payload(config, task, task_def):
     worker = task['worker']
 
     task_def['payload'] = {
         'channel': worker['channel'],
         'upstreamArtifacts': worker['upstream-artifacts'],
     }
--- a/taskcluster/taskgraph/util/scriptworker.py
+++ b/taskcluster/taskgraph/util/scriptworker.py
@@ -332,16 +332,17 @@ def get_release_config(config):
 
     partial_updates = os.environ.get("PARTIAL_UPDATES", "")
     if partial_updates != "" and config.kind in ('release-bouncer-sub',
                                                  'release-bouncer-check',
                                                  'release-update-verify-config',
                                                  'release-secondary-update-verify-config',
                                                  'release-balrog-submit-toplevel',
                                                  'release-secondary-balrog-submit-toplevel',
+                                                 'release-mark-as-started'
                                                  ):
         partial_updates = json.loads(partial_updates)
         release_config['partial_versions'] = ', '.join([
             '{}build{}'.format(v, info['buildNumber'])
             for v, info in partial_updates.items()
         ])
         if release_config['partial_versions'] == "{}":
             del release_config['partial_versions']