diff options
author | bhatman1441 <blackhat1441@protonmail.com> | 2024-01-09 15:53:55 +0300 |
---|---|---|
committer | bhatman1441 <blackhat1441@protonmail.com> | 2024-01-09 15:53:55 +0300 |
commit | 359420a1bb12481eac9c90349d018756da1a1b9c (patch) | |
tree | d4b26e20922221e269efb876ab75701a7368a0d9 | |
parent | e811ce031c49a7a531e951bbbad9b8c78ebbd49d (diff) | |
parent | f80897a6ef2647eec64d5932905c05907ef20450 (diff) |
Merge branch 'snap-pipeline-updates' into 'master'
CI Pipeline Updates
See merge request Remmina/Remmina!2557
-rw-r--r-- | .gitlab-ci.yml | 59 | ||||
-rw-r--r-- | ci/dockerfiles/snap-22.04/Dockerfile | 67 | ||||
-rw-r--r-- | ci/dockerfiles/ubuntu-22.04/Dockerfile | 7 |
3 files changed, 117 insertions, 16 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index af560e4f3..8321e8500 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ # See https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings # Note that environment variables can be set in several places # See https://docs.gitlab.com/ee/ci/variables/#priority-of-environment-variables -image: registry.gitlab.com/remmina/remmina/ubuntu:20.04 +image: registry.gitlab.com/remmina/remmina/ubuntu:22.04 stages: - test - build @@ -39,7 +39,7 @@ ubuntu:devel: refs: - schedules flatpak:test: - image: registry.gitlab.com/remmina/remmina/ubuntu:20.04 + image: registry.gitlab.com/remmina/remmina/ubuntu:22.04 stage: test variables: BUNDLE: remmina-dev.flatpak @@ -47,8 +47,6 @@ flatpak:test: FLATHUB_REPO: https://dl.flathub.org/repo/flathub.flatpakrepo before_script: - apt-get update -qq - - add-apt-repository $FLATPAK_PPA -y - - apt-get update -qq - apt-get install -y -qq flatpak-builder flatpak build-essential git-core - flatpak --user remote-add --if-not-exists flathub $FLATHUB_REPO - git config --global protocol.file.allow always @@ -75,16 +73,51 @@ flatpak:test: refs: - schedules snap:build: - image: ubuntu:22.04 + image: registry.gitlab.com/remmina/remmina/snap:22.04 stage: build script: - - export LC_ALL=C.UTF-8 - - export LANG=C.UTF-8 - - export SNAP_ARCH=amd64 - - export SNAPCRAFT_BUILD_INFO=1 - - apt-get -y update - - apt-get install -y git snapcraft - - SNAPCRAFT_SETUP_CORE=1 snapcraft --destructive-mode + - apt-get install -y git + - mkdir -p ~/.local/share/snapcraft/provider/launchpad + - echo -en "[1]\n" > ~/.local/share/snapcraft/provider/launchpad/credentials + - echo -en "consumer_key = System-wide" >> ~/.local/share/snapcraft/provider/launchpad/credentials + - echo -en ":" >> ~/.local/share/snapcraft/provider/launchpad/credentials + - echo -en " Ubuntu (ubuntu)\n" >> ~/.local/share/snapcraft/provider/launchpad/credentials + - echo -en "consumer_secret = \n" >> ~/.local/share/snapcraft/provider/launchpad/credentials + - echo -en "access_token = " >> ~/.local/share/snapcraft/provider/launchpad/credentials + - echo -en $LAUNCHPAD_CREDENTIALS_ACCESS_TOKEN >> ~/.local/share/snapcraft/provider/launchpad/credentials + - echo -en "\naccess_secret = " >> ~/.local/share/snapcraft/provider/launchpad/credentials + - echo -en $LAUNCHPAD_CREDENTIALS_ACCESS_SECRET >> ~/.local/share/snapcraft/provider/launchpad/credentials + - echo -en "\n" >> ~/.local/share/snapcraft/provider/launchpad/credentials + + - snapcraft remote-build --launchpad-accept-public-upload + + - | + if ls remmina_*_amd64.snap 1> /dev/null 2>&1; then + echo "amd64 snap file found" + else + echo "amd64 snap file not found" + cat remmina_amd64.txt + exit 1 + fi + + - | + if ls remmina_*_arm64.snap 1> /dev/null 2>&1; then + echo "arm64 snap file found" + else + echo "arm64 snap file not found" + cat remmina_arm64.txt + exit 1 + fi + + - | + if ls remmina_*_armhf.snap 1> /dev/null 2>&1; then + echo "armhf snap file found" + else + echo "armhf snap file not found" + cat remmina_armhf.txt + exit 1 + fi + - | if [ "$CI_COMMIT_REF_NAME" = "master" ]; then echo $SNAPCRAFT_LOGIN | base64 --decode --ignore-garbage > snapcraft.login @@ -92,10 +125,12 @@ snap:build: snapcraft upload remmina*.snap --release edge snapcraft logout fi + timeout: 8h 0m allow_failure: false artifacts: paths: - "./*.snap" + - "./remmina_*.txt" expire_in: 10 days only: refs: diff --git a/ci/dockerfiles/snap-22.04/Dockerfile b/ci/dockerfiles/snap-22.04/Dockerfile new file mode 100644 index 000000000..3a052a3c9 --- /dev/null +++ b/ci/dockerfiles/snap-22.04/Dockerfile @@ -0,0 +1,67 @@ +ARG RISK=edge +ARG UBUNTU=jammy + +FROM ubuntu:$UBUNTU as builder +ARG RISK +ARG UBUNTU +RUN echo "Building snapcraft:$RISK in ubuntu:$UBUNTU" + +# Grab dependencies +RUN apt-get update +RUN apt-get dist-upgrade --yes +RUN apt-get install --yes \ + curl \ + jq \ + squashfs-tools + +# Grab the core snap (for backwards compatibility) from the stable channel and +# unpack it in the proper place. +RUN curl -L $(curl -H 'X-Ubuntu-Series: 16' 'https://api.snapcraft.io/api/v1/snaps/details/core' | jq '.download_url' -r) --output core.snap +RUN mkdir -p /snap/core +RUN unsquashfs -d /snap/core/current core.snap + +# Grab the core22 snap (which snapcraft uses as a base) from the stable channel +# and unpack it in the proper place. +RUN curl -L $(curl -H 'X-Ubuntu-Series: 16' 'https://api.snapcraft.io/api/v1/snaps/details/core22' | jq '.download_url' -r) --output core22.snap +RUN mkdir -p /snap/core22 +RUN unsquashfs -d /snap/core22/current core22.snap + +# Grab the snapcraft snap from the $RISK channel and unpack it in the proper +# place. +RUN curl -L $(curl -H 'X-Ubuntu-Series: 16' 'https://api.snapcraft.io/api/v1/snaps/details/snapcraft?channel='$RISK | jq '.download_url' -r) --output snapcraft.snap +RUN mkdir -p /snap/snapcraft +RUN unsquashfs -d /snap/snapcraft/current snapcraft.snap + +# Fix Python3 installation: Make sure we use the interpreter from +# the snapcraft snap: +RUN unlink /snap/snapcraft/current/usr/bin/python3 +RUN ln -s /snap/snapcraft/current/usr/bin/python3.* /snap/snapcraft/current/usr/bin/python3 +RUN 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 | tr -d \')" && 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 + +# Multi-stage build, only need the snaps from the builder. Copy them one at a +# time so they can be cached. +FROM ubuntu:$UBUNTU +COPY --from=builder /snap/core /snap/core +COPY --from=builder /snap/core22 /snap/core22 +COPY --from=builder /snap/snapcraft /snap/snapcraft +COPY --from=builder /snap/bin/snapcraft /snap/bin/snapcraft + +# Generate locale and install dependencies. +RUN apt-get update && apt-get dist-upgrade --yes && apt-get install --yes snapd sudo locales && locale-gen en_US.UTF-8 + +# Set the proper environment. +ENV LANG="en_US.UTF-8" +ENV LANGUAGE="en_US:en" +ENV LC_ALL="en_US.UTF-8" +ENV PATH="/snap/bin:/snap/snapcraft/current/usr/bin:$PATH" +ENV SNAP="/snap/snapcraft/current" +ENV SNAP_NAME="snapcraft" +ENV SNAP_ARCH="amd64" diff --git a/ci/dockerfiles/ubuntu-22.04/Dockerfile b/ci/dockerfiles/ubuntu-22.04/Dockerfile index 3d7a977c4..8ad5b6008 100644 --- a/ci/dockerfiles/ubuntu-22.04/Dockerfile +++ b/ci/dockerfiles/ubuntu-22.04/Dockerfile @@ -10,13 +10,12 @@ ENV DEBIAN_FRONTEND noninteractive RUN \ LC_ALL=en_US.UTF-8 apt-get update -qq \ - && apt-get install -y -qq software-properties-common python3-software-properties\ + && apt-get install -y -qq software-properties-common python3-software-properties \ && apt-add-repository ppa:remmina-ppa-team/remmina-next-daily -y \ - && apt-add-repository ppa:alexlarsson/flatpak -y \ && apt-get update -qq \ - && apt install -y -qq snapcraft flatpak-builder flatpak build-essential git-core \ + && apt install -y -qq flatpak-builder flatpak build-essential git-core \ cmake curl freerdp2-dev intltool libappindicator3-dev libasound2-dev \ - libavahi-ui-gtk3-dev libavcodec-dev libavresample-dev libavutil-dev \ + libavahi-ui-gtk3-dev libavcodec-dev libavutil-dev \ libcups2-dev libgcrypt20-dev libgnutls28-dev \ libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libgtk-3-dev \ libjpeg-dev libjson-glib-dev libpcre2-8-0 libpcre2-dev libpulse-dev \ |