Skip to content

Commit

Permalink
YOLO: Flatpak on taskcluster?
Browse files Browse the repository at this point in the history
  • Loading branch information
oskirby committed Jan 17, 2024
1 parent 2ca711e commit 5ae9637
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 0 deletions.
52 changes: 52 additions & 0 deletions taskcluster/docker/linux-flatpak-build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 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 ubuntu:22:04

MAINTAINER Naomi Kirby <[email protected]>

#----------------------------------------------------------------------------------------------------------------------
#-- Extra Packages ----------------------------------------------------------------------------------------------------
#----------------------------------------------------------------------------------------------------------------------
ENV CURL='curl --location --retry 5' \
DEBIAN_FRONTEND='noninteractive' \
LANG='en_US.UTF-8' \
TERM='dumb'

RUN apt-get update \
&& apt-get install -y tzdata \
&& apt-get install -y flatpak \
locales \
sudo \
&& apt-get clean

# TODO: Pre-fetch the flatpak runtimes?

#----------------------------------------------------------------------------------------------------------------------
#-- Worker User -------------------------------------------------------------------------------------------------------
#----------------------------------------------------------------------------------------------------------------------

# Setup the worker user
# %include taskcluster/scripts/setup-worker.sh
ADD topsrcdir/taskcluster/scripts/setup-worker.sh /root/setup-worker.sh
RUN /root/setup-worker.sh
WORKDIR /builds/worker/

#----------------------------------------------------------------------------------------------------------------------
#-- Task Setup --------------------------------------------------------------------------------------------------------
#----------------------------------------------------------------------------------------------------------------------

# %include-run-task
# %include taskcluster/scripts/build/linux_build_flatpak.sh
ADD topsrcdir/taskcluster/scripts/build/linux_build_flatpak.sh /builds/worker/builder.sh

ENV SHELL=/bin/bash \
HOME=/builds/worker \
PATH="/builds/worker/.local/bin:$PATH"

VOLUME /builds/worker/checkouts
VOLUME /builds/worker/.cache

# run-task expects to run as root
USER root
13 changes: 13 additions & 0 deletions taskcluster/kinds/build/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,16 @@ linux/static:
docker-image: {in-tree: linux-qt6-build}
run:
command: /builds/worker/builder.sh -s

linux/flatpak:
description: "Linux Build (Flatpak)"
treeherder:
platform: linux/flatpak
worker:
docker-image: {in-tree: linux-flatpak-build}
docker-in-docker: true
run:
using: run-task
use-caches: false
cwd: '{checkout}'
command: ./taskcluster/scripts/build/linux_build_flatpak.sh
3 changes: 3 additions & 0 deletions taskcluster/kinds/docker-image/kind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ tasks:
parent: base
symbol: I(linux-qt6-build)
definition: linux-qt6-build
linux-flatpak-build:
symbol: I(linux-flatpak)
definition: linux-flatpak-build
linux-build-focal:
symbol: I(linux-focal)
definition: linux-dpkg-build
Expand Down
27 changes: 27 additions & 0 deletions taskcluster/scripts/build/linux_build_flatpak.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

# 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/.

set -e

# Dump some stuff for debug
cat /etc/os-release
env

sudo apt-get update
sudo apt-get install flatpak flatpak-builder -y

flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

mkdir ${TASK_WORKDIR}/fp-build-dir
flatpak-builder --user --install-deps-from=flathub --install-deps-only ${TASK_WORKDIR}/fp-build-dir ${MOZ_FETCHES_DIR}/org.mozilla.vpn.yml

flatpak-builder --user ${TASK_WORKDIR}/fp-build-dir ${MOZ_FETCHES_DIR}/org.mozilla.vpn.yml

mkdir ${TASK_WORKDIR}/fp-export-dir
flatpak build-export ${TASK_WORKDIR}/fp-export-dir ${TASK_WORKDIR}/fp-build-dir

# Export the flatpak
flatpak build-bundle ${TASK_WORKDIR}/fp-export-dir /builds/worker/artifacts/mozillavpn.flatpak org.mozilla.vpn

0 comments on commit 5ae9637

Please sign in to comment.