Bug 1896374 - Remove firefox-snap docker image r=releng-reviewers,bhearsum a=pascalc

Differential Revision: https://phabricator.services.mozilla.com/D215600
This commit is contained in:
Alexandre Lissy 2024-08-09 14:38:42 +00:00
parent 7bde2f6a1b
commit 2ac03ecb16
9 changed files with 0 additions and 333 deletions

View file

@ -1,71 +0,0 @@
## The below code is from snapcraft/docker/stable.Dockerfile
## The modifications done are part of the documentation for enabling core18 snaps.
## https://snapcraft.io/docs/t/creating-docker-images-for-snapcraft/11739
# /!\ The base image must follow the version of the `coreXX` package
# https://forum.snapcraft.io/t/issues-dockerizing-a-snapcraft-build-process/30294/5
FROM ubuntu:focal
ENV LANG='en_US.UTF-8' \
LANGUAGE='en_US:en' \
LC_ALL='en_US.UTF-8' \
PATH="/snap/bin:$PATH" \
SNAP='/snap/snapcraft/current' \
SNAP_NAME='snapcraft' \
SNAP_ARCH='amd64' \
TERM='dumb' \
TZ='Etc/UTC'
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Grab dependencies. snapd is now required per https://github.com/snapcore/snapcraft/pull/3210
RUN apt-get update && \
apt-get dist-upgrade --yes && \
apt-get install --yes \
curl \
jq \
squashfs-tools \
locales \
bzip2 \
curl \
gcc \
git \
python3 \
locales \
snapd \
sudo \
&& \
locale-gen "$LANG"
COPY download_and_install_snap.sh .
RUN bash download_and_install_snap.sh 'core20'
RUN bash download_and_install_snap.sh 'gnome-3-38-2004'
RUN bash download_and_install_snap.sh 'gnome-3-38-2004-sdk'
RUN bash download_and_install_snap.sh 'snapcraft'
# Fix Python3 installation: Make sure we use the interpreter from
# the snapcraft snap:
RUN unlink /snap/snapcraft/current/usr/bin/python3 && \
ln -s /snap/snapcraft/current/usr/bin/python3.* /snap/snapcraft/current/usr/bin/python3 && \
echo /snap/snapcraft/current/lib/python3.*/site-packages >> /snap/snapcraft/current/usr/lib/python3/dist-packages/site-packages.pth
# Create a snapcraft runner (TODO: move version detection to the core of snapcraft).
RUN mkdir -p /snap/bin
RUN echo "#!/bin/sh" > /snap/bin/snapcraft
RUN snap_version="$(awk '/^version:/{print $2}' /snap/snapcraft/current/meta/snap.yaml)" && echo "export SNAP_VERSION=\"$snap_version\"" >> /snap/bin/snapcraft
RUN echo 'exec "$SNAP/usr/bin/python3" "$SNAP/bin/snapcraft" "$@"' >> /snap/bin/snapcraft
RUN chmod +x /snap/bin/snapcraft
RUN mkdir /scripts/
WORKDIR /scripts/
# Copy everything in the docker/firefox-snap folder but the Dockerfile
#
# XXX The following pattern is neither a regex nor a glob one. It's
# documented at https://golang.org/pkg/path/filepath/#Match. There's no
# way of explicitly filtering out "Dockerfile". If one day, someone needs
# to add a file starting with "D", then we must revisit the pattern below.
COPY [^D]* /scripts/
# Set a default command useful for debugging
CMD ["/bin/bash", "--login"]

View file

@ -1,12 +0,0 @@
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

View file

@ -1,27 +0,0 @@
#!/bin/bash
set -ex
SNAP_NAME="$1"
SNAP_CHANNEL="${2:-stable}"
SNAP_INSTALL_LOCATION="${3:-/snap}"
SNAP_METADATA="$(curl --header 'X-Ubuntu-Series: 16' "https://api.snapcraft.io/api/v1/snaps/details/$SNAP_NAME?channel=$SNAP_CHANNEL")"
set +x
SNAP_SHA512="$(echo "$SNAP_METADATA" | jq '.download_sha512' -r)"
SNAP_DOWNLOAD_URL="$(echo "$SNAP_METADATA" | jq '.download_url' -r)"
SNAP_LAST_UPDATED="$(echo "$SNAP_METADATA" | jq '.last_updated' -r)"
SNAP_REVISION="$(echo "$SNAP_METADATA" | jq '.revision' -r)"
SNAP_VERSION="$(echo "$SNAP_METADATA" | jq '.version' -r)"
set -x
echo "Downloading $SNAP_NAME, version $SNAP_VERSION, revision $SNAP_REVISION (last updated: $SNAP_LAST_UPDATED)..."
curl --location "$SNAP_DOWNLOAD_URL" --output "$SNAP_NAME.snap"
sha512sum -c <(echo "$SNAP_SHA512 $SNAP_NAME.snap")
mkdir -p "$SNAP_INSTALL_LOCATION/$SNAP_NAME"
unsquashfs -d "$SNAP_INSTALL_LOCATION/$SNAP_NAME/current" "$SNAP_NAME.snap"
rm "$SNAP_NAME.snap"
echo "$SNAP_NAME version $SNAP_VERSION has correctly been uploaded and installed."

View file

@ -1,15 +0,0 @@
#!/usr/bin/env python3
# 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/.
import json
import sys
l10n_changesets_json_path = sys.argv[1]
with open(l10n_changesets_json_path) as f:
locales = json.load(f).keys()
linux_locales = [l for l in locales if l != "ja-JP-mac"]
print("\n".join(sorted(linux_locales)))

View file

@ -1,91 +0,0 @@
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
grade: stable
base: core20
compression: lzo
apps:
firefox:
command: firefox
command-chain: [tmpdir]
desktop: distribution/firefox.desktop
extensions: [gnome-3-38]
environment:
HOME: "$SNAP_USER_COMMON"
GTK_USE_PORTAL: 1
slots:
- dbus-daemon
- mpris
plugs:
- avahi-observe
- browser-sandbox
- camera
- cups-control
- gsettings
- hardware-observe
- home
- joystick
- network
- network-observe
- opengl
- pulseaudio
- removable-media
- screen-inhibit-control
- system-packages-doc
- u2f-devices
- unity7
- upower-observe
plugs:
browser-sandbox:
interface: browser-support
allow-sandbox: true
etc-firefox-policies:
interface: system-files
read: [/etc/firefox/policies]
layout:
/usr/share/libdrm:
bind: $SNAP/gnome-platform/usr/share/libdrm
parts:
firefox:
plugin: dump
source: source
stage-packages:
- libxt6
- libasound2
- libpci3
- libpulse0
- libgl1-mesa-dri
- libgl1-mesa-glx
- libmirclient9
- desktop-file-utils
- ffmpeg
- libc-bin
- locales-all
- libcurl3-gnutls
prime:
- -usr/lib/*/libharfbuzz*
- -usr/lib/*/*pango*
# Find files provided by the base and platform snap and ensure they aren't
# duplicated in this snap
cleanup:
after: [firefox]
plugin: nil
build-snaps: [core20, gnome-3-38-2004]
override-prime: |
set -eux
for snap in "core20" "gnome-3-38-2004"; do
cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$SNAPCRAFT_PRIME/{}" \;
done
slots:
dbus-daemon:
interface: dbus
bus: session
name: org.mozilla.firefox

View file

@ -1,5 +0,0 @@
{
"policies": {
"DisableAppUpdate": true
}
}

View file

@ -1,104 +0,0 @@
#!/bin/bash
set -xe
# Thunderbird Snap builds will set this to "thunderbird"
: PRODUCT "${PRODUCT:=firefox}"
# Required env variables
test "$VERSION"
test "$BUILD_NUMBER"
test "$CANDIDATES_DIR"
test "$L10N_CHANGESETS"
# Optional env variables
: WORKSPACE "${WORKSPACE:=/home/worker/workspace}"
: ARTIFACTS_DIR "${ARTIFACTS_DIR:=/home/worker/artifacts}"
: PUSH_TO_CHANNEL ""
SCRIPT_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TARGET="target.snap"
TARGET_FULL_PATH="$ARTIFACTS_DIR/$TARGET"
SOURCE_DEST="${WORKSPACE}/source"
mkdir -p "$ARTIFACTS_DIR"
rm -rf "$SOURCE_DEST" && mkdir -p "$SOURCE_DEST"
CURL="curl --location --retry 10 --retry-delay 10"
# Download and extract en-US linux64 binary
$CURL -o "${WORKSPACE}/${PRODUCT}.tar.bz2" \
"${CANDIDATES_DIR}/${VERSION}-candidates/build${BUILD_NUMBER}/linux-x86_64/en-US/${PRODUCT}-${VERSION}.tar.bz2"
tar -C "$SOURCE_DEST" -xf "${WORKSPACE}/${PRODUCT}.tar.bz2" --strip-components=1
DISTRIBUTION_DIR="$SOURCE_DEST/distribution"
if [[ "$PRODUCT" == "firefox" ]]; then
# Get Ubuntu configuration
PARTNER_CONFIG_DIR="$WORKSPACE/partner_config"
git clone https://github.com/mozilla-partners/canonical.git "$PARTNER_CONFIG_DIR"
mv "$PARTNER_CONFIG_DIR/desktop/ubuntu/distribution" "$DISTRIBUTION_DIR"
else
mkdir -p "$DISTRIBUTION_DIR"
fi
cp -v "$SCRIPT_DIRECTORY/${PRODUCT}.desktop" "$DISTRIBUTION_DIR"
# Add a group policy file to disable app updates, as those are handled by snapd
cp -v "$SCRIPT_DIRECTORY/policies.json" "$DISTRIBUTION_DIR"
# Use list of locales to fetch L10N XPIs
$CURL -o "${WORKSPACE}/l10n_changesets.json" "$L10N_CHANGESETS"
locales=$(python3 "$SCRIPT_DIRECTORY/extract_locales_from_l10n_json.py" "${WORKSPACE}/l10n_changesets.json")
mkdir -p "$DISTRIBUTION_DIR/extensions"
for locale in $locales; do
$CURL -o "$SOURCE_DEST/distribution/extensions/langpack-${locale}@${PRODUCT}.mozilla.org.xpi" \
"$CANDIDATES_DIR/${VERSION}-candidates/build${BUILD_NUMBER}/linux-x86_64/xpi/${locale}.xpi"
done
# In addition to the packages downloaded below, snapcraft fetches deb packages from ubuntu.com,
# when a snap is built,. They may bump packages there and remove the old ones. Updating the
# database allows snapcraft to find the latest packages.
# For more context, see 1448239
apt-get update
# Extract gtk30.mo from Ubuntu language packs
apt download language-pack-gnome-*-base
for i in *.deb; do
# shellcheck disable=SC2086
dpkg-deb --fsys-tarfile $i | tar xv -C "$SOURCE_DEST" --wildcards "./usr/share/locale-langpack/*/LC_MESSAGES/gtk30.mo" || true
done
# Add wrapper script to set TMPDIR appropriate for the snap
cp -v "$SCRIPT_DIRECTORY/tmpdir" "$SOURCE_DEST"
# Generate snapcraft manifest
sed -e "s/@VERSION@/${VERSION}/g" -e "s/@BUILD_NUMBER@/${BUILD_NUMBER}/g" "${PRODUCT}.snapcraft.yaml.in" > "${WORKSPACE}/snapcraft.yaml"
cd "${WORKSPACE}"
# Make sure snapcraft knows we're building amd64, even though we may not be on this arch.
export SNAP_ARCH='amd64'
snapcraft
mv -- *.snap "$TARGET_FULL_PATH"
cd "$ARTIFACTS_DIR"
# Generate checksums file
size=$(stat --printf="%s" "$TARGET_FULL_PATH")
sha=$(sha512sum "$TARGET_FULL_PATH" | 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

View file

@ -1,6 +0,0 @@
#!/bin/bash
# Set TMPDIR to be under the user's default Downloads dir
export TMPDIR=$(xdg-user-dir DOWNLOAD)/firefox.tmp
exec "$@"

View file

@ -204,8 +204,6 @@ tasks:
periodic-updates:
symbol: I(file)
parent: debian12-base
firefox-snap:
symbol: I(snap)
firefox-flatpak:
symbol: I(flatpak)
webrender: