Stop running snapcraft with sudo (#8063)

* Do not use sudo when building the snap.

* add user to lxd

* Run with lxd group.
This commit is contained in:
Brad Warren
2020-06-09 14:46:11 -07:00
committed by GitHub
parent 340a4280ea
commit e31834a6cd
+7 -1
View File
@@ -6,9 +6,15 @@ if [[ -z "$TRAVIS" ]]; then
exit 1
fi
# Add the current user to the lxd group so they can run `snapcraft --use-lxd`
# without sudo since running the command without sudo is required by newer
# versions of snapcraft.
sudo usermod -aG lxd "$USER"
sudo /snap/bin/lxd.migrate -yes
sudo /snap/bin/lxd waitready
sudo /snap/bin/lxd init --auto
tools/strip_hashes.py letsencrypt-auto-source/pieces/dependency-requirements.txt > constraints.txt
sudo snapcraft --use-lxd
# Run snapcraft with the lxd group since it has not been added to the current
# shell.
sg lxd -c 'snapcraft --use-lxd'
sudo snap install --dangerous --classic *.snap