How to configure Charmcraft

See also:

You have installed Charmcraft. This document shows you how you can configure it.

Configuring Charmcraft is mandatory for all project-handling commands, though optional for some store-related commands.

Contents:

Find the configuration file

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.

Get acquainted with its contents

See charmcraft.yaml.

Consult some examples

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:

type: charm
bases:
    - build-on:
        - name: ubuntu
          channel: "20.04"
          architectures: ["amd64"]
      run-on:
        - name: ubuntu
          channel: "21.04"
          architectures: 
              - amd64
              - aarch64
              - arm64

Start configuring!

Start modifying the examples above to suit your own needs.

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