Publish your operator in Charmhub

Key Value
Summary Use charmcraft to build charms, upload them to Charmhub and publish them for easy consumption.
Categories using-charmhub
Difficulty 2
Author Facundo Batista


Duration: 0:10

In this tutorial we’ll show you how to publish your operator in Charmhub.

You should already have completed a previous tutorial, to create a minimal operator, or already have one of your own that builds with charmcraft build. You will need charmcraft installed.

If you don’t have a charm and don’t want to go through that tutorial to make one, then you will not be able to work with Charmhub, but you can watch this tutorial on Youtube to get the idea.

We build the charm with charmcraft. This will fetch any dependencies, compile any modules, check that all the key files are in place, and produce a compressed archive with the operator code and metadata as the charm.

$ charmcraft build
Done, charm left in 'hello-world.charm'

Login to Charmhub

Duration: 2:00

You will need to log in to Charmhub in order to upload and release charms.

$ charmcraft login
Opening an authorization web page in your browser; if it does not open, please open this URL:
Login successful.

If this is our first time with this charm, we will need to register this name in the Store:

$ charmcraft register storestory
Congrats! You are now the publisher of 'storestory'

NOTE: All commands to the Store needs for us to be authenticated. This is handled automatically by charmcraft: if the credentials expired or not found a browser page will open for us to authenticate against the Store as we usually do in the web. We can always check how is our authentication status by issuing charmcraft whoami.

If in doubt, we can easily check all our registered names:

$ charmcraft names
Name            Visibility    Status
storestory      public        registered


Duration: 1:00

Now we’re ready to upload the binary. We just need to specify the path to it:

charmcraft upload hello-world.charm
Revision 1 of 'storestory' created

Every time we upload a new binary for the charm we get a new revision in the Store. We can verify its current status easily:

$ charmcraft revisions storestory
Revision    Version    Created at    Status
1           0.1        2020-07-23    approved

Now it’s time to release!

$ charmcraft release storestory --revision=1 --channel=beta
Revision 1 of charm 'storestory' released to beta

Finally, we can see the overall status:

$ charmcraft status storestory
Track    Channel    Version    Revision
latest   stable     -          -
         candidate  -          -
         beta       0.1        1
         edge       ↑          ↑



Can you change the title of the post to [Tutorial] xxxxx? This is great for spotting them out here in the forum. Sane thing with the referenced “how to build a charm using modern tools”.


I would love to know also about private namespaces for charms and how to remove charms if that’s possible?

1 Like

Hello Erik, sorry for the delay in the response, this was lost in my ToDo.

What exactly do you mean with “private namespaces”? We have private charms (read/write capabilities for the owner, and potentially collaborators), but nothing like “namespaces”…

Regarding the removing charm capability, is not a feature we have planned. You could close all the channels and effectively having it not released, but nothing like removing the charm itself.

Please let me know if I can help you with more detail in any of these responses.


Private charms is what I use for charms that I don’t want to make public. I use it with Launchpad teams.

Removing charms is a needed feature as I have some times pushed charms under wrong names and namespaces/teams which gets very confusing when using the ‘charm list’ etc. It then shows all the charms even those I wish I never added (by mistakes). My namespace becomes very bloated and messy.

1 Like

This is something that depends on the store itself, which is still a ongoing work, probably we’ll have features like this in the future.

1 Like

Can you add something describing how to add tracks for a charm/bundle? I’m not even sure charmcraft has this ability.

if i have a charm published at latest/stable, i can’t release it to mytrack/edge without the error invalid track

1 Like

Hello @addyess.

Tracks cannot be automatically created by Charmcraft or the developer in any way. This is a Charmhub restriction by design, as the track creation has to follow some steps.

If you want a new track for your charm, you should open a new post in this forum asking for it, using the special #charmhub-requests category in the post.

I think it should be replaced with charmcraft pack to be up to date, otherwise users will stick on the beginning with:

> charmcraft build
Usage: charmcraft [options] command [args]...
Try 'charmcraft -h' for help.

Error: no such command 'build'


P.S. charmcraft pack is valid for the current version of charmcraft=2.2.0.

Hello, thanks for noticing and alerting about this being old!

Actually, the whole doc is old, there are instructions much nicer and updated in the SDK documentation, please check there how to pack a charm or how to publish a charm to Charmhub, for example.

1 Like