diff options
author | Ruben Pollan <meskio@sindominio.net> | 2020-08-18 17:46:53 +0200 |
---|---|---|
committer | kali kaneko (leap communications) <kali@leap.se> | 2020-09-25 12:33:42 +0200 |
commit | 436d0437a9bbc26ba71308f1f3930a4f6c77fa25 (patch) | |
tree | 40af7c6a80dce4016cc473bd9aabe6463eb672b3 | |
parent | 8dd79bac1adbb3142db07c6e90656676e285db89 (diff) |
[ci] build snap image
-rw-r--r-- | .gitlab-ci.yml | 21 | ||||
-rwxr-xr-x | branding/scripts/build-all-providers | 5 | ||||
-rwxr-xr-x | branding/templates/makefile/Makefile | 10 | ||||
-rw-r--r-- | docker/Dockerfile | 33 |
4 files changed, 47 insertions, 22 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3ccb8e1..dfe1899 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -53,19 +53,20 @@ build_test: # - echo "Triggering CI pipeline on https://0xacab.org/leap/riseup-vpn_package/pipelines" # - "curl -X POST -F token=$RISEUP_VPN_DEB_TRIGGER_TOKEN -F ref=master https://0xacab.org/api/v4/projects/1916/trigger/pipeline" -# vendorize: -# image: registry.0xacab.org/leap/docker/bitmask-vpn:latest -# stage: vendor -# script: -# - 'PROVIDERS="riseup calyx" make build_all_providers' -# artifacts: -# name: installers-$CI_COMMIT_REF_NAME -# paths: -# - 'deploy/*.snap' +vendorize: + image: registry.0xacab.org/leap/docker/bitmask-vpn:latest + stage: vendor + script: + #- 'PROVIDERS="riseup calyx" make build_all_providers' + - 'PROVIDERS="riseup" make build_all_providers' + artifacts: + name: installers-$CI_COMMIT_REF_NAME + paths: + - 'deploy/*.snap' # - 'deploy/RiseupVPN-*.exe' # - 'deploy/RiseupVPN-*.pkg' # - 'deploy/riseup-vpn_*.deb' # - 'deploy/CalyxVPN-*.exe' # - 'deploy/CalyxVPN-*.pkg' # - 'deploy/calyx-vpn_*.deb' -# expire_in: 1 month + expire_in: 1 month diff --git a/branding/scripts/build-all-providers b/branding/scripts/build-all-providers index 2efcfc5..92a1307 100755 --- a/branding/scripts/build-all-providers +++ b/branding/scripts/build-all-providers @@ -12,6 +12,7 @@ export XBUILD=yes for _provider in $PROVIDERS; do export PROVIDER=$_provider; make prepare - make build - make packages + #make build + #make packages + make package_snap done diff --git a/branding/templates/makefile/Makefile b/branding/templates/makefile/Makefile index 0c21eaf..b4faa60 100755 --- a/branding/templates/makefile/Makefile +++ b/branding/templates/makefile/Makefile @@ -85,12 +85,12 @@ endif pkg_snap: -@mkdir -p ../../deploy @echo "[+] building snap..." - cd ../.. - -@ln -s build/$(PROVIDER)/snap snap - snapcraft build + cd ../..; \ + ln -s build/$(PROVIDER)/snap snap; \ + snapcraft build; \ snapcraft snap - -@rm snap - @mv $(BINNAME)* ../../deploy + -@rm ../../snap + @mv ../../$(BINNAME)* ../../deploy pkg_deb: echo "[+] building debian package version" ${DEB_VERSION} diff --git a/docker/Dockerfile b/docker/Dockerfile index b0645e4..5934ea8 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -17,15 +17,16 @@ RUN apt-get update && apt-get upgrade --yes && \ git curl wget \ libappindicator3-dev libgtk-3-dev \ webkit2gtk-4.0 \ - mingw-w64 upx-ucl python snapcraft snapd \ - unzip \ + mingw-w64 upx-ucl python snapd \ + unzip sudo locales \ devscripts fakeroot debhelper \ clang llvm-dev libxml2-dev uuid-dev \ libssl-dev bash patch tar \ xz-utils bzip2 gzip sed cpio libbz2-dev \ software-properties-common dh-golang \ jq \ - squashfs-tools && \ + squashfs-tools \ + qtbase5-dev qttools5-dev-tools qt5-qmake g++ qtdeclarative5-dev qt5-default && \ add-apt-repository -y ppa:longsleep/golang-backports && \ apt-get update && \ apt-get install -y --no-install-recommends golang-1.14-go golang-go golang-golang-x-tools-dev && \ @@ -60,11 +61,30 @@ RUN git clone https://github.com/VantaInc/xar && \ ./autogen.sh && ./configure && \ make && sudo make install -# Grab the core18 snap (which snapcraft uses as a base) from the stable channel +# Grab the core18 and core20 snap (which snapcraft uses as a base) from the stable channel # and unpack it in the proper place, to speed up snapcraft builds in the containers. RUN curl -L $(curl -H 'X-Ubuntu-Series: 16' 'https://api.snapcraft.io/api/v1/snaps/details/core18' | jq '.download_url' -r) --output core18.snap RUN mkdir -p /snap/core18 RUN unsquashfs -d /snap/core18/current core18.snap +RUN curl -L $(curl -H 'X-Ubuntu-Series: 16' 'https://api.snapcraft.io/api/v1/snaps/details/core20' | jq '.download_url' -r) --output core20.snap +RUN mkdir -p /snap/core20 +RUN unsquashfs -d /snap/core20/current core20.snap + +# Grab the snapcraft snap 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/snapcraft?channel=stable' | jq '.download_url' -r) --output snapcraft.snap +RUN mkdir -p /snap/snapcraft +RUN unsquashfs -d /snap/snapcraft/current snapcraft.snap + + +# 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 ln -s /snap/bin/snapcraft /bin/ # cache go modules RUN rm -rf /gomods && mkdir -p /gomods/packages @@ -76,9 +96,12 @@ RUN go mod download COPY builder.sh / # Generate locale. -RUN apt-get update && apt-get dist-upgrade --yes && apt-get install --yes sudo locales && locale-gen en_US.UTF-8 +RUN 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 SNAP="/snap/snapcraft/current" +ENV SNAP_NAME="snapcraft" +ENV SNAP_ARCH="amd64" |