[remote-build] source-type 'zip' aborts with KeyError

Bug #1898877 reported by glancr team
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
Low
Chris Patterson

Bug Description

I have a snapcraft.yaml where multiple parts have their source as ZIP files on remote URLs. As these do not have a .zip suffix, snapcraft requires `source-type: zip` as a hint.

The snap builds fine locally or on launchpad builders. However, doing a remote-build fails with:

Using snapcraft 4.3 both on macOS 10.15.7 and Ubuntu 20.04 LTS

```
Sorry, an error occurred in Snapcraft:
'zip'
Traceback (most recent call last):
  File "/usr/local/bin/snapcraft", line 8, in <module>
    sys.exit(run())
  File "/usr/local/Cellar/snapcraft/4.3/libexec/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/Cellar/snapcraft/4.3/libexec/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/Cellar/snapcraft/4.3/libexec/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/Cellar/snapcraft/4.3/libexec/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/Cellar/snapcraft/4.3/libexec/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/snapcraft/4.3/libexec/lib/python3.8/site-packages/snapcraft/cli/remote.py", line 163, in remote_build
    _start_build(
  File "/usr/local/Cellar/snapcraft/4.3/libexec/lib/python3.8/site-packages/snapcraft/cli/remote.py", line 194, in _start_build
    repo_dir = wt.prepare_repository()
  File "/usr/local/Cellar/snapcraft/4.3/libexec/lib/python3.8/site-packages/snapcraft/internal/remote_build/_worktree.py", line 326, in prepare_repository
    part_config = self._process_part_sources(part_name, part_config)
  File "/usr/local/Cellar/snapcraft/4.3/libexec/lib/python3.8/site-packages/snapcraft/internal/remote_build/_worktree.py", line 245, in _process_part_sources
    part_config["source"] = self._pull_source(part_name, source)
  File "/usr/local/Cellar/snapcraft/4.3/libexec/lib/python3.8/site-packages/snapcraft/internal/remote_build/_worktree.py", line 163, in _pull_source
    source_handler = self._get_part_source_handler(part_name, source, download_dir)
  File "/usr/local/Cellar/snapcraft/4.3/libexec/lib/python3.8/site-packages/snapcraft/internal/remote_build/_worktree.py", line 92, in _get_part_source_handler
    handler_class = snapcraft.internal.sources.get_source_handler(
  File "/usr/local/Cellar/snapcraft/4.3/libexec/lib/python3.8/site-packages/snapcraft/internal/sources/__init__.py", line 170, in get_source_handler
    return _source_handler[source_type]
KeyError: 'zip'
```

Building the same snapcraft.yaml through remote-build worked pre-snapcraft 4.3.

Tags: remote-build
Changed in snapcraft:
assignee: nobody → Chris Patterson (cjp256)
status: New → Fix Committed
importance: Undecided → Low
Changed in snapcraft:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.