From b59442bd911214db68f2d31fe0a93e8ce3c73ed1 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 9 Jun 2020 10:55:38 +0100 Subject: [PATCH 1/9] snap: drop sudo Fixes #3989 --- scripts/build_snap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build_snap.sh b/scripts/build_snap.sh index 93e7d51cc5..9f6600d280 100755 --- a/scripts/build_snap.sh +++ b/scripts/build_snap.sh @@ -7,7 +7,7 @@ if [ ! -d "dvc" ]; then exit 1 fi -sudo snapcraft --use-lxd +snapcraft --use-lxd pip uninstall -y dvc if which dvc; then From ec5107f80449f1411e8c9d6782e7d2f339dd38b6 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 9 Jun 2020 16:03:38 +0100 Subject: [PATCH 2/9] snap: ci: fix builds --- .travis.yml | 2 ++ scripts/build_snap.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e0b14cc427..1f954f100e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -99,7 +99,9 @@ jobs: channel: stable env: - SNAPCRAFT_IMAGE_INFO: '{"build_url": "$TRAVIS_BUILD_URL"}' + - SNAPCRAFT_BUILD_ENVIRONMENT: lxd install: + - sudo usermod --append --groups lxd $USER - sudo /snap/bin/lxd.migrate -yes - sudo /snap/bin/lxd waitready - sudo /snap/bin/lxd init --auto diff --git a/scripts/build_snap.sh b/scripts/build_snap.sh index 9f6600d280..3d1ea85472 100755 --- a/scripts/build_snap.sh +++ b/scripts/build_snap.sh @@ -7,7 +7,7 @@ if [ ! -d "dvc" ]; then exit 1 fi -snapcraft --use-lxd +sg lxd -c snapcraft pip uninstall -y dvc if which dvc; then From 69f33074e92c83e7a1411e86222984610909edc4 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 9 Jun 2020 16:04:12 +0100 Subject: [PATCH 3/9] snap: ci: developer notifications --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1f954f100e..8c4dfdc942 100644 --- a/.travis.yml +++ b/.travis.yml @@ -98,8 +98,9 @@ jobs: - name: lxd channel: stable env: - - SNAPCRAFT_IMAGE_INFO: '{"build_url": "$TRAVIS_BUILD_URL"}' + - SNAPCRAFT_IMAGE_INFO: '{"build_url": "$TRAVIS_BUILD_WEB_URL"}' - SNAPCRAFT_BUILD_ENVIRONMENT: lxd + - SNAPCRAFT_BUILD_INFO: 1 # https://snapcraft.io/blog/introducing-developer-notifications-for-snap-security-updates install: - sudo usermod --append --groups lxd $USER - sudo /snap/bin/lxd.migrate -yes From 77b41a96f68b2c8df833803d0a644172b7db4779 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 9 Jun 2020 16:04:31 +0100 Subject: [PATCH 4/9] snap: minimise size --- snap/snapcraft.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 75d0f7daaa..6d07927e6a 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -42,6 +42,17 @@ parts: # https://github.com/snapcore/snapcraft/blob/19393ef36cd773a28131cec10cc0bfb3bf9c7e77/tools/snapcraft-override-build.sh#L18 sed -ri 's/^(ENABLE_USER_SITE = )None$/\1False/' $SNAPCRAFT_PART_INSTALL/usr/lib/python*/site.py cp $SNAPCRAFT_PART_BUILD/scripts/completion/dvc.bash $SNAPCRAFT_PART_INSTALL/completion.sh + # remove files already available at runtime from the base snap - reference: + # https://forum.snapcraft.io/t/reducing-the-size-of-desktop-snaps/17280 + cleanup: + after: + - dvc + plugin: nil + build-snaps: + - core18 + override-prime: | + set -eux + cd "/snap/core18/current" && find . -type f,l -exec rm -f "$SNAPCRAFT_PRIME/{}" \; apps: dvc: command: bin/dvc From 232baf0ad78335b0f3806456a3f20b82cdf0f24c Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 9 Jun 2020 16:04:54 +0100 Subject: [PATCH 5/9] debug commit --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8c4dfdc942..2acf070281 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,10 @@ env: - PATH="$PYENV_ROOT/bin:$PATH" - PIP_CACHE_DIR="$HOME/.cache/pip" # unify pip cache location for all platforms stages: - - check - - test + - name: check + if: false + - name: test + if: false - build # Travis doesn't support testing python on Mac yet, so we need # to workaround it by installing it directly with brew. From 42b343ed34ace3b2197069eb75cc7d695b78c233 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 9 Jun 2020 17:21:33 +0100 Subject: [PATCH 6/9] Revert "snap: minimise size" This reverts commit 77b41a96f68b2c8df833803d0a644172b7db4779. --- snap/snapcraft.yaml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 6d07927e6a..75d0f7daaa 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -42,17 +42,6 @@ parts: # https://github.com/snapcore/snapcraft/blob/19393ef36cd773a28131cec10cc0bfb3bf9c7e77/tools/snapcraft-override-build.sh#L18 sed -ri 's/^(ENABLE_USER_SITE = )None$/\1False/' $SNAPCRAFT_PART_INSTALL/usr/lib/python*/site.py cp $SNAPCRAFT_PART_BUILD/scripts/completion/dvc.bash $SNAPCRAFT_PART_INSTALL/completion.sh - # remove files already available at runtime from the base snap - reference: - # https://forum.snapcraft.io/t/reducing-the-size-of-desktop-snaps/17280 - cleanup: - after: - - dvc - plugin: nil - build-snaps: - - core18 - override-prime: | - set -eux - cd "/snap/core18/current" && find . -type f,l -exec rm -f "$SNAPCRAFT_PRIME/{}" \; apps: dvc: command: bin/dvc From d4ea8719861c0d12b0ca0a438e1b5939ca5c84a4 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 9 Jun 2020 17:37:27 +0100 Subject: [PATCH 7/9] fix image info --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2acf070281..2c4844fd5f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -100,7 +100,8 @@ jobs: - name: lxd channel: stable env: - - SNAPCRAFT_IMAGE_INFO: '{"build_url": "$TRAVIS_BUILD_WEB_URL"}' + - SNAPCRAFT_IMAGE_INFO: | + '{"build_url": "$TRAVIS_JOB_WEB_URL"}' - SNAPCRAFT_BUILD_ENVIRONMENT: lxd - SNAPCRAFT_BUILD_INFO: 1 # https://snapcraft.io/blog/introducing-developer-notifications-for-snap-security-updates install: From c1db88ed175555b329359d8da05a3812b1a72341 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 9 Jun 2020 21:43:43 +0100 Subject: [PATCH 8/9] Revert "debug commit" This reverts commit 232baf0ad78335b0f3806456a3f20b82cdf0f24c. --- .travis.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2c4844fd5f..de7d7a5171 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,10 +10,8 @@ env: - PATH="$PYENV_ROOT/bin:$PATH" - PIP_CACHE_DIR="$HOME/.cache/pip" # unify pip cache location for all platforms stages: - - name: check - if: false - - name: test - if: false + - check + - test - build # Travis doesn't support testing python on Mac yet, so we need # to workaround it by installing it directly with brew. From b30de577a847d9796d9f4bb2234f3897ad39d4ad Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 9 Jun 2020 21:49:39 +0100 Subject: [PATCH 9/9] snap: v1 channels Related: #3872 --- scripts/ci/before_install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/ci/before_install.sh b/scripts/ci/before_install.sh index 1a02b33871..b16a581052 100644 --- a/scripts/ci/before_install.sh +++ b/scripts/ci/before_install.sh @@ -53,10 +53,10 @@ fi if [[ -n "$TRAVIS_TAG" ]]; then if [[ $(echo "$TRAVIS_TAG" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$') ]]; then - echo "export SNAP_CHANNEL=stable" >>env.sh + echo "export SNAP_CHANNEL=stable,v1/stable" >>env.sh else - echo "export SNAP_CHANNEL=beta" >>env.sh + echo "export SNAP_CHANNEL=beta,v1/beta" >>env.sh fi else - echo "export SNAP_CHANNEL=edge" >>env.sh + echo "export SNAP_CHANNEL=edge,v1/edge" >>env.sh fi