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
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.
NOTE: currently the Store support is under development, so all these actions are done against staging, there are no guarantees over the stored information.
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
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: https://api.staging.jujucharms.com/identity/login?did=2cfdcd9bf73014bad4e875 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
If in doubt, we can easily check all our registered names:
$ charmcraft names Name Visibility Status ... storestory public registered ...
Now we’re ready to upload the binary. As we’re in our project’s directory the command is very simple (otherwise we would need to use the
--charm-file option to specify the binary’s location):
charmcraft upload Revision 1 of 'storestory' created
Everytime 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 Revision Version Created at Status 1 0.1 2020-07-23 approved
Note that we didn’t specify the charm’s name: this is because we’re in the project’s directory, so the name is retrieved automatically; if you want to ask for any other charm you can use the
Now it’s time to release!
$ charmcraft release beta Revision 1 of charm 'storestory' released to beta
release uses current project for the naming (you can override it with
--name) and releases the last uploaded revision (you can specify a different one with
Finally, we can see the overall status:
$ charmcraft status Track Channel Version Revision latest stable - - candidate - - beta 0.1 1 edge ↑ ↑