linuxreleasechannelsnapcraft

How to create a custom Snapcraft channel?


I can only even find a couple places in the docs that suggests this is possible, but it clearly is possible.

Moving a snap between channels helps to manage a user’s expectations in any trade-off between stability in the stable channel, and cutting edge features in the edge channel (as an arbitrary example). But its also a useful technique for beta testing, or for when a snap needs to revert to a previous revision. -- https://snapcraft.io/docs/release-management


Take for example kubectl (see below) which has a channel for each old minor version, in addition to the default latest channel.

We're about to release a new version which will not be compatible with Ubuntu 16.04 and below, and we'd like to make the old version available to those users. How can we achieve that?

❯ snap info kubectl
name:      kubectl
summary:   Command line client for controlling a Kubernetes cluster.
publisher: Canonical✓
store-url: https://snapcraft.io/kubectl
contact:   https://www.ubuntu.com/kubernetes
license:   Apache-2.0
description: [...]
snap-id: ZgG2URycDgvxSVskfoZxn44uaRMw0iwe
channels:
  latest/stable:    1.21.1         2021-05-14 (1976) 11MB classic
  latest/candidate: 1.21.1         2021-05-14 (1976) 11MB classic
  latest/beta:      1.21.1         2021-05-14 (1976) 11MB classic
  latest/edge:      1.21.1         2021-05-14 (1976) 11MB classic
  1.22/stable:      –                                     
  1.22/candidate:   –                                     
  1.22/beta:        –                                     
  1.22/edge:        1.22.0-alpha.1 2021-04-29 (1945) 11MB classic
  1.21/stable:      1.21.1         2021-05-13 (1976) 11MB classic
  1.21/candidate:   1.21.1         2021-05-13 (1976) 11MB classic
  1.21/beta:        1.21.1         2021-05-13 (1976) 11MB classic
  1.21/edge:        1.21.1         2021-05-13 (1976) 11MB classic
  1.20/stable:      1.20.7         2021-05-13 (1949)  9MB classic
  1.20/candidate:   1.20.7         2021-05-13 (1949)  9MB classic
  1.20/beta:        1.20.7         2021-05-13 (1949)  9MB classic
  1.20/edge:        1.20.7         2021-05-13 (1949)  9MB classic
  1.19/stable:      1.19.11        2021-05-13 (1947) 10MB classic
  1.19/candidate:   1.19.11        2021-05-13 (1947) 10MB classic
  1.19/beta:        1.19.11        2021-05-13 (1947) 10MB classic
  1.19/edge:        1.19.11        2021-05-13 (1947) 10MB classic
  1.18/stable:      1.18.19        2021-05-13 (1951) 10MB classic
  1.18/candidate:   1.18.19        2021-05-13 (1951) 10MB classic
  1.18/beta:        1.18.19        2021-05-13 (1951) 10MB classic
  1.18/edge:        1.18.19        2021-05-13 (1951) 10MB classic
  1.17/stable:      1.17.17        2021-01-15 (1777) 10MB classic
  1.17/candidate:   1.17.17        2021-01-15 (1777) 10MB classic
  1.17/beta:        1.17.17        2021-01-15 (1777) 10MB classic
  1.17/edge:        1.17.17        2021-01-15 (1777) 10MB classic
  1.16/stable:      1.16.15        2020-10-20 (1639) 10MB classic
  1.16/candidate:   1.16.15        2020-10-20 (1639) 10MB classic
  1.16/beta:        1.16.15        2020-10-20 (1639) 10MB classic
  1.16/edge:        1.16.15        2020-10-20 (1639) 10MB classic
  [...]

Solution

  • These are known as "Tracks". Each one has their own edge, beta, candidate, and stable channels.

    There is a process that requires you to request new tracks via the forum.snapcraft.io discourse. See https://snapcraft.io/docs/process-for-aliases-auto-connections-and-tracks for more details on the procedure.