Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no hooks nor dispatch file after packing #2055

Open
zmraul opened this issue Dec 19, 2024 · 2 comments
Open

no hooks nor dispatch file after packing #2055

zmraul opened this issue Dec 19, 2024 · 2 comments
Labels
Bug Something isn't working triaged

Comments

@zmraul
Copy link

zmraul commented Dec 19, 2024

Bug Description

Packing a charm leads to the artifact only having the .yaml files inside it, thus failing to deploy.

To Reproduce

  1. Download application-charm on the tests of opensearch-operator.
  2. Change charmcraft.yaml to be the following:
base: [email protected]  # Also 24.04
platforms:
  amd64: null
type: charm
$ charmcraft pack
Packed application_amd64.charm
$ juju deploy ./application_amd64.charm
ERROR invalid charm "application": has no hooks nor dispatch file
  1. Checking the files the issue is shown:
$ unzip ./application_amd64.charm
Archive:  ../application_amd64.charm
  inflating: actions.yaml
  inflating: metadata.yaml
  inflating: manifest.yaml
$ ll
total 12K
-rw-r--r-- 1 raul raul 676 dic 19 10:58 actions.yaml
-rw-r--r-- 1 raul raul 255 dic 19 10:58 manifest.yaml
-rw-r--r-- 1 raul raul 509 dic 19 10:58 metadata.yaml

Environment

Ubuntu 22.04 LTS

charmcraft                      3.2.2                       5303   latest/stable       canonical✓       classic
lxd                             6.2-afb00d0                 31571  latest/stable       canonical✓       -

charmcraft.yaml

base: [email protected]  # Also 24.04
platforms:
  amd64: null
type: charm
@lengau
Copy link
Collaborator

lengau commented Dec 20, 2024

Thanks for the report. This is in a way expected, though the bug is that Charmcraft is still succeeding here, as it should be providing an error.

What's happening is that with the platforms key, we no longer create an implicit parts key like we did when the bases key was defined. Charmcraft should be failing if there are no parts to use. I'm guessing that the linked version is working because Charmcraft is falling back to the bases key behaviour of an implicit part when using the as-yet-unreleased platforms-only structure.

Adding the following parts key should fix the test charm:

parts:
  my-charm:
    source: .
    plugin: charm

So we need to address two things here:

  1. When platforms is defined but not base, still don't create an implicit part.
  2. After that pre-processing, fail if there aren't any parts.

@lengau lengau added the triaged label Dec 20, 2024
Copy link

Thank you for reporting your feedback to us!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-3851.

This message was autogenerated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working triaged
Projects
None yet
Development

No branches or pull requests

2 participants