Open arturo-seijas opened 2 years ago
Hello! Thanks for the report.
The upload
command already have a --release
option to publish the charm "in the same command". It also has the --resource
option that can be used to release charms with their resources at that time.
Regards,
Hello!
Maybe I wasn't clear, but I'm getting the upload
command to support uploading resources that do not exist yet in charmhub. AFAIK, the --resource only works if the resource has already been published
I think I better understand this now. I have some concerns about this...
I'm -0 to make the commands more complex just address specific use cases, unless those are widely used. Now that Charmcraft have programmatic outputs, why not upload the resource(s) and the charm all controlled by other script that can proceed as you want in each case?
Unless you are talking about "upload both charm and resource at the same time, succeeding for both or failing for both". This is even more complicated, because Charmcraft cannot do that, we would need to change how Charmhub works internally and the API it exposes. Furthermore, it will be lot of less efficient, because "uploads" are actually a two step dance: first all bytes are pushed to a storage, then the upload is "commited" to Charmhub. So if we're uploading everything at the same time, it would mean that all bytes transfers needs to be pushed before trying to commit everything, and if there's a failure, most of those transfers are wasted.
All that said, one of the big reasons for resources is to decouple the charm and blobs it needs. So a resource can be uploaded once, and each charm change would not need to re-upload that resource, can be cached better at client side, etc. If you have both the charm and resource tightly coupled, why not just include that binary inside the charm?
prop
It would be nice to have a way to publish in a single
charmcraft upload
run the charm and its resources for those cases in which they share the life-cycle to prevent versioning issues, improve developer experience and minimize the existence of dangling resources when the charm upload fails in CI when the previous steps are successful.From a developer's perspective, what I have in mind is to support specifying the current ùpstream-source`parameter in the metadata file in the command line interface, so that, when present, the command will create the resources along with the charm, although better options might exist.
Thank you!