Snapcraft corner: Staying on track

by Igor Ljubuncic on 27 August 2020

Snapcraft channels and, consequently, tracks are an important, highly useful element of the snap ecosystem. Tracks enable snap developers to publish multiple supported releases of their application under the same snap name. All snaps must have a default track – called latest, but there can be many others, giving both developers flexibility in how they release their applications to end users.

So far, track management was only possible through the Snap Store Web interface, which we have extensively reviewed last week. Now, you can view tracks, and very shortly, you will also be able set the default track using the snapcraft command line. We wanted to use this opportunity to showcase this upcoming set of features.

Ready, snap, set

The first thing you may want to do is check the availability of existing tracks for a given snaps. This can be done using the snapcraft list-tracks command (snapcraft 4.2 onwards), for instance:

snapcraft list-tracks node
Name    Status    Creation-Date         Version-Pattern
latest  active    -                     -
6       active    2018-02-27T13:25:05Z  -
8       active    2018-02-27T13:26:02Z  -
9       active    2018-02-27T13:26:08Z  -
10      active    2018-02-27T13:26:19Z  -
11      active    2018-10-31T16:25:48Z  -
12      default   2019-04-26T13:15:26Z  -
13      active    2019-10-18T13:34:01Z  -
14      active    2020-04-23T10:45:32Z  -

Now, as a publisher, if you want to change the default track of your application (snapcraft 4.3 onwards), you can also accomplish this on the command line – the specified default track must already exist, though.

snapcraft set-default-track “snap” “track”
snapcraft set-default-track kompozer legacy
Default track for 'kompozer' set to 'legacy'.

This can be quite useful if you’re managing multiple (supported) releases of your applications, or if you want to automate the functionality through a CI/CD system. Furthermore, publishers with a large number of snaps should also find this of value.

Summary

Snapcraft is constantly gaining new capabilities, designed to simplify and accelerate the process of snap publication. The elegance of the tool is that it provides both application development and Snap Store features, allowing you to accomplish a significant portion of your snap journey right there, in the terminal window. Default tracks are just the latest example. More good things are coming, so stay tuned. Meanwhile, if you have any requests or suggestions on what snapcraft ought to do, please join our forum for a discussion.

Photo by Borna Bevanda on Unsplash.

Newsletter Signup

Related posts

How to make snaps and configuration management tools work together

In environments with large numbers of client machines, configuration management tools are often used to simplify and standardize the target state of each host in a seamless, automated and consistent manner. Software like CFEngine, Chef, Ansible, and others offer a high degree of granular control over software packaging and system configur […]

Stepping Down Gracefully

The Snap Store has been designed to enable upstream developers and enthusiastic community contributors to publish snaps. As with most Linux packaging solutions, the wider community are often responsible for starting and maintaining software packages. This is a double-edged sword, especially for humans with limited life spans and other shi […]

The Expandables – snapcraft extensions and the secret code

If you’re a snap developer, you know that snap development is terribly easy. Or rather complex and difficult. Depending on your application code and requirements, it can take a lot of effort putting together the snapcraft.yaml file from which you will build your snap. One of our goals is to make snap development practically easier […]