From 2e56353ab60f8adeb2f119db62a47c9d5090e015 Mon Sep 17 00:00:00 2001 From: Swetha Swaminathan Date: Thu, 16 Jan 2025 16:48:40 +0530 Subject: [PATCH 1/2] Update template to remove metadata --- charmcraft.yaml | 38 +++++++++++++++++++++++++++++++++++++ metadata.yaml | 50 ------------------------------------------------- 2 files changed, 38 insertions(+), 50 deletions(-) delete mode 100644 metadata.yaml diff --git a/charmcraft.yaml b/charmcraft.yaml index 44a6f57..4253c89 100644 --- a/charmcraft.yaml +++ b/charmcraft.yaml @@ -4,6 +4,24 @@ # See https://juju.is/docs/sdk/charmcraft-config for guidance. type: charm +name: is-charms-template +title: Charm Template +summary: A very short one-line summary of the charm. +links: + documentation: https://discourse.charmhub.io + issues: https://github.com/canonical/is-charms-template-repo/issues + source: https://github.com/canonical/is-charms-template-repo + contact: https://launchpad.net/~canonical-is-devops + +description: | + A single sentence that says what the charm is, concisely and memorably. + + A paragraph of one to three short sentences, that describe what the charm does. + + A third paragraph that explains what need the charm meets. + + Finally, a paragraph that describes whom the charm is useful for. + bases: - build-on: - name: ubuntu @@ -11,3 +29,23 @@ bases: run-on: - name: ubuntu channel: "22.04" + +# The containers and resources metadata apply to Kubernetes charms only. +# Remove them if not required. + +# Your workload’s containers. +containers: + httpbin: + resource: httpbin-image + +# This field populates the Resources tab on Charmhub. +resources: + # An OCI image resource for each container listed above. + # You may remove this if your charm will run without a workload sidecar container. + httpbin-image: + type: oci-image + description: OCI image for httpbin + # The upstream-source field is ignored by Juju. It is included here as a reference + # so the integration testing suite knows which image to deploy during testing. This field + # is also used by the 'canonical/charming-actions' Github action for automated releasing. + upstream-source: kennethreitz/httpbin diff --git a/metadata.yaml b/metadata.yaml deleted file mode 100644 index 4de832a..0000000 --- a/metadata.yaml +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 2025 Canonical Ltd. -# See LICENSE file for licensing details. -# This file populates the Overview on Charmhub. -# See https://juju.is/docs/sdk/metadata-reference for a checklist and guidance. - -# The charm package name, no spaces (required) -# See https://juju.is/docs/sdk/naming#heading--naming-charms for guidance. -name: is-charms-template - -# The following metadata are human-readable and will be published prominently on Charmhub. - -# (Recommended) -display-name: Charm Template - -# (Required) -summary: A very short one-line summary of the charm. -docs: https://discourse.charmhub.io -issues: https://github.com/canonical/is-charms-template-repo/issues -maintainers: - - https://launchpad.net/~canonical-is-devops -source: https://github.com/canonical/is-charms-template-repo - -description: | - A single sentence that says what the charm is, concisely and memorably. - - A paragraph of one to three short sentences, that describe what the charm does. - - A third paragraph that explains what need the charm meets. - - Finally, a paragraph that describes whom the charm is useful for. - -# The containers and resources metadata apply to Kubernetes charms only. -# Remove them if not required. - -# Your workload’s containers. -containers: - httpbin: - resource: httpbin-image - -# This field populates the Resources tab on Charmhub. -resources: - # An OCI image resource for each container listed above. - # You may remove this if your charm will run without a workload sidecar container. - httpbin-image: - type: oci-image - description: OCI image for httpbin - # The upstream-source field is ignored by Juju. It is included here as a reference - # so the integration testing suite knows which image to deploy during testing. This field - # is also used by the 'canonical/charming-actions' Github action for automated releasing. - upstream-source: kennethreitz/httpbin From 406f1d863222c2994e76d62e646fb5c28e7daf4d Mon Sep 17 00:00:00 2001 From: Swetha Swaminathan Date: Thu, 16 Jan 2025 21:12:48 +0530 Subject: [PATCH 2/2] Update integration test to remove metadata --- tests/integration/test_charm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/integration/test_charm.py b/tests/integration/test_charm.py index d03d0c6..3bc3268 100644 --- a/tests/integration/test_charm.py +++ b/tests/integration/test_charm.py @@ -15,8 +15,8 @@ logger = logging.getLogger(__name__) -METADATA = yaml.safe_load(Path("./metadata.yaml").read_text(encoding="utf-8")) -APP_NAME = METADATA["name"] +CHARMCRAFT_DATA = yaml.safe_load(Path("./charmcraft.yaml").read_text(encoding="utf-8")) +APP_NAME = CHARMCRAFT_DATA["name"] @pytest.mark.abort_on_fail @@ -27,7 +27,7 @@ async def test_build_and_deploy(ops_test: OpsTest, pytestconfig: pytest.Config): """ # Deploy the charm and wait for active/idle status charm = pytestconfig.getoption("--charm-file") - resources = {"httpbin-image": METADATA["resources"]["httpbin-image"]["upstream-source"]} + resources = {"httpbin-image": CHARMCRAFT_DATA["resources"]["httpbin-image"]["upstream-source"]} assert ops_test.model await asyncio.gather( ops_test.model.deploy(