Using the gated/refresh-control of a set of snaps was the solution to be able to control and keep an consistent environment of external snaps in the Ubuntu Core/Snappy ecosystem.
This feature works on existing devices but not during the initial creation of the Ubuntu Core image.
I experience issues during creation of an initial Ubuntu Core/Snaps images were it used the wrong revision of the external snaps.
Instead the ubuntu-image tool uses the latest revision of these gated snaps.
Below shows an example using “ubuntu-image” utility with the gated/refresh-control feature.
###########################################################################
# Informational
$ ubuntu-image --version
ubuntu-image 1.7+snap1
$ snap --version
snap 2.42
snapd 2.42
series 16
ubuntu 18.04
kernel 4.15.0-54-generic
# Apply gated/refresh-control
$ snapcraft validate <snap-name> core18=1220 pc-kernel=300 snapd=4990 ...
# Create Ubuntu Core Image.
$ ubuntu-image --hooks-directory setup-hooks -O img-export <name>.model
# Snaps within created core image
$ snap list
Name Version Rev Tracking Publisher Notes
<snap-name> 1.0 798 stable <Example> -
core18 20191010 1223 stable canonicalâś“ base
pc-kernel 4.4.0-165.193 304 stable canonicalâś“ kernel
snapd 2.42 4992 stable canonicalâś“ snapd
The gated snaps are not considered during creation of the Ubuntu Core image.
$ snapcraft gated <snap-name>
Name Revision Required Approved
core18 1220 True 2019-10-01T10:00:00Z
snapd 4990 True 2019-10-01T10:00:00Z
pc-kernel 300 True 2019-10-01T10:00:00Z
###########################################################################
I’m aware that is possible fetch the gated snaps from snapstore API and then download the specific revision of snaps then using the “–snap” <local.snap> option in ubuntu-image which then allows me to get the expected result.
Trigger an refresh does revert to the gated snaps and schedules multiply restarts on the devices. NOTE: “core18” and “pc-kernel” snaps does not bundle the reboots during refresh which then results in 2 reboots but that’s outside the scope of this topic.
Not sure if this is the correct place/tag/project to report this but since the feature originate from snapcraft I assume this is within the interest of snapcraft/snapstore to have an toolchain that consider the gated snaps while creating the Ubuntu Core image.