From 37c51cc25f74904f561a2283946522d0d1fda82f Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Wed, 21 Apr 2021 15:13:21 -0500 Subject: [PATCH] build: use same container as Jenkins CI for local packaged builds on Linux Make the docker-related logic for doing a local packaged build on Linux match with the Jenkins CI build for Linux. Also fix the problems with packaged builds for Linux (local or CI) where gstreamer errors were displayed in the terminal shortly after app start/login and there was no sound output. --- AppRun | 5 +++++ Makefile | 5 ++++- build-linux.sh | 16 +++++++++++----- ci/Dockerfile | 6 +++--- ci/Jenkinsfile.linux | 2 +- docker-linux-app-image.sh | 31 ++++++++----------------------- nim-status.desktop | 2 +- 7 files changed, 33 insertions(+), 34 deletions(-) diff --git a/AppRun b/AppRun index b701e47717..cd113506d2 100755 --- a/AppRun +++ b/AppRun @@ -1,5 +1,10 @@ #!/bin/bash APPDIR="$(dirname "$(readlink -f "${0}")")" +export GST_PLUGIN_SCANNER="${APPDIR}/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner" +export GST_PLUGIN_PATH="${APPDIR}/usr/lib/gstreamer-1.0" +export GST_PLUGIN_PATH_1_0="${APPDIR}/usr/lib/gstreamer-1.0" +export GST_PLUGIN_SYSTEM_PATH="${APPDIR}/usr/lib/gstreamer-1.0" +export GST_PLUGIN_SYSTEM_PATH_1_0="${APPDIR}/usr/lib/gstreamer-1.0" export LD_LIBRARY_PATH="${APPDIR}/usr/lib/:${LD_LIBRARY_PATH}" export QT_QPA_PLATFORM="xcb" diff --git a/Makefile b/Makefile index ac195053de..7551fd0f0b 100644 --- a/Makefile +++ b/Makefile @@ -247,7 +247,7 @@ $(APPIMAGE_TOOL): mv $(_APPIMAGE_TOOL) tmp/linux/tools/ chmod +x $(APPIMAGE_TOOL) -STATUS_CLIENT_APPIMAGE ?= pkg/NimStatusClient-x86_64.AppImage +STATUS_CLIENT_APPIMAGE ?= pkg/Status.AppImage $(STATUS_CLIENT_APPIMAGE): override RESOURCES_LAYOUT := -d:production $(STATUS_CLIENT_APPIMAGE): nim_status_client $(APPIMAGE_TOOL) nim-status.desktop @@ -269,6 +269,9 @@ $(STATUS_CLIENT_APPIMAGE): nim_status_client $(APPIMAGE_TOOL) nim-status.desktop # Libraries cp -r /usr/lib/x86_64-linux-gnu/nss tmp/linux/dist/usr/lib/ + cp -P /usr/lib/x86_64-linux-gnu/libgst* tmp/linux/dist/usr/lib/ + cp -r /usr/lib/x86_64-linux-gnu/gstreamer-1.0 tmp/linux/dist/usr/lib/ + cp -r /usr/lib/x86_64-linux-gnu/gstreamer1.0 tmp/linux/dist/usr/lib/ cp vendor/status-go/build/bin/libstatus.so tmp/linux/dist/usr/lib/ echo -e $(BUILD_MSG) "AppImage" diff --git a/build-linux.sh b/build-linux.sh index 36ad4eb5bc..100514afd3 100755 --- a/build-linux.sh +++ b/build-linux.sh @@ -2,10 +2,16 @@ # This script assumes $PWD is the same dir in which this script is located -docker run -it --rm --device /dev/fuse \ - -v "${PWD}:/nim-status-client:Z" \ - -w /nim-status-client \ +# Helps avoid permissions problems with `jenkins` user in docker container when +# making a local packaged build +git clean -dfx + +docker run -it --rm \ --cap-add SYS_ADMIN \ - --privileged \ - a12e/docker-qt:5.14-gcc_64 \ + --security-opt apparmor:unconfined \ + --device /dev/fuse \ + -u jenkins:$(getent group $(whoami) | cut -d: -f3) \ + -v "${PWD}:/status-desktop" \ + -w /status-desktop \ + statusteam/nim-status-client-build:1.0.2 \ ./docker-linux-app-image.sh diff --git a/ci/Dockerfile b/ci/Dockerfile index cc5a87f75c..22b80bd684 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -4,8 +4,8 @@ FROM a12e/docker-qt:5.14-gcc_64 # $QT_PATH/$QT_VERSION/$QT_PLATFORM/bin is already prepended to $PATH # However $QT_VERSION is not exposed to environment so set it here ENV QT_VERSION="5.14.0" -ENV QTDIR="${QT_PATH}/${QT_VERSION}" -ENV LD_LIBRARY_PATH="${QTDIR}/${QT_PLATFORM}/lib:${LD_LIBRARY_PATH}" +ENV QTDIR="${QT_PATH}/${QT_VERSION}/${QT_PLATFORM}" +ENV LD_LIBRARY_PATH="${QTDIR}/lib:${LD_LIBRARY_PATH}" # $OPENSSL_PREFIX is provided by the docker image ENV LIBRARY_PATH="${OPENSSL_PREFIX}/lib:${LIBRARY_PATH}" @@ -15,7 +15,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \ && sudo add-apt-repository -y ppa:git-core/ppa \ && sudo apt update -yq \ && sudo apt install -yq --fix-missing \ - build-essential cmake git s3cmd libpcre3-dev libnss3 libxcomposite1 libxtst6 jq + build-essential cmake git s3cmd libpcre3-dev libnss3 libxcomposite1 libxtst6 jq gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-alsa gstreamer1.0-pulseaudio # Installing Golang RUN GOLANG_SHA256="aed845e4185a0b2a3c3d5e1d0a35491702c55889192bb9c30e67a3de6849c067" \ diff --git a/ci/Jenkinsfile.linux b/ci/Jenkinsfile.linux index f1b4f604d3..dcd3af43d8 100644 --- a/ci/Jenkinsfile.linux +++ b/ci/Jenkinsfile.linux @@ -4,7 +4,7 @@ pipeline { agent { docker { label 'linux' - image 'statusteam/nim-status-client-build:1.0.1' + image 'statusteam/nim-status-client-build:1.0.2' /* allows jenkins use cat and mounts '/dev/fuse' for linuxdeployqt */ args '--entrypoint="" --cap-add SYS_ADMIN --security-opt apparmor:unconfined --device /dev/fuse' } diff --git a/docker-linux-app-image.sh b/docker-linux-app-image.sh index d2267f3fec..4c2b37bf0b 100755 --- a/docker-linux-app-image.sh +++ b/docker-linux-app-image.sh @@ -1,27 +1,12 @@ #!/bin/bash -# Installing prerequisites -# Probably should be part of a dockerfile -sudo apt update -sudo apt install -y software-properties-common -sudo add-apt-repository -y ppa:git-core/ppa -sudo apt update -sudo apt install -y --fix-missing build-essential cmake git libpcre3-dev jq +# Workaround for permissions problems with `jenkins` user inside the container +cp -R . ~/status-desktop +cd ~/status-desktop -# Installing GO -# Probably should be part of a dockerfile -wget https://dl.google.com/go/go1.14.4.linux-amd64.tar.gz -sudo tar -C /usr/local -xzf go1.14.4.linux-amd64.tar.gz -rm ./go1.14.4.linux-amd64.tar.gz -export PATH="/usr/local/go/bin:${PATH}" +git clean -dfx && rm -rf vendor/* && make -j4 V=1 update +make V=1 pkg -# $QT_PATH and $QT_PLATFORM are provided by the docker image -# $QT_PATH/$QT_VERSION/$QT_PLATFORM/bin is already prepended to $PATH -# However $QT_VERSION is not exposed to environment so set it here -export QT_VERSION=$(basename $(echo "${QT_PATH}/*")) -export QTDIR="${QT_PATH}/${QT_VERSION}/${QT_PLATFORM}" -# $OPENSSL_PREFIX is provided by the docker image -export LIBRARY_PATH="${OPENSSL_PREFIX}/lib:${LIBRARY_PATH}" -export LD_LIBRARY_PATH="${QTDIR}/lib:${LD_LIBRARY_PATH}" -make clean; git clean -dfx && rm -rf vendor/* -make pkg V=1 +# Make AppImage build accessible to the docker host +cd - && cp -R ~/status-desktop/pkg . +chmod -R 775 ./pkg diff --git a/nim-status.desktop b/nim-status.desktop index ef5513171c..8e38496be9 100644 --- a/nim-status.desktop +++ b/nim-status.desktop @@ -3,6 +3,6 @@ Type=Application Name=Status Desktop Exec=nim_status_client Icon=status -Comment=Hello World +Comment=Desktop client for the Status Network Terminal=true Categories=Network;