Bug 1745203 - Add release-msix-push task, run on beta only; r=aki
authorGeoff Brown <gbrown@mozilla.com>
Mon, 24 Jan 2022 15:02:56 +0000
changeset 605324 b236557131cd94065dab230820fc7596fcce94db
parent 605323 b06de68f39c558cf529173250864b49ff2fbf9ae
child 605325 d930203c929520a10057ab08f6b80e04a66a7f94
push id39190
push usermlaza@mozilla.com
push dateMon, 24 Jan 2022 21:42:29 +0000
treeherdermozilla-central@9b23d1bb84b2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaki
bugs1745203
milestone98.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 1745203 - Add release-msix-push task, run on beta only; r=aki Add taskcluster config for publishing msix archives on the Microsoft Store. Differential Revision: https://phabricator.services.mozilla.com/D136539
taskcluster/ci/release-msix-push/kind.yml
taskcluster/docs/kinds.rst
taskcluster/gecko_taskgraph/transforms/release_msix_push.py
taskcluster/gecko_taskgraph/transforms/task.py
new file mode 100644
--- /dev/null
+++ b/taskcluster/ci/release-msix-push/kind.yml
@@ -0,0 +1,41 @@
+# 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: gecko_taskgraph.loader.transform:loader
+
+transforms:
+    - gecko_taskgraph.transforms.release:run_on_releases
+    - gecko_taskgraph.transforms.release_deps:transforms
+    - gecko_taskgraph.transforms.release_msix_push:transforms
+    - gecko_taskgraph.transforms.task:transforms
+
+kind-dependencies:
+    - repackage-shippable-l10n-msix
+
+job-defaults:
+    description: Pushes msix archives to Microsoft Store
+    run-on-projects: []  # to make sure this never runs as part of CI
+    run-on-releases: [beta]
+    shipping-phase: ship
+    treeherder:
+        platform: win32-shippable/opt
+        kind: build
+        tier: 2
+    worker-type:
+        by-release-level:
+            production: scriptworker-k8s/gecko-3-pushmsix
+            staging: scriptworker-k8s/gecko-1-pushmsix
+    worker:
+        implementation: push-msix
+        channel:
+            by-release-type:
+                beta: beta
+                release: release
+                default: mock
+
+jobs:
+    firefox:
+        shipping-product: firefox
+        treeherder:
+            symbol: MSIX(push)
--- a/taskcluster/docs/kinds.rst
+++ b/taskcluster/docs/kinds.rst
@@ -560,16 +560,20 @@ repackage-signing-msix
 ----------------------
 Repackage-signing-msix takes Windows MSIX packages produced in ```repackage-msix``` and signs them.
 
 repackage-signing-shippable-l10n-msix
 -------------------------------------
 Repackage-signing-shippable-l10n-msix takes Windows MSIX packages produced in
 ```repackage-signing-shippable-l10n-msix``` and signs them.
 
+release-msix-push
+--------------------
+Pushes msix repackage to the Microsoft Store.
+
 repo-update
 -----------
 Repo-Update tasks are tasks that perform some action on the project repo itself,
 in order to update its state in some way.
 
 partials
 --------
 Partials takes the complete.mar files produced in previous tasks and generates partial
new file mode 100644
--- /dev/null
+++ b/taskcluster/gecko_taskgraph/transforms/release_msix_push.py
@@ -0,0 +1,78 @@
+# 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/.
+"""
+Transform the release-msix-push kind into an actual task description.
+"""
+
+
+from gecko_taskgraph.transforms.base import TransformSequence
+from gecko_taskgraph.transforms.task import task_description_schema
+from gecko_taskgraph.util.attributes import release_level
+from gecko_taskgraph.util.schema import optionally_keyed_by, resolve_keyed_by, Schema
+from gecko_taskgraph.util.scriptworker import add_scope_prefix
+
+from voluptuous import Optional, Required
+
+push_msix_description_schema = Schema(
+    {
+        Required("name"): str,
+        Required("job-from"): task_description_schema["job-from"],
+        Required("dependencies"): task_description_schema["dependencies"],
+        Required("description"): task_description_schema["description"],
+        Required("treeherder"): task_description_schema["treeherder"],
+        Required("run-on-projects"): task_description_schema["run-on-projects"],
+        Required("worker-type"): optionally_keyed_by("release-level", str),
+        Required("worker"): object,
+        Optional("scopes"): [str],
+        Required("shipping-phase"): task_description_schema["shipping-phase"],
+        Required("shipping-product"): task_description_schema["shipping-product"],
+        Optional("extra"): task_description_schema["extra"],
+        Optional("attributes"): task_description_schema["attributes"],
+    }
+)
+
+transforms = TransformSequence()
+transforms.add_validate(push_msix_description_schema)
+
+
+@transforms.add
+def make_task_description(config, jobs):
+    for job in jobs:
+
+        job["worker"]["upstream-artifacts"] = generate_upstream_artifacts(
+            job["dependencies"]
+        )
+
+        resolve_keyed_by(
+            job,
+            "worker.channel",
+            item_name=job["name"],
+            **{"release-type": config.params["release_type"]},
+        )
+        resolve_keyed_by(
+            job,
+            "worker-type",
+            item_name=job["name"],
+            **{"release-level": release_level(config.params["project"])},
+        )
+        if release_level(config.params["project"]) == "production":
+            job.setdefault("scopes", []).append(
+                add_scope_prefix(
+                    config,
+                    "microsoftstore:{}".format(job["worker"]["channel"]),
+                )
+            )
+
+        yield job
+
+
+def generate_upstream_artifacts(dependencies):
+    return [
+        {
+            "taskId": {"task-reference": f"<{task_kind}>"},
+            "taskType": "build",
+            "paths": ["public/build/target.store.msix"],
+        }
+        for task_kind in dependencies.keys()
+    ]
--- a/taskcluster/gecko_taskgraph/transforms/task.py
+++ b/taskcluster/gecko_taskgraph/transforms/task.py
@@ -1199,16 +1199,38 @@ def build_push_flatpak_payload(config, t
 
     task_def["payload"] = {
         "channel": worker["channel"],
         "upstreamArtifacts": worker["upstream-artifacts"],
     }
 
 
 @payload_builder(
+    "push-msix",
+    schema={
+        Required("channel"): str,
+        Required("upstream-artifacts"): [
+            {
+                Required("taskId"): taskref_or_string,
+                Required("taskType"): str,
+                Required("paths"): [str],
+            }
+        ],
+    },
+)
+def build_push_msix_payload(config, task, task_def):
+    worker = task["worker"]
+
+    task_def["payload"] = {
+        "channel": worker["channel"],
+        "upstreamArtifacts": worker["upstream-artifacts"],
+    }
+
+
+@payload_builder(
     "shipit-shipped",
     schema={
         Required("release-name"): str,
     },
 )
 def build_ship_it_shipped_payload(config, task, task_def):
     worker = task["worker"]