This document contains a list of charmcraft
deprecation notices and recommendations.
Contents:
- DN01: Configuration keywords are now separated using dashes
- DN02: A charmcraft.yaml configuration file is now required
- DN03: Bases configuration is now required
- DN04: Use
charm-entrypoint
in charmcraft.yaml parts to define the entry point - DN05: Use
charm-requirements
in charmcraft.yaml parts to define requirements - DN06: The
build
command is deprecated, usepack
instead.
DN01: Configuration keywords are now separated using dashes
Introduced in charmcraft v1.1, enforced in v1.5.0.
The charmcraft.yaml
file used to configure Charmcraft now uses dashes to separate multi-token words. Previously, underscores were used.
This means that if you have a configuration like this:
charmhub:
api_url: https://someserver.com
…you would need to migrate it to:
charmhub:
api-url: https://someserver.com
DN02: A charmcraft.yaml configuration file is now required
Introduced in charmcraft v1.1, enforced in v1.5.0
The charmcraft.yaml
file will soon be required. The following configuration is assumed:
...
type: charm
bases:
- build-on:
- name: "ubuntu"
channel: "20.04"
run-on:
- name: "ubuntu"
channel: "20.04"
For more information, check out Juju | How to configure Charmcraft.
DN03: Bases configuration is now required
Introduced in charmcraft v1.1, enforced in v2.0.0.
The charmcraft.yaml
file will soon require bases
configuration. The following bases
configuration is assumed:
...
bases:
- build-on:
- name: "ubuntu"
channel: "20.04"
run-on:
- name: "ubuntu"
channel: "20.04"
For more information, check out Juju | How to configure Charmcraft.
DN04: Use charm-entrypoint
in charmcraft.yaml parts to define the entry point
Introduced in charmcraft v1.2, enforced in v2.0.0.
Non-default charm entry points should now be defined in the charm
part in charmcraft.yaml
. Use charm-entrypoint
to list the path to the entry point executable, relative to the charm source directory. If not specified, the entry point is assumed to be src/charm.py
.
...
parts:
charm:
charm-entrypoint: "src/my_entrypoint.py"
...
DN05: Use charm-requirements
in charmcraft.yaml parts to define requirements
Introduced in charmcraft v1.2, enforced in v2.0.0.
Non-default requirement files should now be defined in the charm
part in charmcraft.yaml
. Use charm-requirements
to list the requirement files containing python packages to install. If not specified, requirements.txt
will be used if the file exists in the charm source directory.
...
parts:
charm:
charm-requirements: ["reqs1.txt", "reqs2.txt"]
...
DN06: The build
command is deprecated, use pack
instead.
Introduced in charmcraft v1.5.0, enforced in v2.0.0.
The build command is deprecated (as this verb will have other meaning in the future). Use pack instead:
$ charmcraft pack
Charms packed:
my-super-charm_ubuntu-20.04-amd64.charm
$ charmcraft help pack
Usage:
charmcraft pack [options]
Summary:
Build and pack a charm operator package or a bundle.
You can `juju deploy` the resulting `.charm` or bundle's `.zip`
file directly, or upload it to Charmhub with `charmcraft upload`.
For the charm you must be inside a charm directory with a valid
`metadata.yaml`, `requirements.txt` including the `ops` package
for the Python operator framework, and an operator entrypoint,
usually `src/charm.py`. See `charmcraft init` to create a
template charm directory structure.
For the bundle you must already have a `bundle.yaml` (can be
generated by Juju) and a README.md file.
Options:
-h, --help: Show this help message and exit
-v, --verbose: Show debug information and be more verbose
-q, --quiet: Only show warnings and errors, not progress
-t, --trace: Show all information needed to trace internal
behaviour
-p, --project-dir: Specify the project's directory (defaults to
current)
--debug: Launch shell in build environment upon failure
--destructive-mode: Pack charm using current host which may result
in breaking changes to system configuration
-e, --entrypoint: The executable which is the operator entry
point; defaults to 'src/charm.py'
-r, --requirement: File(s) listing needed PyPI dependencies (can
be used multiple times); defaults to
'requirements.txt'
--shell: Launch shell in build environment in lieu of
packing
--shell-after: Launch shell in build environment after packing
--bases-index: Index of 'bases' configuration to build (can be
used multiple times); defaults to all
--force: Force packing even after finding lint errors
See also:
analyze
build
clean
init
version
For a summary of all commands, run 'charmcraft help --all'.