We have recently introduced some changes allowing a developer to use snapcraft to update certain snap details in the store (or as we call it, metadata).
snapcraft push-metadata (available since 2.39), snapcraft will try to update the snap information in the store using the data in your
snapcraft.yaml. The currently supported fields are
icon. A normal invocation will look like:
$ snapcraft push-metadata mysnap_3_amd64.snap Pushing metadata from mysnap_3_amd64.snap The metadata has been pushed
The developer can also update the store metadata using any revision as input:
$ snapcraft push-metadata mysnap_1_amd64.snap Pushing metadata from mysnap_1_amd64.snap The metadata has been pushed
In the same way, builds pushed from snapcraft, Launchpad or build.snapcraft.io will transparently update the store details when uploading a new revision.
Note, these fields will be updated only if they have not been subsequently edited using the store web UI (https://dashboard.snapcraft.io). When web edits have been made, snapcraft will detect the conflict and return a warning:
$ snapcraft push-metadata mysnap_2_amd64.snap Pushing metadata from mysnap_2_amd64.snap Metadata not pushed! Conflict in 'description' field: In snapcraft.yaml: 'Description to be pushed.' In the Store: 'Current description in the store.' You can repeat the push-metadata command with --force to force the local values into the Store
Why is this conflict warning useful? If someone else in your team is managing snap promotion information in the Store, you don’t want to override the changes made by them without noticing it. In the event of a conflict, you could update your
snapcraft.yaml to reflect the changes made in the store, or force the update, overriding the store changes with your snap data. Here’s an example of overriding:
$ snapcraft push-metadata mysnap_2_amd64.snap --force Pushing metadata from mysnap_2_amd64.snap The metadata has been pushed
If there are no conflicts, or conflicts are cleared (because of a previous forced update, or because
snapcraft.yaml values are updated to match the existing values in the store), subsequent pushes will proceed without warning.
If you are using snapcraft from the snap, you already have 2.39 around. If you didn’t switch to the snap version yet, you should install it and always have the latest snapcraft:
$ snap install snapcraft --classic
We hope you find this enhancement useful, let us know if you have any questions!