The charmcraft tool configuration is specified in a charmcraft.yaml file located in the project’s root directory.
By default, Charmcraft will try to find that file in the current directory, but in case of needing to run charmcraft outside the project’s directory, it can be specified using the global option --project-dir.
The following illustrate some implementations of the above spec:
type: bundle
charmhub:
# these fields are set to the default value to illustrate field usage
# likely not required in most cases
api-url: https://api.charmhub.io
storage-url: https://storage.snapcraftcontent.com
parts:
bundle:
prime: ["README.md"]
A different example, with a more comprehensive base definition:
20.04 is a float. While we could convert this one to string automatically (and get "20.04", we do NOT want to get into the situation of converting 20.10 to "20.1".
I understand there’s also a build-packages option to parts/charm. Could that be added here, it’s been asked about a few times by different people on Mattermost ?
Unless I misread this, it is not specified under what path, the files listed under prime are included in the charm container. Also in the case of a bundle what path are prime files mapped into and for which charm ?
Is it possible to have per-base configuration of the charms-python-packages property? See this github discussion for reference, where setuptools needs to be on v58 or lower for support on Bionic charms. It would be nice if charmcraft.yaml could have this specified for each Ubuntu base as needed.
Could this be added, and can anyone confirm if stage-packages should work as a way of installing packages in the charm at run time (or if there’s another way to do that - I’ve tried it without success)?
Is it necessary to specify the bases for a bundle? What happens if the bases in the bundle differ from the charm’s bases? Will the run-on from the charms be overwritten by the values on the bundle file?
Ah, got it! Do you know how to specify that a bundle can run on different OSes? We have charms that run on Ubuntu and Centos, but I can only specify one series in the bundle file, so when I upload to charmhub it shows only one OS in there. The bundle I am working on is: charmhub.io/slurm
Hey there @facundo! I was wondering if we could add override-build as an available key for the charm section of parts? As I had mentioned in my issue on the charmcraft repository, I had no idea override-build was an available option for charmcraft.yaml until you showed me that separate discourse post.
I think it would be beneficial to add override-build to the section I quoted above. This way, folks who have edge cases like myself will know they can inject some custom actions into the charmcraft.yaml file when reading the sdk documentation.