If you need to use a new feature of snapd
as soon as it is available, but
before it is supported by the validation mechanisms in Snapcraft, you have the
option of using the passthrough feature of snapcraft.yaml
to specify the
in-development feature you need.
Snapcraft can accept the passthrough
keyword in two places in the
snapcraft.yaml
file. It can be used at the top-level scope to access new
top-level features, and also at the application scope to access new
application-level features. Where either or these locations are used, they are
referred to as the target scope.
The passthrough
keyword defines a map whose keywords and values are copied
directly into the corresponding scope in the snap.yaml
description that
snapd
uses.
Although Snapcraft does not know about in-development features, it performs some checks to prevent accidental conflicts or unexpected behaviour as a result of using passthroughs.
snap.yaml
since the
option may be defined in a way that is not yet understood by Snapcraft.Files using in-development features will need to be updated when those features become supported by Snapcraft.
In the following example, the passthrough
keyword is used at the top-level
scope to access two new, hypothetical, top-level features:
name: foo
passthrough:
confinement: next-generation
planet: saturn
This example enables the usage of a new value for the existing
snapcraft-yaml-confinement
keyword. It also enables an entirely new
planet
keyword to be used, along with a new value.
The following example shows the use of the keyword to access a new application-level feature:
apps:
foo:
command: foo
passthrough:
daemon: complex
In this case, a passthrough is used within the scope of the app foo
to set
the existing daemon
keyword to a value of complex
.
Last updated 1 year, 3 months ago.