Updating imported charms through Charmhub

Hey all,

I am currently looking into how to publish a charm which was namespaced on the old Charm Store but now gets imported and handled entirely by Charmhub.

For example I have a charm currently accessible in the Charm store as cs:~foo/bar. It is reflected as foo-bar on the Charmhub after the import.

As soon as the charm store switches to read-only mode updates to the charm have to be done via charmcraft upload. Currently the charm has recorded name: bar in its metadata.yaml but to allow charmcraft to upload it it must be changed to name: foo-bar (charmcraft pulls the name of the charm to upload to from metadata.yaml in the .charm file, see here)

Is that expected and the recommended way on how to update charms formerly only available on the charm store?

If yes, are there any other issues expected given that the charm now internally has a different name than what existing deployments have recorded in the Juju model based on them being deployed from the charm store with the old name?

Thanks!

Simon

After playing a bit with juju upgrade-charm it looks like upgrading to a newer charm from the Charm Store with the changed name from foo to bar-foo works well but not when the charm is being updated from a local directory. Then it complains and reports ERROR cannot refresh "foo" too "bar-foo".

So looks like changing the name as charmcraft requires doesn’t come without consequences.

Simon

So looks like the restriction is all client side and the Charmhub validation logic doesn’t enforce (yet?) a mapping between the name charmcraft publishes to and the name recorded in metadata.yaml.

With the patch here for charmcraft I am able to publish a charm with name: foo on Charmhub under the name bar-foo (actual names are different, so don’t look for them) by running charmcraft upload --name=bar-foo foo.charm

Simon