Bug 1297519 - Generate multilocale Firefox snaps r=Callek, a=release DONTBUILD
authorRail Aliiev <rail@mozilla.com>
Sat, 17 Sep 2016 10:53:41 -0400
changeset 348214 79adb317eca45959afcdb2eb5291a5fbd569b598
parent 348213 6f821fb94ace0320f05f06378ab90d87706f40d5
child 348215 7d67edce5ec0e4b137bee04c5931605f1eb70027
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersCallek, release
bugs1297519
milestone50.0a2
Bug 1297519 - Generate multilocale Firefox snaps r=Callek, a=release DONTBUILD MozReview-Commit-ID: AKkUK91s0Qo
release/docker/firefox-snap/Dockerfile
release/docker/firefox-snap/Makefile
release/docker/firefox-snap/distribution.ini
release/docker/firefox-snap/runme.sh
release/docker/firefox-snap/snapcraft.yaml.in
testing/mozharness/configs/beetmover/snap.yml.tmpl
testing/mozharness/configs/beetmover/snap_checksums.yml.tmpl
new file mode 100644
--- /dev/null
+++ b/release/docker/firefox-snap/Dockerfile
@@ -0,0 +1,3 @@
+FROM ubuntu:16.04
+
+RUN apt-get update && apt-get install -qy snapcraft bzip2 curl && apt-get clean
new file mode 100644
--- /dev/null
+++ b/release/docker/firefox-snap/Makefile
@@ -0,0 +1,12 @@
+DOCKERIO_USERNAME =$(error DOCKERIO_USERNAME should be set)
+IMAGE_NAME = firefox-snapcraft
+FULL_IMAGE_NAME = $(DOCKERIO_USERNAME)/$(IMAGE_NAME)
+
+build:
+	docker build -t $(FULL_IMAGE_NAME) --no-cache --rm .
+
+push:
+	docker push $(FULL_IMAGE_NAME):latest
+
+pull:
+	docker pull $(FULL_IMAGE_NAME):latest
new file mode 100644
--- /dev/null
+++ b/release/docker/firefox-snap/distribution.ini
@@ -0,0 +1,9 @@
+[Global]
+id=mozilla-snap
+version=1.0
+about=Mozilla Firefox Snap
+
+[Preferences]
+app.update.enabled=false
+intl.locale.matchOS=true
+browser.shell.checkDefaultBrowser=false
new file mode 100755
--- /dev/null
+++ b/release/docker/firefox-snap/runme.sh
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+set -xe
+
+# Required env variables
+test $VERSION
+test $BUILD_NUMBER
+test $CANDIDATES_DIR
+
+# Optional env variables
+: WORKSPACE                     ${WORKSPACE:=/home/worker/workspace}
+: ARTIFACTS_DIR                 ${ARTIFACTS_DIR:=/home/worker/artifacts}
+
+
+TARGET="firefox-${VERSION}.snap"
+
+mkdir -p "$ARTIFACTS_DIR"
+rm -rf "${WORKSPACE}/source" && mkdir -p "${WORKSPACE}/source/opt" "${WORKSPACE}/source/usr/bin"
+
+CURL="curl --location --retry 10 --retry-delay 10"
+
+# Download and extract en-US linux64 binary
+$CURL -o "${WORKSPACE}/firefox.tar.bz2" \
+    "${CANDIDATES_DIR}/${VERSION}-candidates/build${BUILD_NUMBER}/linux-x86_64/en-US/firefox-${VERSION}.tar.bz2"
+
+tar -C "${WORKSPACE}/source/opt" -xf "${WORKSPACE}/firefox.tar.bz2"
+mkdir -p "${WORKSPACE}/source/opt/firefox/distribution/extensions"
+cp -v distribution.ini "${WORKSPACE}/source/opt/firefox/distribution/"
+
+# Use release-specific list of locales to fetch L10N XPIs
+$CURL -o "${WORKSPACE}/l10n_changesets.txt" "${CANDIDATES_DIR}/${VERSION}-candidates/build${BUILD_NUMBER}/l10n_changesets.txt"
+cat "${WORKSPACE}/l10n_changesets.txt"
+
+for locale in $(grep -v ja-JP-mac "${WORKSPACE}/l10n_changesets.txt" | awk '{print $1}'); do
+    $CURL -o "${WORKSPACE}/source/opt/firefox/distribution/extensions/langpack-${locale}@firefox.mozilla.org.xpi" \
+        "$CANDIDATES_DIR/${VERSION}-candidates/build${BUILD_NUMBER}/linux-x86_64/xpi/${locale}.xpi"
+done
+
+# Symlink firefox binary to /usr/bin to make it available in PATH
+ln -s ../../opt/firefox/firefox "${WORKSPACE}/source/usr/bin"
+
+# Generate snapcraft manifest
+sed -e "s/@VERSION@/${VERSION}/g" -e "s/@BUILD_NUMBER@/${BUILD_NUMBER}/g" snapcraft.yaml.in > ${WORKSPACE}/snapcraft.yaml
+cd ${WORKSPACE}
+snapcraft
+
+mv *.snap "$ARTIFACTS_DIR/$TARGET"
+
+cd $ARTIFACTS_DIR
+
+# Generate checksums file
+size=$(stat --printf="%s" $ARTIFACTS_DIR/$TARGET)
+sha=$(sha512sum $ARTIFACTS_DIR/$TARGET | awk '{print $1}')
+echo "$sha sha512 $size $TARGET" > $TARGET.checksums
+
+echo "Generating signing manifest"
+hash=$(sha512sum $TARGET.checksums | awk '{print $1}')
+
+cat << EOF > signing_manifest.json
+[{"file_to_sign": "$TARGET.checksums", "hash": "$hash"}]
+EOF
+
+# For posterity
+find . -ls
+cat $TARGET.checksums
+cat signing_manifest.json
new file mode 100644
--- /dev/null
+++ b/release/docker/firefox-snap/snapcraft.yaml.in
@@ -0,0 +1,37 @@
+name: firefox
+version: @VERSION@-@BUILD_NUMBER@
+summary: Mozilla Firefox web browser
+description:  Firefox is a powerful, extensible web browser with support for modern web application technologies.
+confinement: strict
+
+apps:
+  firefox:
+    command: desktop-launch firefox
+    plugs:
+      - unity7
+      - network
+      - home
+      - x11
+      - opengl
+      - pulseaudio
+      - gsettings
+      - camera
+      - browser-sandbox
+
+plugs:
+  browser-sandbox:
+    interface: browser-support
+    allow-sandbox: true
+
+parts:
+  firefox:
+    plugin: dump
+    source: source
+    stage-packages:
+      - libxt6
+      - libdbus-glib-1-2
+      - libasound2
+      - libpulse0
+      - libgl1-mesa-dri
+      - libgl1-mesa-glx
+    after: [desktop-gtk3]
new file mode 100644
--- /dev/null
+++ b/testing/mozharness/configs/beetmover/snap.yml.tmpl
@@ -0,0 +1,11 @@
+---
+metadata:
+    name: "Beet Mover Manifest"
+    description: "Maps artifact locations to s3 key names for snap iamge"
+    owner: "release@mozilla.com"
+
+mapping:
+  all:
+    snap:
+      artifact: {{ artifact_base_url }}/firefox-{{ version }}.snap
+      s3_key: {{ s3_prefix }}snap/firefox-{{ version }}.snap
new file mode 100644
--- /dev/null
+++ b/testing/mozharness/configs/beetmover/snap_checksums.yml.tmpl
@@ -0,0 +1,14 @@
+---
+metadata:
+    name: "Beet Mover Manifest"
+    description: "Maps artifact locations to s3 key names for snap checksums"
+    owner: "release@mozilla.com"
+
+mapping:
+  all:
+    snap_checksum:
+      artifact: {{ artifact_base_url }}/firefox-{{ version }}.snap.checksums
+      s3_key: {{ s3_prefix }}snap/firefox-{{ version }}.snap.checksums
+    snap_checksum_asc:
+      artifact: {{ artifact_base_url }}/firefox-{{ version }}.snap.checksums.asc
+      s3_key: {{ s3_prefix }}snap/firefox-{{ version }}.snap.checksums.asc