feat: deprecate 'series' in metadata.yaml & patch linter (#1376)
Patch the metadata linter to fail if the 'series' key is present. For a
long time charmcraft has generated a manifest.yaml on pack which has
been used instead series in metadata.
Juju ignores 'series' in metadata for any packed charm (i.e. a charm
with a manifest.yaml)
There is an effort to remove the notion of a series from Juju entirely,
substituting it for bases. As such, Juju is roadmapped to deprecate
support for charms without manifest.yaml files in 3.4, removing support
entirely in 4.0 (i.e. showing an error).
Showing a linter error in `charmcraft analyze` will be a convenient way
to begin communicating this
As a flyby fix, remove whitespace from the end of line in the templates
## QA Steps
```
$ juju download kafka
Fetching charm "kafka" revision 123 using "stable" channel and base "amd64/ubuntu/22.04"
Install the "kafka" charm with:
juju deploy ./kafka_r123.charm
$ charmcraft analyze ./kafka_r123.charm
Attributes:
- language: python (https://juju.is/docs/sdk/charmcraft-analyzers-and-linters#heading--language)
- framework: operator (https://juju.is/docs/sdk/charmcraft-analyzers-and-linters#heading--framework)
Lint Errors:
- metadata: The metadata.yaml file contains deprecated attribute: series. (https://juju.is/docs/sdk/charmcraft-analyzers-and-linters#heading--metadata)
Lint OK:
- juju-actions: no issues found (https://juju.is/docs/sdk/charmcraft-analyzers-and-linters#heading--juju-actions)
- juju-config: no issues found (https://juju.is/docs/sdk/charmcraft-analyzers-and-linters#heading--juju-config)
- entrypoint: no issues found (https://juju.is/docs/sdk/charmcraft-analyzers-and-linters#heading--entrypoint)
$ unzip kafka.charm
$ rm kafka.charm
(edit metadata.yaml to remove series key)
$ cat metdata.yaml
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.
description: |
Kafka is an event streaming platform. This charm deploys and operates Kafka.
display-name: Kafka
issues: https://github.com/canonical/kafka-operator/issues/new
docs: https://discourse.charmhub.io/t/charmed-kafka-documentation/10288
maintainers:
- Marc Oppenheimer <email address hidden>
name: kafka
source: https://github.com/canonical/kafka-operator
summary: The Charmed Kafka Operator
peers:
cluster:
interface: cluster
restart:
interface: rolling_op
requires:
zookeeper:
interface: zookeeper
certificates:
interface: tls-certificates
limit: 1
optional: true
trusted-ca:
interface: tls-certificates
optional: true
trusted-certificate:
interface: tls-certificates
optional: true
provides:
kafka-client:
interface: kafka_client
cos-agent:
interface: cos_agent
storage:
data:
type: filesystem
description: Directories where the log data is stored
minimum-size: 10G
location: /var/snap/charmed-kafka/common/var/lib/kafka
multiple:
range: 1-
$ zip -r kafka_r123.charm .
$ charmcraft analyze kafka_r123.charm
Attributes:
- language: python (https://juju.is/docs/sdk/charmcraft-analyzers-and-linters#heading--language)
- framework: operator (https://juju.is/docs/sdk/charmcraft-analyzers-and-linters#heading--framework)
Lint OK:
- juju-actions: no issues found (https://juju.is/docs/sdk/charmcraft-analyzers-and-linters#heading--juju-actions)
- juju-config: no issues found (https://juju.is/docs/sdk/charmcraft-analyzers-and-linters#heading--juju-config)
- metadata: no issues found (https://juju.is/docs/sdk/charmcraft-analyzers-and-linters#heading--metadata)
- entrypoint: no issues found (https://juju.is/docs/sdk/charmcraft-analyzers-and-linters#heading--entrypoint)
```
## Documentation changes
https://juju.is/docs/sdk/charmcraft-analyzers-and-linters#heading--metadata
will require updating with the new linter check