bug 1423081 - snap support. r=callek
authorAki Sasaki <asasaki@mozilla.com>
Tue, 05 Dec 2017 19:27:00 -0800
changeset 396361 67616e1ec2718679c7507b252770be120b033c00
parent 396360 ccf665c924ece476364e1bb8d3911b897f089e8f
child 396362 b368b9518bd430ce6163181c61e4a6be3f7f2963
push id56975
push userdluca@mozilla.com
push dateThu, 14 Dec 2017 09:59:07 +0000
treeherderautoland@16bcfaad13e1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscallek
bugs1423081
milestone59.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 1423081 - snap support. r=callek MozReview-Commit-ID: BPZrBDJxLYu
taskcluster/ci/config.yml
taskcluster/ci/release-snap/kind.yml
taskcluster/docker/firefox-snap/runme.sh
taskcluster/taskgraph/transforms/release_snap.py
--- a/taskcluster/ci/config.yml
+++ b/taskcluster/ci/config.yml
@@ -49,16 +49,17 @@ treeherder:
         'TW32': 'Toolchain builds for Windows 32-bits'
         'TW64': 'Toolchain builds for Windows 64-bits'
         'Searchfox': 'Searchfox builds'
         'SM-tc': 'Spidermonkey builds'
         'pub': 'APK publishing'
         'p': 'Partial generation'
         'ps': 'Partials signing'
         'Rel': 'Release promotion'
+        'Snap': 'Snap image generation'
 
 try:
     # We have a few platforms for which we want to do some "extra" builds, or at
     # least build-ish things.  Sort of.  Anyway, these other things are implemented
     # as different "platforms".  These do *not* automatically ride along with "-p
     # all"
     ridealong-builds:
         'android-api-16':
new file mode 100644
--- /dev/null
+++ b/taskcluster/ci/release-snap/kind.yml
@@ -0,0 +1,117 @@
+# 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_snap:transforms
+   - taskgraph.transforms.task:transforms
+
+kind-dependencies:
+   - post-beetmover-dummy
+
+job-defaults:
+   description: Generates snap image
+   run-on-projects: []  # to make sure this never runs as part of CI
+   shipping-phase: promote
+   scopes:
+      by-project:
+         mozilla-beta: ["secrets:get:project/releng/snapcraft/firefox/edge"]
+         default: []
+   treeherder:
+      platform: linux64/opt
+      kind: build
+      tier: 3
+   index:
+      type: release
+   routes:
+      - index.releases.v1.{branch}.{revision}.{product}.{underscore_version}.build{build_number}.snap
+      - index.releases.v1.{branch}.latest.{product}.latest.snap
+   worker-type: aws-provisioner-v1/gecko-{level}-b-linux
+   worker:
+      implementation: docker-worker
+      os: linux
+      max-run-time: 7200
+      docker-image: mozillareleases/firefox-snapcraft@sha256:107cc7a89d45ce6df30f44fe0dfd0b375b3ab443b75e92efc77c4f7bc5da8717
+      artifacts:
+         - name: public/build
+           type: directory
+           path: /home/worker/artifacts/
+      command:
+         - /bin/bash
+         - -cx
+         - >
+           apt-get update &&
+           apt-get dist-upgrade -y &&
+           curl -o scripts.tar.bz2 {config_params[head_repository]}/archive/{config_params[head_rev]}.tar.bz2/taskcluster/docker/firefox-snap/ &&
+           mkdir scripts &&
+           tar xvfj scripts.tar.bz2 -C scripts --strip-components 4 &&
+           cd scripts &&
+           ./runme.sh
+      env:
+         VERSION: "{release_config[version]}"
+         BUILD_NUMBER: "{release_config[build_number]}"
+         PUSH_TO_CHANNEL:
+            by-project:
+               mozilla-beta: "edge"
+               default: ""
+         CANDIDATES_DIR:
+            by-project:
+               maple:
+                  https://net-mozaws-stage-delivery-firefox.s3.amazonaws.com/pub/{task[shipping-product]}/candidates
+               default:
+                  https://net-mozaws-prod-delivery-firefox.s3.amazonaws.com/pub/{task[shipping-product]}/candidates
+         LC_ALL: C.UTF-8
+         LANG: C.UTF-8
+      taskcluster-proxy: true
+   notifications:
+      completed:
+         subject: "COMPLETED: [{task[shipping-product]} {release_config[version]} build{release_config[build_number]}/{config[params][project]}] {task_def[metadata][name]} task"
+         message: "COMPLETED: [{task[shipping-product]} {release_config[version]} build{release_config[build_number]}/{config[params][project]}] {task_def[metadata][name]} task"
+         plugins:
+            by-project:
+               mozilla-beta: ["log_collect"]
+               mozilla-release: ["log_collect"]
+               default: []
+
+      failed:
+         subject: "FAILED: [{task[shipping-product]} {release_config[version]} build{release_config[build_number]}/{config[params][project]}] {task_def[metadata][name]} task"
+         message: "FAILED: [{task[shipping-product]} {release_config[version]} build{release_config[build_number]}/{config[params][project]}] {task_def[metadata][name]} task"
+         plugins:
+            by-project:
+               mozilla-beta: ["log_collect", "ses"]
+               mozilla-release: ["log_collect", "ses"]
+               default: ["ses"]
+         emails:
+            by-project:
+               mozilla-beta: ["release-automation-notifications@mozilla.com"]
+               mozilla-release: ["release-automation-notifications@mozilla.com"]
+               try: ["{task_def[metadata][owner]}"]
+               maple: ["release+tcstaging@mozilla.com"]
+               default: []
+
+      exception:
+         subject: "EXCEPTION: [{task[shipping-product]} {release_config[version]} build{release_config[build_number]}/{config[params][project]}] {task_def[metadata][name]} task"
+         message: "EXCEPTION: [{task[shipping-product]} {release_config[version]} build{release_config[build_number]}/{config[params][project]}] {task_def[metadata][name]} task"
+         plugins:
+            by-project:
+               mozilla-beta: ["log_collect", "ses"]
+               mozilla-release: ["log_collect", "ses"]
+               default: ["ses"]
+         emails:
+            by-project:
+               mozilla-beta: ["release-automation-notifications@mozilla.com"]
+               mozilla-release: ["release-automation-notifications@mozilla.com"]
+               try: ["{task_def[metadata][owner]}"]
+               maple: ["release+tcstaging@mozilla.com"]
+               default: []
+
+jobs:
+   firefox:
+      shipping-product: firefox
+      treeherder:
+         symbol: Snap(BF)
+      index:
+         product: firefox
--- a/taskcluster/docker/firefox-snap/runme.sh
+++ b/taskcluster/docker/firefox-snap/runme.sh
@@ -74,15 +74,15 @@ cat $TARGET.checksums
 cat signing_manifest.json
 
 
 # Upload Beta snaps to Ubuntu Snap Store (No channel)
 # TODO: Add a release channel once ready for broader audience
 # TODO: Don't filter out non-beta releases
 # TODO: Parametrize channel depending on beta vs release
 # TODO: Make this part an independent task
-if [[ $VERSION =~ ^[0-9]+\.0b[0-9]+$ ]]; then
+if [ "$PUSH_TO_CHANNEL" != "" ]; then
   echo "Beta version detected. Uploading to Ubuntu Store (no channel)..."
-  bash "$SCRIPT_DIRECTORY/fetch_macaroons.sh" 'http://taskcluster/secrets/v1/secret/project/releng/snapcraft/firefox/edge'
+  bash "$SCRIPT_DIRECTORY/fetch_macaroons.sh" 'http://taskcluster/secrets/v1/secret/project/releng/snapcraft/firefox/$PUSH_TO_CHANNEL'
   snapcraft push "$TARGET_FULL_PATH"
 else
   echo "Non-beta version detected. Nothing else to do."
 fi
new file mode 100644
--- /dev/null
+++ b/taskcluster/taskgraph/transforms/release_snap.py
@@ -0,0 +1,38 @@
+# 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/.
+
+from __future__ import absolute_import, print_function, unicode_literals
+
+from taskgraph.transforms.base import TransformSequence
+from taskgraph.util.scriptworker import get_release_config
+from taskgraph.util.schema import resolve_keyed_by
+
+
+transforms = TransformSequence()
+
+
+@transforms.add
+def format(config, tasks):
+    """ Apply format substitution to worker.env and worker.command.
+    """
+
+    format_params = {
+        'release_config': get_release_config(config),
+        'config_params': config.params,
+    }
+
+    for task in tasks:
+        format_params['task'] = task
+
+        command = task.get('worker', {}).get('command', [])
+        task['worker']['command'] = [x.format(**format_params) for x in command]
+
+        env = task.get('worker', {}).get('env', {})
+        for k in env.keys():
+            resolve_keyed_by(env, k, 'snap envs', project=config.params['project'])
+            task['worker']['env'][k] = env[k].format(**format_params)
+
+        resolve_keyed_by(task, 'scopes', 'snap scopes', project=config.params['project'])
+
+        yield task