core snap release mechanics

3 minute read Published:

See how the core snap is released when it's time to do so

Core snap release mechanics

The core snap release is still partially manual. Ideally we’d have some tools but this is also too precious to do with awk/sed and not yet directly supported by snapcraft (the all-architectures aspect). As such we still do it by hand. Due to exceptional circumstances I will now release 2.30 core snap for you.

First of all you need snapcraft and you need to be authenticated. You also need to be a co-maintainer of the core snap. I happen to fit all the requirements so let’s carry on. You can use snapcraft whoami to check that you are logged in. You can use the login or logout sub-commands as necessary.

The channel map

Using the snapcraft status <snapname> command, query for the channel map that displays each channel, architecture and revision. The operation we want to do is to publish the revision from candidate channel to the stable channel, for each architecture.

zyga@fyke:~$ snapcraft status core
Track    Arch     Channel    Version                 Revision
latest   amd64    stable     16-2.29.4.2             3604
                  candidate  16-2.30                 3748
                  beta       16-2.30                 3748
                  edge       16-2.30+git476.f91a849  3845
         arm64    stable     16-2.29.4.2             3607
                  candidate  16-2.30                 3751
                  beta       16-2.30                 3751
                  edge       16-2.30+git476.f91a849  3846
         armhf    stable     16-2.29.4.2             3606
                  candidate  16-2.30                 3750
                  beta       16-2.30                 3750
                  edge       16-2.30+git476.f91a849  3847
         i386     stable     16-2.29.4.2             3602
                  candidate  16-2.30                 3749
                  beta       16-2.30                 3749
                  edge       16-2.30+git476.f91a849  3844
         ppc64el  stable     16-2.29.4.2             3605
                  candidate  16-2.30                 3747
                  beta       16-2.30                 3747
                  edge       16-2.30+git476.f91a849  3843
         s390x    stable     16-2.29.4.2             3603
                  candidate  16-2.30                 3746
                  beta       16-2.30                 3746
                  edge       16-2.30+git476.f91a849  3842

Release voodoo

Let’s start with the amd64 architecture. The candidate channel has revision 3748 and the version string 16-2.30. This looks all right. We can use snapcraft release <snapname> <revision> <channel> to take an existing revision and publish it elsewhere. For amd64 the command would be snapcraft release core 3748 stable. Repeating the pattern for all architectures we get:

snapcraft release core 3748 stable
snapcraft release core 3751 stable
snapcraft release core 3750 stable
snapcraft release core 3749 stable
snapcraft release core 3747 stable
snapcraft release core 3746 stable

At each time snapcraft is nice enough to inform us of what actually happened by displaying the channel map for that particular architecture. In my case I saw:

zyga@fyke:~$ snapcraft release core 3748 stable
Track    Arch    Channel    Version                 Revision
latest   amd64   stable     16-2.30                 3748
                 candidate  16-2.30                 3748
                 beta       16-2.30                 3748
                 edge       16-2.30+git476.f91a849  3845
zyga@fyke:~$ snapcraft release core 3751 stable
Track    Arch    Channel    Version                 Revision
latest   arm64   stable     16-2.30                 3751
                 candidate  16-2.30                 3751
                 beta       16-2.30                 3751
                 edge       16-2.30+git476.f91a849  3846
zyga@fyke:~$ snapcraft release core 3750 stable
Track    Arch    Channel    Version                 Revision
latest   armhf   stable     16-2.30                 3750
                 candidate  16-2.30                 3750
                 beta       16-2.30                 3750
                 edge       16-2.30+git476.f91a849  3847
zyga@fyke:~$ snapcraft release core 3749 stable
Track    Arch    Channel    Version                 Revision
latest   i386    stable     16-2.30                 3749
                 candidate  16-2.30                 3749
                 beta       16-2.30                 3749
                 edge       16-2.30+git476.f91a849  3844
zyga@fyke:~$ snapcraft release core 3747 stable
Track    Arch     Channel    Version                 Revision
latest   ppc64el  stable     16-2.30                 3747
                  candidate  16-2.30                 3747
                  beta       16-2.30                 3747
                  edge       16-2.30+git476.f91a849  3843
zyga@fyke:~$ snapcraft release core 3746 stable
Track    Arch    Channel    Version                 Revision
latest   s390x   stable     16-2.30                 3746
                 candidate  16-2.30                 3746
                 beta       16-2.30                 3746
                 edge       16-2.30+git476.f91a849  3842

Architectural conundrum

You may wonder (as I did, before actually running the commands above) how this behaves correctly since we never told snapcraft that a particular revision is for a particular architecture. The magic seems to happen under the hood where the store knows that, say, revision 3748 is for the amd64 architecture and that 3746 is for s390x. Personally I find this a bit confusing but this is the way it works (for now).

So, having executed those commands everything is instantly live and machines start to refresh to the shiny new core snap automatically. Enjoy and happy new year!

comments powered by Disqus