How to attach a resource to a charm at release time

See also:

You have a uploaded multiple updates to your resource, resulting in multiple revisions. This document shows you how you can now attach a specific one of them to a charm at release time, as a way to control the evolution of the charm and the resource it uses.

To attach a specific resource revision to a charm at release time, simply specify the resource revision, as in the example below:

$ charmcraft release my-super-charm --revision=13 --channel=stable --resource=someresource:2
Revision 13 of charm 'my-super-charm' released to stable (attaching resources: 'someresource' r2)

To inspect the results, ask for the charm status:

    jdoe@machine:~/blogsystem$ charmcraft status my-super-charm
    Track       Channel    Version    Revision    Resources
    latest      stable     7.4a       13          someresource (r1)
                candidate  ↑          ↑           ↑
                beta       7.4a       10          -
                edge       ↑          ↑           -

If the charm needs a resource and it’s not indicated at release time it will be an error (unless that resource was already attached to the same charm in a previous release in that same channel, in which case Charmhub automatically will attach it in the new release).

Last updated 1 year, 5 months ago. Help improve this document in the forum.