|Summary||Use charmcraft to build charms, upload them to Charmhub and publish them for easy consumption.|
|Author||Facundo Batista email@example.com|
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.
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. 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 ↑ ↑