summaryrefslogtreecommitdiffstats
path: root/testing/docker/firefox-snap
diff options
context:
space:
mode:
Diffstat (limited to 'testing/docker/firefox-snap')
-rw-r--r--testing/docker/firefox-snap/Dockerfile3
-rw-r--r--testing/docker/firefox-snap/Makefile12
-rw-r--r--testing/docker/firefox-snap/distribution.ini9
-rwxr-xr-xtesting/docker/firefox-snap/runme.sh66
-rw-r--r--testing/docker/firefox-snap/snapcraft.yaml.in37
5 files changed, 127 insertions, 0 deletions
diff --git a/testing/docker/firefox-snap/Dockerfile b/testing/docker/firefox-snap/Dockerfile
new file mode 100644
index 000000000..584bd3e4f
--- /dev/null
+++ b/testing/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
diff --git a/testing/docker/firefox-snap/Makefile b/testing/docker/firefox-snap/Makefile
new file mode 100644
index 000000000..d71dc7088
--- /dev/null
+++ b/testing/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
diff --git a/testing/docker/firefox-snap/distribution.ini b/testing/docker/firefox-snap/distribution.ini
new file mode 100644
index 000000000..ffa5f3dd5
--- /dev/null
+++ b/testing/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
diff --git a/testing/docker/firefox-snap/runme.sh b/testing/docker/firefox-snap/runme.sh
new file mode 100755
index 000000000..580ac2443
--- /dev/null
+++ b/testing/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
diff --git a/testing/docker/firefox-snap/snapcraft.yaml.in b/testing/docker/firefox-snap/snapcraft.yaml.in
new file mode 100644
index 000000000..9448c104d
--- /dev/null
+++ b/testing/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]