When I try to use snapcraft’s container builds, the first time goes fine:
SNAPCRAFT_CONTAINER_BUILDS=1 snapcraft
Creating snapcraft-project
Mounting /home/user/project into container
Device /root/build_project added to snapcraft-project
[...]
# built fine
But a subsequent one fails to find snap/snapcraft.yaml:
SNAPCRAFT_CONTAINER_BUILDS=1 snapcraft
Mounting /home/user/project into container
Waiting for a network connection...
Network connection established
Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:2 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:3 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu xenial-security InRelease
Get:5 http://archive.ubuntu.com/ubuntu xenial/main Sources [868 kB]
Get:6 http://security.ubuntu.com/ubuntu xenial-security/main Sources [86.4 kB]
Get:7 http://archive.ubuntu.com/ubuntu xenial/restricted Sources [4808 B]
Get:8 http://archive.ubuntu.com/ubuntu xenial/universe Sources [7728 kB]
Get:9 http://security.ubuntu.com/ubuntu xenial-security/restricted Sources [2604 B]
Get:10 http://security.ubuntu.com/ubuntu xenial-security/universe Sources [37.8 kB]
Get:11 http://security.ubuntu.com/ubuntu xenial-security/multiverse Sources [1144 B]
Get:12 http://archive.ubuntu.com/ubuntu xenial/multiverse Sources [179 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial-updates/main Sources [269 kB]
Get:14 http://archive.ubuntu.com/ubuntu xenial-updates/restricted Sources [3012 B]
Get:15 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources [167 kB]
Get:16 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse Sources [7232 B]
Get:17 http://archive.ubuntu.com/ubuntu xenial-backports/main Sources [3312 B]
Get:18 http://archive.ubuntu.com/ubuntu xenial-backports/universe Sources [4404 B]
Fetched 9361 kB in 2s (3463 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
snapcraft is already the newest version (2.33).
The following packages were automatically installed and are no longer required:
cmake cmake-data cmake-extras git golang golang-1.6 golang-1.6-doc golang-1.6-go golang-1.6-race-detector-runtime golang-1.6-src golang-doc golang-go golang-race-detector-runtime golang-src libcurl3 libjsoncpp1 pkg-config
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
Could not find snap/snapcraft.yaml. Are you sure you are in the right directory?
To start a new project, use `snapcraft init`
Stopping local:snapcraft-project
Traceback (most recent call last):
File "/snap/snapcraft/349/bin/snapcraft", line 11, in <module>
load_entry_point('snapcraft==2.33', 'console_scripts', 'snapcraft')()
File "/snap/snapcraft/349/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 565, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/snap/snapcraft/349/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2631, in load_entry_point
return ep.load()
File "/snap/snapcraft/349/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2291, in load
return self.resolve()
File "/snap/snapcraft/349/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2297, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/snap/snapcraft/349/lib/python3.6/site-packages/snapcraft/cli/__main__.py", line 19, in <module>
run(prog_name='snapcraft')
File "/snap/snapcraft/349/lib/python3.6/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/snap/snapcraft/349/lib/python3.6/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/snap/snapcraft/349/lib/python3.6/site-packages/click/core.py", line 1043, in invoke
return Command.invoke(self, ctx)
File "/snap/snapcraft/349/lib/python3.6/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/snap/snapcraft/349/lib/python3.6/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/snap/snapcraft/349/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/snap/snapcraft/349/lib/python3.6/site-packages/snapcraft/cli/__init__.py", line 102, in run
ctx.forward(lifecyclecli.commands['snap'])
File "/snap/snapcraft/349/lib/python3.6/site-packages/click/core.py", line 553, in forward
return self.invoke(cmd, **kwargs)
File "/snap/snapcraft/349/lib/python3.6/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/snap/snapcraft/349/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 138, in snap
lifecycle.containerbuild('snap', project_options, output, directory)
File "/snap/snapcraft/349/lib/python3.6/site-packages/snapcraft/internal/lifecycle.py", line 343, in containerbuild
metadata=config.get_metadata()).execute(step, args)
File "/snap/snapcraft/349/lib/python3.6/site-packages/snapcraft/internal/lxd.py", line 228, in execute
super().execute(step, args)
File "/snap/snapcraft/349/lib/python3.6/site-packages/snapcraft/internal/lxd.py", line 140, in execute
raise e
File "/snap/snapcraft/349/lib/python3.6/site-packages/snapcraft/internal/lxd.py", line 134, in execute
self._container_run(command, cwd=self._project_folder)
File "/snap/snapcraft/349/lib/python3.6/site-packages/snapcraft/internal/lxd.py", line 89, in _container_run
check_call(['lxc', 'exec', self._container_name, '--'] + cmd)
File "/snap/snapcraft/349/usr/lib/python3.6/subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['lxc', 'exec', 'local:snapcraft-project', '--', 'bash', '-c', 'cd /root/build_project; snapcraft snap --output project_2017.0.0_amd64.snap']' returned non-zero exit status 1.