Publish snaps directly to the Enterprise Store¶
Warning
This functionality requires a Dedicated Snap Store, also known as an IoT App Store.
To publish snaps directly to an Enterprise Store, you need the Enterprise Store
to be configured with a Brand account, and for the snaps in question to be
registered to the same Brand account. Additionally, once registered, customers
need to submit a support ticket to request the modification of each snap’s
snap-declaration to include a value for the provenance of the snap.
Note
Provenance can be an alphanumeric string that includes hyphens, eg. acme-site-7.
Additionally, the Dedicated Snap Store should also contain keys for signing device models and serials.
Exporting store data¶
Relevant Dedicated Snap Store data must be exported to the Enterprise Store. This
is done using the store-admin snap.
On a snap compatible machine with internet access, export the desired store and
the relevant keys. For example, where keyid1, keyid2, and keyid3 are
sha3-384 fingerprints of the respective registered keys:
Note
You will need to authenticate using an account with Admin permissions for the store you are exporting.
Data will be exported to the /home/<user>/snap/store-admin/common/export/ directory.
Exported data
SaaS stores’ (device view store and its parent) metadata.
Admin account data and a credentials used for signing and publisher operations.
Registered public keys as account-key assertions for key IDs specified with the
--keyoption.
Warning
Make sure to include the keys used for signing client device serial and model assertions, and the key that will be used for signing snap revision assertions for snaps published directly to the Enterprise Store. These keys have to be registered using snapcraft register-key command prior to the export.
Import store data¶
Move the exported store bundle to the Enterprise Store machine and run the import command:
Note
The key file specified with --revision-authority-key contains the private key corresponding to one of the public keys exported using the store-admin export store command. It can be exported from the machine that holds the brand account keys (this account should have been set up as part of initial Brand store onboarding process) using:
Where <key-name> is the name as shown in the snapcraft list-keys output. A matching --revision-authority-key-id has to be specified as well (also available in the snapcraft list-keys output).
It is not necessary to specify --revision-authority-key nor --revision-authority-key-id during subsequent synchronisation (push-store invocations).
Configure Enterprise Store provenance¶
Configure the snap revision provenance for this Enterprise Store (the value for this setting must be the one chosen earlier). For example, using acme-site-7:
Build and publish with Snapcraft¶
Snapcraft is used to build revision authority delegated snaps, and to publish them to the Enteprise Store.
Configure Snapcraft for your Enterprise Store using the data exported from the data provided with store-admin export store:
user@admin-host:~$ export SNAPCRAFT_ADMIN_MACAROON=$(cat /home/<user>/snap/store-admin/common/export/storeID.macaroon)user@admin-host:~$ export SNAPCRAFT_STORE_AUTH=onpremuser@admin-host:~$ export STORE_DASHBOARD_URL="https://example.store/publishergw"user@admin-host:~$ export STORE_UPLOAD_URL="https://example.store"Next, login to the Enteprise Store store as the publisher and export the credentials to a file:
user@admin-host:~$ snapcraft export-login <publisher_account>Set the credential produced by export-login as SNAPCRAFT_STORE_CREDENTIALS environment variable:
user@admin-host:~$ export SNAPCRAFT_STORE_CREDENTIALS="$(cat <publisher_account>)"You can now snapcraft upload and snapcraft release to the Enteprise Store.
Note
Commands supported by Enteprise Stores set up in this way are:
snapcraft status <snap-name>snapcraft list-revisions <snap-name>snapcraft upload <snap-file>snapcraft release [options] <snap-name> <revision> <channels>snapcraft close [options] <snap-name> <channel>
Warning
There is no support for custom tracks or branches, and there is no support for progressive releases.