diff --git a/.dictionary b/.dictionary index a22aa1e955..7f70d53525 100644 --- a/.dictionary +++ b/.dictionary @@ -203,7 +203,6 @@ ons os perl plist -podman powershell ppa pre diff --git a/taskcluster/docker/flatpak/Dockerfile b/taskcluster/docker/flatpak/Dockerfile deleted file mode 100644 index 794add128f..0000000000 --- a/taskcluster/docker/flatpak/Dockerfile +++ /dev/null @@ -1,43 +0,0 @@ -# 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 debian:bookworm - -MAINTAINER Naomi Kirby - -#---------------------------------------------------------------------------------------------------------------------- -#-- 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 debhelper \ - devscripts \ - equivs \ - flatpak \ - flatpak-builder \ - gpg-agent \ - locales \ - software-properties-common \ - yq \ - && apt-get clean - -RUN locale-gen "$LANG" - -#---------------------------------------------------------------------------------------------------------------------- -#-- Task Setup -------------------------------------------------------------------------------------------------------- -#---------------------------------------------------------------------------------------------------------------------- - -# %include taskcluster/scripts/build/linux_build_flatpak.sh -ADD topsrcdir/taskcluster/scripts/build/linux_build_flatpak.sh /root/builder.sh -# %include taskcluster/scripts/toolchain/bundle_flatpak_sdk.sh -ADD topsrcdir/taskcluster/scripts/toolchain/bundle_flatpak_sdk.sh /root/bundle_sdk.sh - -# Running the container builds a flatpak -WORKDIR /build/workdir -CMD /root/builder.sh diff --git a/taskcluster/kinds/build/flatpak.yml b/taskcluster/kinds/build/flatpak.yml deleted file mode 100644 index 99b6d7d009..0000000000 --- a/taskcluster/kinds/build/flatpak.yml +++ /dev/null @@ -1,34 +0,0 @@ -# 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/. ---- -linux/flatpak: - description: "Linux Build (Flatpak)" - treeherder: - symbol: B - kind: build - tier: 1 - platform: linux/flatpak - dependencies: - build: build-source/vpn - docker-image: build-docker-image-flatpak - fetches: - build: - - artifact: mozillavpn-sources.tar.gz - toolchain: - - flatpak-sdks - docker-image: - - artifact: image.tar.zst - extract: false - worker-type: b-linux-generic - worker: - max-run-time: 3600 - chain-of-trust: true - artifacts: - - type: directory - name: public/build/ - path: public/build/ - run: - using: run-task - use-caches: true - command: $VCS_PATH/taskcluster/scripts/podman-worker.py /root/builder.sh diff --git a/taskcluster/kinds/build/kind.yml b/taskcluster/kinds/build/kind.yml index fb665681d4..3a38d847e9 100644 --- a/taskcluster/kinds/build/kind.yml +++ b/taskcluster/kinds/build/kind.yml @@ -26,4 +26,3 @@ tasks-from: - wasm.yml - ios.yml - addons.yml - - flatpak.yml diff --git a/taskcluster/kinds/docker-image/kind.yml b/taskcluster/kinds/docker-image/kind.yml index cc74a1746c..d616a8d70e 100644 --- a/taskcluster/kinds/docker-image/kind.yml +++ b/taskcluster/kinds/docker-image/kind.yml @@ -37,9 +37,6 @@ tasks: symbol: I(wasm) args: QT_VERSION: 6.2.4 - flatpak: - symbol: I(flatpak) - definition: flatpak linux-qt6-build: parent: base symbol: I(linux-qt6-build) diff --git a/taskcluster/kinds/toolchain/flatpak.yml b/taskcluster/kinds/toolchain/flatpak.yml deleted file mode 100644 index d4812c7ace..0000000000 --- a/taskcluster/kinds/toolchain/flatpak.yml +++ /dev/null @@ -1,31 +0,0 @@ -# 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/. ---- -task-defaults: - worker: - max-run-time: 3600 - chain-of-trust: true - worker-type: b-linux-generic - dependencies: - docker-image: build-docker-image-flatpak - fetches: - docker-image: - - artifact: image.tar.zst - extract: false - run: - resources: - - taskcluster/scripts/podman-worker.py - - linux/flatpak/* - -flatpak-sdks: - description: "Flatpak Bundle SDKs" - treeherder: - symbol: TL(flatpak-sdks) - run: - use-caches: true - script: toolchain_podman_worker.sh - arguments: - - '/root/bundle_sdk.sh' - toolchain-alias: flatpak-sdks - toolchain-artifact: public/build/flatpak-sdks.tar.xz diff --git a/taskcluster/kinds/toolchain/kind.yml b/taskcluster/kinds/toolchain/kind.yml index 3affd59d64..38cd0dba85 100644 --- a/taskcluster/kinds/toolchain/kind.yml +++ b/taskcluster/kinds/toolchain/kind.yml @@ -28,5 +28,4 @@ tasks-from: - conda_android.yml - conda_windows.yml - conda_osx.yml - - flatpak.yml - cargo.yml diff --git a/taskcluster/scripts/build/linux_build_flatpak.sh b/taskcluster/scripts/build/linux_build_flatpak.sh deleted file mode 100755 index f481f1d813..0000000000 --- a/taskcluster/scripts/build/linux_build_flatpak.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/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 - -# Find the app-id and manifest in the mounted source directory. -FLATPAK_APP_ID= -FLATPAK_APP_MANIFEST= -for srcfile in $(find ${MOZ_FETCHES_DIR} -name '*.yml') $(find ${MOZ_FETCHES_DIR} -name '*.yaml'); do - if yq -e '."app-id"' $srcfile &> /dev/null; then - FLATPAK_APP_ID=$(yq -re '."app-id"' $srcfile) - FLATPAK_APP_MANIFEST="$srcfile" - fi -done -if [ -z "$FLATPAK_APP_ID" ] || [ -z "$FLATPAK_APP_MANIFEST" ]; then - echo "Failed to locate flatpak manifest in $MOZ_FETCHES_DIR" >&2 - exit 1 -fi - -# Setup the remotes. -flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo -flatpak remote-modify --collection-id=org.flathub.Stable flathub - -echo "Installing Dependencies" -FLAPTAK_SIDELOAD=$(find ${MOZ_FETCHES_DIR} -type d -name '.ostree' -printf '%p/repo\n') -if [ -d "${FLAPTAK_SIDELOAD}" ]; then - # Install all packages found in the sideload repo. - flatpak install --sideload-repo=${FLAPTAK_SIDELOAD} --noninteractive \ - $(flatpak remote-ls file://${FLAPTAK_SIDELOAD} --columns=ref | tail -n +1) -else - # Download from flathub - flatpak-builder --install-deps-from=flathub --install-deps-only /tmp/fp-build-dir ${FLATPAK_APP_MANIFEST} -fi - -echo "Building the Flatpak" -flatpak-builder fp-build-dir ${FLATPAK_APP_MANIFEST} - -echo "Exporting the Flatpak" -mkdir fp-export-dir -flatpak build-export fp-export-dir fp-build-dir -flatpak build-bundle fp-export-dir ${UPLOAD_DIR}/${FLATPAK_APP_ID}.flatpak ${FLATPAK_APP_ID} diff --git a/taskcluster/scripts/podman-worker.py b/taskcluster/scripts/podman-worker.py deleted file mode 100755 index 76df434827..0000000000 --- a/taskcluster/scripts/podman-worker.py +++ /dev/null @@ -1,93 +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 os -import subprocess -import sys -import tempfile -import urllib.parse -import urllib.request - -def get_task_payload(): - rootUrl = os.environ.get("TASKCLUSTER_ROOT_URL", "https://firefox-ci-tc.services.mozilla.com") - taskUrl = urllib.parse.urljoin(rootUrl, f'api/queue/v1/task/{os.environ.get("TASK_ID")}') - with urllib.request.urlopen(taskUrl) as req: - return json.load(req)["payload"] - -def get_artifact_path(payload): - for entry in payload.get('artifacts', []): - if entry.get('type') == 'directory' and entry.get('name') == 'public/build': - return entry['path'] - - return 'public/build' - -# Load the podman image and return its description in JSON -def load_podman_image(path): - # Load the image and try to grab the tag. - tag = None - args = ['podman', 'load', '-i', path] - with subprocess.Popen(args, stdout=subprocess.PIPE, stderr=sys.stderr, text=True) as proc: - for line in proc.stdout: - print(f'{line}') # Foreward to stdout - if line.startswith('Loaded image'): - i = line.index(':') - if i > 0: - tag = line[i+1:].strip() - - # Describe the podman image. - x = subprocess.run(['podman', 'image', 'inspect', tag], stdout=subprocess.PIPE, stderr=sys.stderr) - return json.loads(x.stdout)[0] - -moz_fetches_dir = os.path.realpath(os.environ.get("MOZ_FETCHES_DIR")) -task_workdir = os.environ.get("TASK_WORKDIR") - -# Load the podman image. -image_filename = os.path.join(moz_fetches_dir, 'image.tar.zst') -print(f"Loading podman image from: {image_filename}") -sys.stdout.flush() -image_data = load_podman_image(image_filename) - -# Prepare the task arguments -task_payload = get_task_payload() -worker_env = task_payload["env"] -worker_env["TASK_WORKDIR"] = image_data["Config"].get("WorkingDir", "/") -worker_args = ['podman', 'run', '--rm', '--privileged'] - -# Mount the source checkouts at /mnt/checkouts -vcs_path = os.path.join(task_workdir, os.environ.get("VCS_PATH")) -worker_args.append(f"--volume={vcs_path}:/mnt/checkouts:ro") -worker_env["VCS_PATH"] = '/mnt/checkouts' - -# Mount the fetches dir at /mnt/fetches -worker_args.append(f"--volume={moz_fetches_dir}:/mnt/fetches:ro") -worker_env["MOZ_FETCHES_DIR"] = '/mnt/fetches' - -# Mount the artifacts at /mnt/artifacts -artifact_dir = os.path.join(task_workdir, get_artifact_path(task_payload)) -os.makedirs(artifact_dir, exist_ok=True) -worker_args.append(f"--volume={artifact_dir}:/mnt/artifacts:rw") -worker_env["UPLOAD_DIR"] = '/mnt/artifacts' - -# Propagate the task environment into the container, while tweaking paths. -worker_env_file = tempfile.NamedTemporaryFile(mode='w+', prefix='env-', suffix='.txt', encoding='utf-8') -for key in worker_env: - print(f'{key}={worker_env[key]}', file=worker_env_file) -worker_env_file.flush() -worker_args.append(f'--env-file={worker_env_file.name}') - -# Last argument should be the image name followed by the script arguments. -worker_args.append(image_data["Id"]) -worker_args.extend(sys.argv[1:]) - -# Run the requested task in the container -if len(image_data["RepoTags"]) > 0: - print(f'Running podman image: {image_data["RepoTags"][0]}') -else: - print(f'Running podman image: {image_data["Id"]}') -sys.stdout.flush() -x = subprocess.run(worker_args, stdout=sys.stdout, stderr=sys.stderr) -sys.exit(x.returncode) diff --git a/taskcluster/scripts/toolchain/bundle_flatpak_sdk.sh b/taskcluster/scripts/toolchain/bundle_flatpak_sdk.sh deleted file mode 100755 index 63ba500fe4..0000000000 --- a/taskcluster/scripts/toolchain/bundle_flatpak_sdk.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/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/. - -# Find the app-id and manifest in the mounted source directory. -FLATPAK_APP_ID= -FLATPAK_APP_MANIFEST= -for srcfile in $(find ${VCS_PATH} -maxdepth 3 -name '*.yml') $(find ${VCS_PATH} -maxdepth 3 -name '*.yaml'); do - if yq -e '."app-id"' $srcfile &> /dev/null; then - FLATPAK_APP_ID=$(yq -re '."app-id"' $srcfile) - FLATPAK_APP_MANIFEST="$srcfile" - fi -done -if [ -z "$FLATPAK_APP_ID" ] || [ -z "$FLATPAK_APP_MANIFEST" ]; then - echo "Failed to locate flatpak manifest in $MOZ_FETCHES_DIR" >&2 - exit 1 -fi - -# Setup the flathub remote. -flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo -flatpak remote-modify --collection-id=org.flathub.Stable flathub - -# Install flatpak dependencies -flatpak-builder --install-deps-from=flathub --install-deps-only /tmp/fp-build-dir ${FLATPAK_APP_MANIFEST} - -# Export the runtimes -mkdir flatpak-sdks -for REF in $(flatpak list --runtime --columns=ref | tail -n +1); do - # If this runtime includes extra data - it can't be installed offline. - if flatpak info -m ${REF} | grep -q '\[Extra Data\]'; then - echo "Ignoring runtime ${REF} as it contains Extra Data" >&2 - continue - fi - flatpak create-usb flatpak-sdks ${REF} -done - -# Compress the result. -tar -cJf ${UPLOAD_DIR}/flatpak-sdks.tar.xz flatpak-sdks diff --git a/taskcluster/scripts/toolchain/toolchain_podman_worker.sh b/taskcluster/scripts/toolchain/toolchain_podman_worker.sh deleted file mode 100755 index 17139d653c..0000000000 --- a/taskcluster/scripts/toolchain/toolchain_podman_worker.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/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/. - -# Toolchain tasks need to provide a script in the taskcluster/scripts/toolchain -# directory and any kind of relative path shenanigans break the file hashing. -# I think this is really a bug in taskcluster, but let's work around it for now -# by just wrapping a call to the real podman-worker.py -$(dirname $0)/../podman-worker.py "$@"