Background and motivation
Besides the snap binary itself, there are several metadata fields associated to a revision and/or a snap. The metadata from a revision is set and fixed when uploading a new binary, but package metadata is editable the web UI (and initially set on first upload). There should be a simple and clear way to set and update the editable snap package metadata, using snapcraft and through the web UI.
Existing discussions
Snap development sprint ideas/agreements
Relevant bugs
- Please add âcontactâ field to the API LP: #1666792
- metadata not being updated upon snap push LP: #1681453
- Please allow âcontact:â override on a per-snap basis LP: #1709610
Forum thread(s)
Existing implementation
Metadata fields are initially populated from the snap.yaml when a snap is first uploaded. From here on, some of the fields can be edited via the web UI, while others canât. Confusingly, if the snap is rebuilt with new metadata in its snap.yaml and pushed, the store metadata is NOT updated.
Proposed solution and implementation
Initial metadata will still be set on first upload with the provided data (needed to keep backwards compatibility with previous snapcraft releases). However, subsequent pushes to the store will also update the metadata, unless there were some change(s) made through the web UI.
In that case, snapcraft will warn the user possibly displaying the conflicting fields information. Developer will have the option to force the update and override the metadata details with his/her values. There will be also the option for the developer to set a specific value for a specific metadata field, individually.
User Experience
Under normal circumstances, the snap will pushed and the metadata updated given the user has never edited the metadata on the dashboard:
$ snapcraft push <.snap>
Revision X created
The metadata has been updated
For the case of a conflict, as a first cut only listing the items with conflicts (text items could display their store values though):
$ snapcraft push <.snap>
Revision X created
The metadata has not been updated due to conflicts in these items:
- description
- icon
Fix the conflicts and run `snapraft push --only-metadata`
or override the store data by running
`snapcraft push --only-metadata --force-metadata`
At any given time an individual can run,
$ snapcraft push --only-metadata
The metadata has been updated