Snapcraft.yaml schema

The following schema reflects all configuration keys available in snapcraft.yaml for core18, core20, core22, and core24.

Top-level directives

The top-level keys and values in snapcraft.yaml provide the snap build process, and the store, with the overarching details of a snap.

Top-level details include a snap’s name, version and description, alongside operational values such as its confinement level and supported architecture.

adopt-info

Type: string

Optional

Incorporate external metadata via the referenced part.

See Using external metadata for more details.

architectures

Type: list[object]

Optional

List of build and run architectures.

For more details, see Architectures.

assumes

Type: list[string]

Optional

A list of features that must be supported by the core in order for this snap to install. For example to make the snap only installable on certain recent version of snapd(like 2.38) you can specify:

assumes:
  - snapd2.38

Other potential values for assumes include:

  • common-data-dir: support for common data directory across revisions of a snap
  • snap-env: support for the “Environment:” feature in snap.yaml
  • command-chain: support for the “command-chain” feature for apps and hooks in snap.yaml
  • kernel-assets: support for kernel assets in gadget.yaml, such as to include volume content in the style $kernel:ref

base

Type: string

Optional

A snap of type base to be used as the execution environment for this snap. See Base snaps for further details.

This is mandatory unless the type parameter is set to either base, kernel, or snapd.

Values:

Core Result
bare Empty base snap, useful for fully statically linked snaps and testing.
core Ubuntu Core 16
core18 Ubuntu Core 18
core20 Ubuntu Core 20
core22 Ubuntu Core 22
core24 Ubuntu Core 24

build-base

Optional

Used to build a base snap when the base is unavailable or has yet to be bootstrapped. See Building a base snap for details.

Examples: 'core20', 'core22'

Requires that the type parameter is set to base.

compression

Type: string

Optional

Sets the compression type for the snap. Can be xz or lzo. Defaults to xz when not specified.

Snaps are compressed using xz data compression by default. This offers the optimal performance to compression ratio for the majority of snaps.

However, there are certain types of snap, such as large desktop applications, that can benefit from using LZO compression. Snaps compressed with lzo are slightly larger but can decompress quicker, reducing the time it takes for freshly installed or refreshed snaps to launch.

To specify lzo compression, set compression: lzo in your snap’s snapcraft.yaml and rebuild your snap, as shown in the following example:

name: test-snapcraft-lzo
base: core18
version: "0.1"
summary: Test LZO snap
description: Test LZO snap
grade: stable
confinement: strict

# this line enables LZO compression for the snap
compression: lzo

parts:
  my-part:
	plugin: nil

apps:
  lzo-things:
	command: bin/something

confinement

Type: enum

Optional

Determines if the snap should be restricted in access or not.

Possible values are strict (for no access outside of declared interfaces through plugs), devmode (for unrestricted access) or classic. For more information, refer to Confinement.

Examples: strict, or devmode

contact

Type: list[string] or string

Optional

Added in Snapcraft 5.0

Contact information for the snap’s authors, in the form of one or more URLs or email addresses.

Example: contact@example.com

description

Type: string

Required

Multi-line description of the snap.

A more in-depth look at what your snap does and who may find it most useful.

donation

Type: list[string] or string

Optional

Added in Snapcraft 5.0

A link or list of links to receive donations for the snap.

Example: https://patreon.com/<profile>

environment

Type: dict

Optional

A set of key-value pairs specifying assigning globally-accessible environment variables.

For each entry, the key is the name of the environment variable, and the value is its content.

Example: LD_LIBRARY_PATH: ${SNAP_LIBRARY_PATH}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}

epoch

type: integer

Optional

Controls when users receive a configuration-breaking application release.

Applications and their data formats are constantly evolving, and this requires applications to periodically break data compatibility with older versions. When this happens, applications and users often need to carefully manage data migration from one version to another, and this is where epochs can help. By default, snaps have an epoch of ‘0’. When a new version breaks data compatibility with this old version, incrementing the epoch in the new release stops those old users automatically refreshing to the new version.

See Snap epochs for further details.

grade

Type: enum

Optional

Defines the quality grade of the snap.

Can be either devel (i.e. a development version of the snap, so not to be published to the stable or candidate channels) or stable (i.e. a stable release or release candidate, which can be released to all channels).

A snap of type app (default) cannot be set to stable if the base is not on a stable channel.

Example: stable

hooks

Type: list[dict]

Optional

Hooks permit executable files to run within a snap’s confined environment when a certain action occurs.

By default, hooks run with no plugs. If a hook needs more privileges, you can use this top-level hooks attribute:

hooks: # Top-level YAML attribute, parallel to `apps`
  configure: # Hook name, corresponds to executable name
	plugs: [network] # Or any other plugs required by this hook

See Snapcraft hook support for more details.

issues

Type: list[string] or string

Added in Snapcraft 5.0

A link or list of links to report issues for the snap.

A list of links or addresses for reporting issues with the snap.

Example: [https://github.com/org/project/issues, contact@product.org]

icon

Type: string

Optional

Path to icon image that represents the snap in the snapcraft.io store pages and other graphical store fronts.

Note that the desktop menu does not use this icon. It uses the icon in the .desktop file of the application.

It is a relative path to a .png/.svg file from the source tree root. The recommended size is 256x256 pixels. Aspect ratio needs to be 1:1. Image size can vary from 40x40 to 512x512 px and the file size should not be larger than 256 KB.

Examples: _package_name_.svg, or snap/gui/logo.png

layout

Type: list[dict]

Optional

Layouts modify the execution environment of a strictly-confined snap.

With layouts, you can make elements in $SNAP , $SNAP_DATA , $SNAP_COMMON accessible from locations such as /usr , /var and /etc . This helps when using pre-compiled binaries and libraries that expect to find files and directories outside of locations referenced by $SNAP or $SNAP_DATA .

See Snap layouts for more details.

Example:

layout:
  /var/lib/foo:
	bind: $SNAP_DATA/var/lib/foo
  /usr/share/foo:
	bind: $SNAP/usr/share/foo
  /etc/foo.conf:
	bind-file: $SNAP_DATA/etc/foo.conf

license

Type: string

Optional

A license for the snap in the form of an SPDX expression.

In the legacy Snapcraft syntax (not using the base key), this key is only available through the passthrough key.

Currently, only SPDX 2.1 expressions are supported. A list of supported values is also available at snapd/licenses.go at master · snapcore/snapd.

For “or later” and “with exception” license styles refer to the Appendix V of the SPDX Specification 2.1.

Examples: GPL-3.0+, MIT, Proprietary

name

Type: string

Required

The identifying name of the snap.

It must start with an ASCII character and can only contain letters in lower case, numbers, and hyphens, and it can’t start or end with a hyphen. The name must be unique if you want to publish to the Snap Store.

Max length 40 characters.

For help on choosing a name and registering it on the Snap Store, see Registering your app name.

Example: my-awesome-app

package-repositories

Type: list[dict]

Optional

Adds package repositories as sources for build-packages and stage-packages, including those hosted on a PPA, the Personal Package Archive, which serves personally hosted non-standard packages.

See Snapcraft package repositories for more details.

Example:

package-repositories:
  - type: apt
	components: [main]
	suites: [xenial]
	key-id: 78E1918602959B9C59103100F1831DDAFC42E99D
	url: http://ppa.launchpad.net/snappy-dev/snapcraft-daily/ubuntu

passthrough

Type: type[object]

Optional

Attributes to passthrough to snap.yaml without validation from snapcraft.

See Using development features in snapcraft for more details.

plugs

Type: dict

Optional

Plugs and slots for an interface are assigned to apps and daemons on a per-app and per-daemon basis. Configuring plugs and slot attributes is done with the top-level plugs and slots keywords.

It is not recommended to define a top level plug or slot to implicitly assign it to all apps or daemons. Instead, the plug or slot should be defined for each app or daemon. If a plug or slot is defined at the top level and does not have any configuration, Snapcraft will warn that the plug or slot should be defined per-app or per-daemon.

These plugs apply to all apps and differs from apps.<app-name>.plugs in that the type is in a dict rather than a list format, :(colon) must be postfixed to the interface name and shouldn’t start with - (dash-space).

plugs.<plug-name>

Type: dict

Optional

A set of attributes for a plug.

Example: read attribute for the home interface.

plugs.<plug-name>.<attribute-name>

Type: string

Optional

Value of the attribute. Example: all for read attribute of the home interface.

slots

Type: dict

Optional

A set of slots that the snap provides, applied to all the apps.

slots.<slot-name>

Type: dict

Optional

A set of attributes of the slot.

slots.<slot-name>.<attribute-name>

Type: dict

Optional

Value of the attribute.

source-code

Type: list[string] or string

Optional

Added in Snapcraft 5.0

One or more links to the repository where snap’s assets are stored.

Example: https://github.com/<my-organisation>/<my-snap>

summary

Type: string

Required

Sentence summarising the snap.

Max length of 78 characters, describing the snap in short and simple terms.

Example: The super cat generator

system-usernames

Type: dict

Optional

Common example is snap_daemon: shared to use a daemon user, see system-usernames for more details.

title

Type: string

Optional

The canonical title of the application, displayed in the software centre graphical frontends.

Max length 40 characters.

In the legacy Snapcraft syntax (not using the base key), this key is only available through the passthrough key.

Example: My Awesome Application

type

Type: enum

Optional

The type of snap, implicitly set to app if not set.

For more details, see: gadget, kernel, base.

Example: [app|core|gadget|kernel|base]

version

Type: string (mandatory, unless using adopt-info)

A user facing version to display.

This field is mandatory unless version information is provided by adopt-info . See Using external metadata for details.

Max length of 32 chars. Needs to be wrapped with single-quotes when the value will be interpreted by the YAML parser as non-string.

Examples: '1', '1.2', '1.2.3', git (will be replaced by a git describe based version string)

version-script

Type: string

Deprecated

Use snapcraftctl set-version part scriptlet instead.

A command to determine the snap’s version string. Runs from the working directory of the source tree root, and prints a version string to the standard output. Replaces the value of the version keyword. The version keyword is still mandatory (but ignored).

website

Type: list[string] or string

Optional

Added in Snapcraft 5.0

A link to a product website from the publisher of the snap.

Example: https://www.example.com

App directives

The apps key and its values in snapcraft.yaml detail the applications and services that a snap wants to expose, including how they’re executed and which resources they can access.

apps

Type: dict

A collection of app-names representing entry points to run for the snap.

apps.<app-name>

Type: dict

The name exposed to run a program inside the snap.

If <app-name> is the same as name, the program will be invoked as app-name. However, if they differ, the program will be exposed as <snap-name>.<app-name>.

Each <app-name> contains keys which configure the execution, interfaces, and resources available to the app. These child keys are described in the following sections.

activates-on

Optional

Type: list[string]

A list of names that the snap exposes as slots that can be used to activate it via D-Bus. Each name is automatically added to the slots for the snap.

This keyword is useful when creating services that are activated by other applications or services.

See bus-name and Services and daemons for more information.

adapter

Type: enum

Controls the creation of an env variable wrapper.

Can be one of the following:

  • none (Disables the creation of an env variable wrapper.)
  • full (default)

Snapcraft normally creates a wrapper holding common environment variables. Disabling this could be useful for minimal base snaps without a shell, and for statically linked binaries with no use for an environment.

after

Type: Array of string

A list of applications to be started after <app-name>. Applications must be part of the same snap. The order of the applications in the list has no effect on their launch order.

Requires daemon to be set in the app metadata. See Services and daemons for details.

See also before.

autostart

Type: string

Defines the name of the .desktop file used to start an application with the desktop session.

The desktop file is placed in $SNAP_USER_DATA/.config/autostart, and the application is started using the app’s command wrapper (<name>.<app>) plus any argument present in the Exec= line within the .desktop file.

Example: autostart: my-chat.desktop

See Autostart desktop files for an example of both the desktop file and the Exec file entry.

before

Type: Array of string

An ordered list of applications to be started before <app-name> launches. Applications must be part of the same snap.

Requires daemon to be set in the app metadata. See Services and daemons for details.

See also after.

bus-name

Optional

Type: string

The bus name that the application or service exposes via D-Bus.

See Services and daemons for more information.

command

Type: string

The command to run inside the snap when <app-name> is invoked.

The command can be in either a snap runtime’s command path, $SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin, or an executable path relative to $SNAP.

The command must consist only of alphanumeric characters, spaces, and the following special characters: /, ., _, #, :, $, -. If other characters are required, a wrapper script should be used for the command.

If daemon is set, this will be the command to run the service. Only a snap with classic confinement can use a relative path because PATH isn’t modified by a wrapper in classic confinement. See Classic confinement for more details.

Examples: app-launch for an executable placed under $SNAP/bin. With classic confinement, bin/app-launch for an executable placed under $SNAP/bin.

command-chain

Type: Array of string

A list of commands to be executed, in order, before the command referenced by apps.<app-name>.command.

See Proposal: support command-chain in apps and hooks for further details.

To ensure that the Snapd distribution user running supports this feature, add the command-chain value to the assumes property.

common-id

Type: string

An identifier to a desktop-id within an external appstream file.

See Using external metadata for more details.

daemon

Type: enum

Declares that <app-name> is a system daemon.

Can be one of the following:

  • simple: the command is the main process.
  • oneshot: the configured command will exit after completion
  • forking: the configured command calls fork() as part of its start-up. The parent process is then expected to exit when start-up is complete
  • notify: the command configured will send a signal to systemd to indicate that it’s running.

See Services and daemons for further details.

desktop

Type: string

Location of the .desktop file.

A path relative to the prime directory pointing to a desktop file, commonly used to add an application to the launch menu. Snapcraft will take care of the rest.

Examples:

  • usr/share/applications/my-app.desktop
  • share/applications/my-app.desktop

See Desktop files for menu integration for the complete details about desktop shortcuts and entries for snaps on Linux.

environment

Type: dict

A set of key-value pairs specifying the contents of environment variables available to the app.

Key is the environment variable name; Value is the contents of the environment variable.

Example: LANG: C.UTF-8

extensions

Optional Type: list[string] or string

Snapcraft extensions enable snap developers to easily incorporate a set of common requirements into a snap, such as those to integrate an application with a desktop environment.

For further details, see Snapcraft extensions, and see Supported extensions for a full list of supported extensions.

Example: [gnome-3-38]

install-mode

Type: string

Defines whether a freshly installed daemon is started automatically, or whether startup control is deferred to the snap.

If a snap was installed prior to the daemon component being added, install-mode will determine whether or not the daemon is started automatically when the component is delivered via a snap update.

When disabled, the snap needs to use snapctl with a hook, or another management agent, to start the daemon.

Can be either of the following:

  • enable: the daemon is started after being installed.
  • disable: the daemon will not be started after installation.

Defaults to enable.

Requires daemon to be set in the app metadata. See Services and daemons for details.

listen-stream

Type: string

The socket abstract name or socket path.

Sockets should go to a map of <socket-name> to objects which specify the listen-stream and (optionally) the socket-mode.

TCP socket syntax: <port>, [::]:<port>, [::1]:<port> and 127.0.0.1:<port>

UNIX socket syntax: $SNAP_DATA/<path>, $SNAP_COMMON/<path> and @snap.<snap name>.<suffix>

Example:

unix:
  listen-stream: $SNAP_COMMON/lxd/unix.socket
  socket-mode: 0660

passthrough

Type: type[object]

<app-name> attributes to pass through to snap.yaml without Snapcraft validation.

See Using in-development features for further details.

plugs

Type: list[string]

Plugs for interfaces to connect to.

<app-name> will make these plug connections when running in strict confinement For interfaces that need attributes, see top-level plugs.

Example: [home, removable-media, raw-usb]

post-stop-command

Type: string

Runs a command from inside the snap after a service stops.

Requires daemon to be set in the app metadata. See Services and daemons for details.

refresh-mode

Type: string

Controls how the daemon or app should be treated during a snap refresh.

Can be either of the following:

  • endure: the daemon will not be restarted during a snap refresh.
  • restart: the daemon will be restarted during a snap refresh.
  • ignore-running: the app will not block a snap refresh (can only be set for apps).

Defaults to restart.

Requires daemon to be set in the app metadata. See Services and daemons for details.

restart-condition

Type: enum

Specifies the condition that will cause the daemon to restart.

Defaults to on-failure. Other values are [on-failure|on-success|on-abnormal|on-abort|always|never]. Refer to systemd.service manual for details.

Requires daemon to be set in the app metadata. See Services and daemons for details.

restart-delay

Type: string

The length of time to wait before the daemon restarts. See RestartSec in the systemd.service manual for further details.

Time duration units can be 10ns, 10us, 10ms, 10s, 10m. Defaults to unset.

Requires daemon to be set in the app metadata.

slots

Type: list[string]

Slots for interfaces to connect to.

<app-name> will make these slot connections when running in strict confinement only. For interfaces that need attributes, see top-level slots.

Example: [home, removable-media, raw-usb]

sockets

Type: dict

Maps a daemon’s sockets to services and activates them.

Requires an activated daemon socket.

Requires apps.<app-name>.plugs to declare the network-bind plug.

socket-mode

Type: integer

The mode of a socket in octal.

start-timeout

Type: string

The length of time to wait before starting a daemon.

Time duration units can be 10ns, 10us, 10ms, 10s, 10m. Termination is via SIGTERM (and SIGKILL if that doesn’t work).

Requires daemon to be set in the app metadata.

stop-command

Type: string

The path to a command inside the snap to run to stop the service.

Requires daemon to be set in the app metadata. See Services and daemons for details.

stop-timeout

Type: string

The length of time to wait before terminating a service.

Time duration units can be 10ns, 10us, 10ms, 10s, 10m. Termination is via SIGTERM (and SIGKILL if that doesn’t work).

timer

Type: timer-string

Schedules when, or how often, to run a service or command.

See Timer string format for further details on the required syntax.

Requires daemon to be set in the app metadata. See Services and daemons for details.

watchdog-timeout

Type: string

Specifies how long until the service watchdog times out.

Time duration units can be 10ns, 10us, 10ms, 10s, 10m.

For the watchdog to work, the application needs access to the systemd notification socket, which can be declared by listing a daemon-notify plug in the plugs section.

Requires daemon to be set in the app metadata.

Part directives

The main building blocks of a snap are called parts. They are used to declare pieces of code that will be pulled into your snap package. The parts keys and values in snapcraft.yaml detail how parts are configured and built by the snapcraft command.

parts

Type: dict

A set of independent building blocks, consisting of either code or pre-built packages.

parts.<part-name>

Type: dict

The name of the part building block.

<part-name> represents the specific name of a building block which can be then referenced by the command-line tool (i.e. snapcraft).

Each <part-name> contains keys which configure how it’s sourced and built. These child keys are described in the following sections.

after

Type: list[string]

Ensures that all the <part-names> listed in after are staged before this part begins its lifecycle.

build-attributes

Type: enum

A list of named attributes to modify the behaviour of plugins. Supported attributes:

Attribute Behaviour
debug Plugins that support the concept of build types build in Release mode by default. Setting the ‘debug’ attribute requests that they instead build in debug mode.
keep-execstack Do not remove the “executable stack” bit from ELF files.
no-patchelf Do not patch ELF files, even when Snapcraft believes it is required (e.g. for classic snaps)
enable-patchelf Do patch ELF files, even when Snapcraft does not believe it’s required (e.g. for strict snaps)
no-install Do not run the install target provided by the plugin’s build system. Only supported by the kbuild plugin.

For more information, refer to the output of snapcraft help plugins.

build-environment

Type: Array

A list of environment variable assignments that are applied during the build step, it is exported in order which allows for later values to override (or modify) earlier values.

This entry supports additional syntax, for more information refer to Advanced grammar.

parts:
  _part_name_:
	build-environment:
  	- LANG: C.UTF-8
  	- LC_ALL: C.UTF-8

build-packages

Type: list[string]

A list of packages required to build a snap.

Packages are installed using the host’s package manager, such as apt or dnf, and are required for <part-name> to build correctly. This entry supports additional syntax, for more information refer to Advanced grammar.

Example: [libssl-dev, libssh-dev, libncursesw5-dev]

build-snaps

Type: list[string]

A list of snap names to install that are necessary to build <part-name>.

If a specific channel is required, the syntax is of the form <snap-name>/<channel>. This entry supports additional syntax, for more information refer to Advanced grammar

Example: build-snaps: [go/1.13/stable]

disable-parallel

Type: boolean

Whether to disable parallelism for the build plugins.

filesets

Type: list[string]

A key to represent a group of files or a single file.

Filesets do not currently work when building snaps with core22 base snaps and Snapcraft 7.

See Snapcraft filesets for further details.

organize

Type: dict

A map of files to rename.

In the key/value pair, the key represents the path of a file inside the part and the value represents how the file is going to be staged.

Example: bin/snapcraftctl: bin/scriptlet-bin/snapcraftctl

override-build

Type: multiline string

Replaces a plugin’s default build process with a script.

The shell script defined here replaces the build step of the plugin, defined in parts.<part-name>.plugin. The working directory is the base build directory for the given part. The defined script is run with /bin/sh and set -e. A set of Environment Variables will be available to the script.

To run Snapcraft’s original build implementation from within override-build, run snapcraftctl build. This can be run before or after any custom script or omitted entirely.

override-prime

Type: multiline string

Replaces a plugin’s default prime process with a script.

The shell script defined here replaces the prime step of the plugin, defined in parts.<part-name>.plugin. The working directory is the base prime directory for the given part. The defined script is run with /bin/sh and set -e. A set of Environment Variables will be available to the script.

To run Snapcraft’s original prime step implementation from within override-prime, run snapcraftctl prime. This can be run before or after any custom script or omitted entirely.

override-pull

Type: multiline string

Replaces a plugin’s default pull process with a script.

The shell script defined here replaces the pull step of the plugin, defined in parts.<part-name>.plugin. The working directory is the base pull directory for the given part. The defined script is run with /bin/sh and set -e. A set of Environment Variables will be available to the script.

To run Snapcraft’s original pull stage implementation from within override-pull, run snapcraftctl pull. This can be run before or after any custom script or omitted entirely.

override-stage

Type: multiline string

Replaces a plugin’s default stage process with a script.

The shell script defined here replaces the stage step of the plugin, defined in parts.<part-name>.plugin. The working directory is the base stage directory for the given part. The defined script is run with /bin/sh and set -e. A set of Environment Variables will be available to the script.

To run Snapcraft’s original stage implementation from within override-stage, run snapcraftctl stage. This can be run before or after any custom script or omitted entirely.

parse-info

Type: list[string]

Defines content to adopt when using external metadata.

Each entry is a relative path to a supported metadata file from the part source, build or install directory (SNAPCRAFT_PART_SRC, SNAPCRAFT_PART_BUILD, SNAPCRAFT_PART_INSTALL).

See Using external metadata for more details.

plugin

Type: string

The plugin to drive the build process.

Every part drives its build through a plugin, this entry declares the plugin that will drive the build process for <part-name>. Refer to Snapcraft plugins for more information on the available plugins and the specific attributes they add to the parts.<part-name>. namespace.

prime

Type: list[string]

A list of files from <part-name> to prime.

Rules applying to the list here are the same as those of filesets. Referencing of fileset keys is done with a $ prefixing the fileset key, which will expand with the value of such key.

prepare

Deprecated in Snapcraft 3.0

Type: multiline string

Use override-build instead.

Runs a script before the plugin’s build step. The script is run before the build step defined for parts.<part-name>.plugin starts. The working directory is the base build directory for the given part. The defined script is run with /bin/sh and set -e.

source

Type: string

A URL or path to a source tree to build.

This can be a local path or remote and can refer to a directory tree, a compressed archive, or a revision control repository. This entry supports additional syntax, for more information refer to Advanced grammar

source-branch

Type: string

Work on a specific branch for source repositories under version control.

source-checksum

Type: string

Used when source represents a file.

Takes the syntax <algorithm>/<digest>, where <algorithm> can be any of: md5, sha1, sha224, sha256, sha384, sha512, sha3_256, sha3_384 or sha3_512. When set, the source is cached for multiple uses in different Snapcraft projects.

source-commit

Type: string

Work on a specific commit for source repositories under version control.

Cannot be an abbreviation. Requires the full 40-character SHA-1 hash for the commit.

source-depth

Type: integer

Depth of history for sources using version control.

Source repositories under version control are cloned or checked out with full history. Specifying a depth will truncate the history to the specified number of commits.

source-subdir

Type: string

A path within the source to set as the working directory when building. The build will not be able to access files outside of this location, such as one level up.

source-submodules

Type: dict

Configures which submodules to fetch from the source tree in snapcraft.yaml with source-submodules: <list-of-submodules>.

When source-submodules is defined, only the listed submodules are fetched:

parts:
  git-test:
	plugin: dump
	source-type: git
	source: git@github.com...
	source-submodules:
  	- submodule_1
  	- dir1/submodule_2

If source-submodules is defined and the list is empty, no submodules are fetched:

parts:
  git-test:
	plugin: dump
	source-type: git
	source: git@github.com...
	source-submodules: []

If source-submodules is not defined, all submodules are fetched (default behaviour).

source-tag

Type: string

Work on a specific tag for source repositories under version control.

source-type

Type: enum

Used when the type of source entry cannot be detected.

Can be one of the following: [bzr|deb|git|hg|local|mercurial|rpm|subversion|svn|tar|zip|7z]

stage

Type: list[string]

A list of files from <part-name> to stage.

Rules applying to the list here are the same as those of filesets. Referencing of fileset keys is done with a $ prefixing the fileset key, which will expand with the value of such key.

stage-packages

Type: list[string]

A list of packages required at runtime by a snap.

Packages are required by <part-name> to run. They are fetched using the host’s package manager, such as apt or dnf, and are unpacked into the snap being built. This entry supports additional syntax, for more information refer to Advanced grammar.

Example: [python-zope.interface, python-bcrypt]

stage-snaps

Type: list[string]

A list of snaps required at runtime by a snap.

Snaps are required by <part-name> to run. They are fetched using snap download, and are unpacked into the snap being built. This entry supports additional syntax, for more information refer to Advanced grammar.

Example: [hello, black/latest/edge]

5 Likes

Feedback: apps:<app-name>.desktop is not documented

version-script is also not documented.

I’ve added the global plugs and slots keys, please help complete the content.

apps..adapter does not make sense. The description reads like it is a boolean, but the type is enum[none] (?), and there are no valid enums values listed.

Maybe the only accepted value is none? I’ve moved the part to the example values.

Can this page be added to the sidebar on the new docs site here: https://discourse-docs.staging.snapcraft.io/t/snapcraft-yaml-reference/4276

The format for snap.yaml is already there so I think this page should be as well.

(apologies if that is already planned and hasn’t been done yet)

1 Like

@degville I believe that request goes to you ^

Yes (thanks!). We’ve actually been talking about this the last couple of days, and I’m currently looking over the The snap format doc with a view to taking the same approach with snapcraft.yaml, and ultimately, adding a reference section to include both.

I can’t seem to edit, so I’m commenting. There are a lot of missing links. I think the “advanced grammar” ones should point to Snapcraft advanced grammar. Not sure about the others.

Thanks for flagging this. We did re-create the contents of this reference with fixed links and text, spread across 3 different pages (see the Snapcraft format). This is briefly mentioned in the first line of this doc.

However, this page remains because some users like to see everything in a single easily searchable place, so we need to sync back those fixes if we’re going to keep both (which I think we should).

2 Likes

The environment variables links are empty.

The reference content on this page has now been updated. Let us know if there are any mistakes/omissions!

@degville it seems the keys for adopt-info, apps.<app-name>.common-id, and parts.<part-name>.parse-info are not documented in the reference. In fact the entire adopt-info tech doesn’t have any documentation on docs.snapcraft.io

Thanks for letting me know! In a weird world of coincidence, I’m just about to push a few changes to Using external metadata (so it can be properly published and searchable) and noticed exactly the same thing. I’ll fix the omissions and get it all updated as soon as I can.

The top-level plugs documentation seems to contradict itself; the type is dict (and the text calls out specifically that it requires a dict), but the example is a list:

Many thanks for this. You’re absolutely right. It looks like the top-level plugs description has been confused with apps.plugs, etc. I’ll remove the examples for now.

Just take a note that the schema comes from:

According the schema here’s the accepted values:

I’ve updated the topic to reflect it.

1 Like

I wonder if this topic is superseded by Snapcraft top-level metadata, Snapcraft parts metadata, and Snapcraft app and service metadata? There’s less sense in maintaining two identical copies of the document and those topics are the ones that are directly accessible from the docs.snapcaft.io site.

If it is superseded we might want to mark this one obsolete and redirect people to the current docs.