Introduction
The snapcraft command line tool has a release
command which has the following syntax,
$ snapcraft release <snap-name> <snap-revision> <channel>
Which allows to release revision <snap-revision>
of <snap-name>
to the desired <channel>
. This is somewhat straightforward and simple to use. Alas, it becomes inconvenient when working with multiple architectures as such each snapcraft push
to the Snap Store will be represented by a unique revision, so for the case of wanting to release a snap represented conceptually by a set multiple revisions we would need to do something like,
$ snapcraft release <snap-name> <snap-revision-arch-x> <channel>
$ snapcraft release <snap-name> <snap-revision-arch-y> <channel>
$ snapcraft release <snap-name> <snap-revision-arch-z> <channel>
Proposal
For the simple case of migrating a batch of revisions for a snap from one channel risk to another the proposal is to introduce a new command,
$ snapcraft promote <snap-name> <channel> [--to <to-channel>]
Where <channel>
is the channel to promote from up to the next channel risk level. The user will have to acknowledge the promotion by being able to review the version string, timestamps of each revision and the revisions that will be released. Upon promoting, <channel>
is closed and the user is notified.
The display of timestamps for revisions serves as a conceptual build-set a human can inspect to validate that releasing those revisions is indeed the desired intention.
The query of what to release is done to minimize any potential race conditions with regards to status changes of the channel map.
This orchestration of the promotion is a pure client side implementation. A log of changes will be recorded for the user to inspect.
This implementation does not cover anything for non-released snaps.
User stories
The baseline is that the user has a snap called lego-bricks
registered on the store and has releases to edge
for multiple architectures, such that,
$ snapcraft status lego-bricks
Track Arch Channel Version Revision
latest amd64 - - -
- - -
- - -
edge 1.0 1
arm64 - - -
- - -
- - -
edge 1.0 2
i386 - - -
- - -
- - -
edge 1.0 3
ppcel64 - - -
- - -
- - -
edge 1.0 4
armhf - - -
- - -
- - -
edge 1.0 5
Promote from edge to beta, answer yes
Considering the original status map,
$ snapcraft promote lego-bricks edge
The status map upon completion will look like:
Track Arch Channel Version Revision Release Timestamp
latest amd64 stable - -
candidate - -
beta 1.0 1 2018-06-14T11:06:04.311655
edge ^ ^
arm64 stable - -
candidate - -
beta 1.0 2 2018-06-14T11:16:04.311655
edge ^ ^
i386 stable - -
candidate - -
beta 1.0 3 2018-06-14T11:08:04.311655
edge ^ ^
ppcel64 stable - -
candidate - -
beta 1.0 4 2018-06-14T11:10:04.311655
edge ^ ^
armhf stable - -
candidate - -
beta 1.0 5 2018-06-14T11:05:04.311655
edge ^ ^
Proceed? [yN] y
The beta channel is now open.
The edge channel is now closed.
Promote from edge to beta, answer no
Considering the original status map, the user notices something is off with armhf
and cancels the promotion,
$ snapcraft promote lego-bricks edge
The status map upon completion will look like:
Track Arch Channel Version Revision Release Timestamp
latest amd64 stable - -
candidate - -
beta 1.0 1 2018-06-14T11:06:04.311655
edge ^ ^
arm64 stable - -
candidate - -
beta 1.0 2 2018-06-14T11:16:04.311655
edge ^ ^
i386 stable - -
candidate - -
beta 1.0 3 2018-06-14T11:08:04.311655
edge ^ ^
ppcel64 stable - -
candidate - -
beta 1.0 4 2018-06-14T11:10:04.311655
edge ^ ^
armhf stable - -
candidate - -
beta 1.0 10 2017-06-14T11:05:04.311655
edge ^ ^
Proceed? [yN] n
No changes to the release channels have been made.
From beta to candidate, beta closed, answer yes
Considering the original status map,
$ snapcraft promote lego-bricks edge --to candidate
The status map upon completion will look like:
Track Arch Channel Version Revision Release Timestamp
latest amd64 stable - -
candidate 1.0 1 2018-06-14T11:06:04.311655
beta ^ ^
edge ^ ^
arm64 stable - -
candidate 1.0 2 2018-06-14T11:16:04.311655
beta ^ ^
edge ^ ^
i386 stable - -
candidate 1.0 3 2018-06-14T11:08:04.311655
beta ^ ^
edge ^ ^
ppcel64 stable - -
candidate 1.0 4 2018-06-14T11:10:04.311655
beta ^ ^
edge ^ ^
armhf stable - -
canditate 1.0 5 2018-06-14T11:05:04.311655
beta ^ ^
edge ^ ^
Proceed? [yN] y
The candidate channel is now open.
The edge channel is now closed.
From beta to candidate, beta open, answer yes
Considering the original status map, and a prior release to beta,
$ snapcraft promote lego-bricks edge --to candidate
The status map upon completion will look like:
Track Arch Channel Version Revision Release Timestamp
latest amd64 stable - -
candidate 1.0 1 2018-06-14T11:06:04.311655
beta ^ ^
edge ^ ^
arm64 stable - -
candidate 1.0 2 2018-06-14T11:16:04.311655
beta ^ ^
edge ^ ^
i386 stable - -
candidate 1.0 3 2018-06-14T11:08:04.311655
beta ^ ^
edge ^ ^
ppcel64 stable - -
candidate 1.0 4 2018-06-14T11:10:04.311655
beta ^ ^
edge ^ ^
armhf stable - -
canditate 1.0 5 2018-06-14T11:05:04.311655
beta ^ ^
edge ^ ^
Proceed? [yN] y
The candidate channel is now open.
The edge channel is now closed.
The beta channel is now closed.
Promote from edge to beta, answer yes, errors on close
Considering the original status map, and a fictional case of a user not being able to close channels,
$ snapcraft promote lego-bricks edge
The status map upon completion will look like:
Track Arch Channel Version Revision Release Timestamp
latest amd64 stable - -
candidate - -
beta 1.0 1 2018-06-14T11:06:04.311655
edge ^ ^
arm64 stable - -
candidate - -
beta 1.0 2 2018-06-14T11:16:04.311655
edge ^ ^
i386 stable - -
candidate - -
beta 1.0 3 2018-06-14T11:08:04.311655
edge ^ ^
ppcel64 stable - -
candidate - -
beta 1.0 4 2018-06-14T11:10:04.311655
edge ^ ^
armhf stable - -
candidate - -
beta 1.0 5 2018-06-14T11:05:04.311655
edge ^ ^
Proceed? [yN] y
The beta channel is now open.
An error occurred when trying to close edge: <store-error>
The full transcript of actions can be inspected at /tmp/snapcraft-promote-lego-bricks-4534231.log
$ cat /tmp/snapcraft-promote-lego-bricks-4534231.log
<timestamp> do release lego-bricks 5 beta
<timestamp> success release lego-bricks 5 beta
<timestamp> do release lego-bricks 4 beta
<timestamp> success release lego-bricks 4 beta
<timestamp> do release lego-bricks 3 beta
<timestamp> success release lego-bricks 3 beta
<timestamp> do release lego-bricks 2 beta
<timestamp> success release lego-bricks 2 beta
<timestamp> do release lego-bricks 1 beta
<timestamp> success release lego-bricks 1 beta
<timestamp> do close lego-bricks
<timestamp> fail close lego-bricks: you do not have permissions to close channels
Promote beta to candidate, beta closed
Considering the original status map,
$ snapcraft promote lego-bricks beta
Cannot promote lego-bricks from beta: the beta channel is closed.
Run `snapcraft status lego-bricks` to view the current state of
the channel map.
Promote beta to candidate, grade devmode
Considering the original status map, where a previous promotion of edge took place,
$ snapcraft promote lego-bricks beta
Cannot promote lego-bricks from beta: revision 3 and 4 have grade set to devmode.
Learn more about using grade at <snapcraft-grade-docs>.
Opens
- Should we allow promotion of branches? What if the branches are not available on all architectures?
- Should we allow for
--to
? If so, what is the correct behavior with regards to channel closing and should it allow switching tracks?
Work items
- snapcraft: Implement user stories
- Snap Store: Verify and if not provide timestamp of when a revision was released in the Snap Store Developer APIs.
Forward looking
- Snap Store: Add support for transactional operations to execute in batch.