Snap fails to build for store because of dirty builds

My snap builds fine with a clean build, but the store tries to build a non clean version it looks like from the logs.

Can I force clean builds?

For more details, my snap fails to build unless clean because of this issue on snapcraft: https://bugs.launchpad.net/snapcraft/+bug/1861638

The snap with the issue is: https://snapcraft.io/joinmarket

When you say the store, do you mean build.snapcraft.io? If so, that always performs builds in a clean environment. Can you link to a build log that shows the issue?

Yeah, I mean build.snapcraft.io. I wasn’t sure which category was right for my issue.

It seems the build is using a build artifact from a previous build. Maybe I’m missing something. Locally, if I do a snapcraft clean and then snapcraft I don’t get any errors and the build produces a working snap.

Here is the build link and the error I’m seeing. https://build.snapcraft.io/user/dmp1ce/joinmarket-clientserver/868774

Fetched 0 B in 0s (0 B/s)
Updating pull step for joinmarket (source changed)
Obtaining file:///build/joinmarket/jmbase (from -r /build/joinmarket/parts/joinmarket/build/requirements/base.txt (line 1))
The file ./parts/joinmarket/python-packages/joinmarketbase-0.6.1.zip exists. (i)gnore, (w)ipe, (b)ackup, (a)bort ERROR: Exception:
Traceback (most recent call last):
  File "/build/joinmarket/parts/joinmarket/install/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 186, in _main
    status = self.run(options, args)
  File "/build/joinmarket/parts/joinmarket/install/lib/python3.6/site-packages/pip/_internal/commands/download.py", line 135, in run
    resolver.resolve(requirement_set)
  File "/build/joinmarket/parts/joinmarket/install/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 177, in resolve
    discovered_reqs.extend(self._resolve_one(requirement_set, req))
  File "/build/joinmarket/parts/joinmarket/install/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 333, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/build/joinmarket/parts/joinmarket/install/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 265, in _get_abstract_dist_for
    return self.preparer.prepare_editable_requirement(req)
  File "/build/joinmarket/parts/joinmarket/install/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 559, in prepare_editable_requirement
    req.archive(self.download_dir)
  File "/build/joinmarket/parts/joinmarket/install/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 721, in archive
    display_path(archive_path), ('i', 'w', 'b', 'a'))
  File "/build/joinmarket/parts/joinmarket/install/lib/python3.6/site-packages/pip/_internal/utils/misc.py", line 223, in ask_path_exists
    return ask(message, options)
  File "/build/joinmarket/parts/joinmarket/install/lib/python3.6/site-packages/pip/_internal/utils/misc.py", line 241, in ask
    response = input(message)
EOFError: EOF when reading a line
Failed to run '/build/joinmarket/stage/usr/bin/python3 -m pip download --disable-pip-version-check --dest /build/joinmarket/parts/joinmarket/python-packages --requirement /build/joinmarket/parts/joinmarket/build/requirements/gui.txt': Exited with code 2.
Build failed
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/lpbuildd/target/build_snap.py", line 266, in run
    self.build()
  File "/usr/lib/python2.7/dist-packages/lpbuildd/target/build_snap.py", line 255, in build
    env=env)
  File "/usr/lib/python2.7/dist-packages/lpbuildd/target/build_snap.py", line 102, in run_build_command
    return self.backend.run(args, env=full_env, **kwargs)
  File "/usr/lib/python2.7/dist-packages/lpbuildd/target/lxd.py", line 536, in run
    subprocess.check_call(cmd, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
    raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '['lxc', 'exec', 'lp-bionic-amd64', '--env', 'LANG=C.UTF-8', '--env', 'SHELL=/bin/sh', '--env', 'SNAPCRAFT_BUILD_INFO=1', '--env', 'SNAPCRAFT_IMAGE_INFO={"build-request-id": "lp-55096213", "build-request-timestamp": "2020-03-14T23:38:19Z", "build_url": "https://launchpad.net/~build.snapcraft.io/+snap/7761c8a92f397cf8daaf77d86bf3d47f/+build/868774"}', '--env', 'SNAPCRAFT_BUILD_ENVIRONMENT=host', '--env', 'http_proxy=http://10.10.10.1:8222/', '--env', 'https_proxy=http://10.10.10.1:8222/', '--env', 'GIT_PROXY_COMMAND=/usr/local/bin/snap-git-proxy', '--', '/bin/sh', '-c', 'cd /build/joinmarket && linux64 snapcraft']' returned non-zero exit status 2
Revoking proxy token...
RUN: /usr/share/launchpad-buildd/bin/in-target scan-for-processes --backend=lxd --series=bionic --arch=amd64 SNAPBUILD-868774
Scanning for processes to kill in build SNAPBUILD-868774

The main relevant difference between what build.snapcraft.io does and what running plain snapcraft does it that build.snapcraft.io runs the pull phase separately before the rest of the build. Does running snapcraft pull before snapcraft reproduce the issue locally?

snapcraft pull works. snapcraft prompts with the following:

Updating pull step for joinmarket-requirements (source changed)
Obtaining file:///root/project/jmbase (from -r /root/parts/joinmarket-requirements/build/requirements/base.txt (line 1))
The file /root/parts/joinmarket-requirements/python-packages/joinmarketbase-0.6.1.zip exists. (i)gnore, (w)ipe, (b)ackup, (a)bort

Obviously, the automated build cannot accept input. Is there a way to suppress the prompt?