On Travis (not a real vte), releasing to a branch name during snapcraft push prints a stacktrace

Bug #1761127 reported by Didier Roche-Tolomelli
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
High
Kyle Fazzari

Bug Description

On Travis CI only (working locally, in a real terminal):

Running snapcraft docker image:

$ snapcraft push *.snap --release=edge/branchname
-> stacktrace is printed and snapcraft exit. Note that doesn't happen with --release=edge for instance though.

Example from https://travis-ci.org/ubuntu/communitheme-snap-helpers/builds/362055817:
Preparing to push '/home/travis/build/ubuntu/communitheme-snap-helpers/communitheme_0.1_amd64.snap' to the store.
Using local configuration ('.snapcraft/snapcraft.cfg'), changes will not be persisted.
Pushing communitheme_0.1_amd64.snap [] 100%
Processing...|
Ready to release!
Revision 4 of 'communitheme' created.
Using local configuration ('.snapcraft/snapcraft.cfg'), changes will not be persisted.
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/snapcraft/cli/_errors.py", line 55, in exception_handler
    echo.error(str(exception))
  File "/usr/lib/python3/dist-packages/snapcraft/internal/errors.py", line 34, in __str__
    return self.fmt.format([], **self.__dict__)
KeyError: '"status"'
Original exception was:
Traceback (most recent call last):
  File "/usr/bin/snapcraft", line 9, in <module>
    load_entry_point('snapcraft==2.40', 'console_scripts', 'snapcraft')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 542, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2569, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2229, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2235, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python3/dist-packages/snapcraft/cli/__main__.py", line 43, in <module>
    run(prog_name='snapcraft')
  File "/usr/lib/python3/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/snapcraft/cli/store.py", line 149, in push
    snapcraft.push(snap_file, channel_list)
  File "/usr/lib/python3/dist-packages/snapcraft/_store.py", line 514, in push
    release(snap_name, result['revision'], release_channels)
  File "/usr/lib/python3/dist-packages/snapcraft/_store.py", line 610, in release
    channels = store.release(snap_name, revision, release_channels)
  File "/usr/lib/python3/dist-packages/snapcraft/storeapi/_store_client.py", line 163, in release
    self.sca.snap_release, snap_name, revision, channels)
  File "/usr/lib/python3/dist-packages/snapcraft/storeapi/_store_client.py", line 85, in _refresh_if_necessary
    return func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/snapcraft/storeapi/_sca_client.py", line 176, in snap_release
    raise errors.StoreReleaseError(data['name'], response)
snapcraft.storeapi.errors.StoreReleaseError: <exception str() failed>

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

EDIT: the stacktrace still happens with a valid --release=risk/branch name (working with snapcraft release command): https://travis-ci.org/ubuntu/communitheme-snap-helpers/builds/362103394.

The source is thus probably something else?

description: updated
summary: - invalid branchname release while doing snapcraft push print a stacktrace
+ On Travis (not a real vte), releasing to a branch name during snapcraft
+ push prints a stacktrace
description: updated
description: updated
Revision history for this message
Kyle Fazzari (kyrofa) wrote :

This is due to the credentials from `snapcraft enable-ci travis` being limited to the `edge` channel. It seems the store is returning an error message, but it's formatted differently from others so we're not handling it properly.

The solution for you is to use `snapcraft export-login` so you can attenuate your own credentials, and use `snapcraft login --with <exported>` to use them. We'll get this backtrace fixed ASAP.

Changed in snapcraft:
status: New → Triaged
importance: Undecided → High
Revision history for this message
Kyle Fazzari (kyrofa) wrote :
Changed in snapcraft:
status: Triaged → In Progress
assignee: nobody → Kyle Fazzari (kyrofa)
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Thanks for the quick fix and helpful support as usual! I've used the env variable credential approach with the needed rights as you suggested to me. Thanks for guiding me :)

Kyle Fazzari (kyrofa)
Changed in snapcraft:
status: In Progress → Fix Committed
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.