Publishing private snaps

Right now snapcraft has no option to publish a snap and release it privately. I can think of a few examples where this is desirable. For example if I want to register, build and push from my CI, but the application is proprietary or limited release. I don’t want random people installing it without my consent. I may also have a marketing push planned, but don’t want people to ‘guess’ the snap name and install it from the edge channel until I am ready to release.

So something like:-

snapcraft register mysnapname

snapcraft push mysnapname_amd64.snap --release edge --private

Bonus points if we can add users who can test it too.

snapcraft push mysnapname_amd64.snap --release edge --private --share foo@example.com, bar@example.com

Is this something worth adding?

2 Likes

Hi @popey,

Private snaps are supported by passing the --private flag on name registration:

nessita@dali:~$ snapcraft register --private private-name-nessita
Even though this is private snap, you should think carefully about
the choice of name and make sure you are confident nobody else will
have a stronger claim to that particular name. If you are unsure
then we suggest you prefix the name with your developer identity,
As ‘nessita-yoyodyne-www-site-content’.

We always want to ensure that users get the software they expect
for a particular name.

If needed, we will rename snaps to ensure that a particular name
reflects the software most widely expected by our community.

For example, most people would expect ‘thunderbird’ to be published by
Mozilla. They would also expect to be able to get other snaps of
Thunderbird as 'thunderbird-$username'.

Would you say that MOST users will expect 'private-name-nessita' to come from
you, and be the software you intend to publish there? [y/N]: y
Registering private-name-nessita.
Congrats! You are now the publisher of 'private-name-nessita'.

nessita@dali:~/snaps/private-name-nessita$ snapcraft
"confinement" property not specified: defaulting to "strict"
"grade" property not specified: defaulting to "stable"
Preparing to pull main 
Pulling main 
Preparing to build main 
Building main 
Staging main 
Priming main 
Snapping 'private-name-nessita' |                                                              
Snapped private-name-nessita_0.0_amd64.snap

nessita@dali:~/snaps/private-name-nessita$ snapcraft push private-name-nessita_0.0_amd64.snap --release edge
Pushing private-name-nessita_0.0_amd64.snap
After pushing, an attempt to release to ['edge'] will be made
Preparing to push '/home/nessita/snaps/private-name-nessita/private-name-nessita_0.0_amd64.snap' to the store.
Pushing private-name-nessita_0.0_amd64.snap [===========================================================] 100%
Processing...|                                                                                                
Ready to release!
Revision 1 of 'private-name-nessita' created.
Track    Arch    Channel    Version    Revision
latest   amd64   stable     -          -
                 candidate  -          -
                 beta       -          -
                 edge       0.0        1
The 'edge' channel is now open.

The sharing will be provided when the “add developer” functionality is ready, which should be soon. I don’t have the details of the command would it will be something like snapcraft add developer and you will have an editor opened to add the proper accounts to the snap-developer assertion.

Cheers, Natalia.

Awesome, thanks! Is there no way to switch from public to private from the command line, but only specify during registration?

Correct, no privacy change from command line. You could change it from the web UI though.

This is where things get confusing, since snapcraft registered which basically goes over the available snap-ids (account info API) available to the user carries information about privacy whilst it seems that the revision is what conveys the final result there. Or is it a global toggle?

If so we can design the metadata update APIs coming soon to take some of this into consideration to generalize this for snap-id attributes instead of just metadata