Implementation of /dev/api/snap-push

/dev/api/snap-push

It could be appealing to think that it all be documented in the Developer Portal API documentation here but sadly that’s not the case.

The general flow seems to be this:

  • First we do a dry-run to /dev/api/snap-push to make sure we can do this, I think this is called the pre-check
  • Then we upload the snap to the /unscanned-upload/ URL specified in the STORE_UPLOAD_URL in Snapcraft. (as aside, as a programmer it’s fair to say it IS documented because it’s open source, just not in the Docs)
  • From that we get an upload ID
  • We use this ID to do the actual, real POST to /dev/api/snap-push where we also get a status URL
  • This status URL is unauthenticated and lets us check on the status of the store processing
  • Once that’s done (processed = true and code = “ready_to_release”) we’re done
  • We expect to find the revision number in that response as well which is undocumented

Also for the particular purpose of uploading with Snapcraft xdelta3 can be involved if a previous upload of the snap exists in the cache.

The cache is located, more than likely, in a path that looks like this:

~/.cache/snapcraft/projects/htop/snap_hashes/amd64/b5107f575f9d98f48f1386ddf6edd0a0643ea9740cd3e710db99ea724cfdfddbc31a7ddf1e69033084599e9bfdaa438b

That is, if you had previously uploaded a snap for htop.