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

charmcraft pack outputs different charm filenames depending on base/platform specification in charmcraft.yaml #2174

Open
PietroPasotti opened this issue Feb 14, 2025 · 8 comments
Labels
Bug Something isn't working

Comments

@PietroPasotti
Copy link

Bug Description

depending on whether you use the base: or the platforms: syntax in charmcraft.yaml, charmcraft will either create a [email protected], or a foo-ubuntu-22.04.charm file.

I believe the created files should have the same name regardless of the syntax that was used to specify them.

To Reproduce

charmcraft pack in https://github.com/canonical/parca-scrape-target-operator
charmcraft pack in https://github.com/canonical/parca-k8s-operator

Environment

candidate snap

charmcraft.yaml

n/a

Relevant log output

n/a
@PietroPasotti PietroPasotti added the Bug Something isn't working label Feb 14, 2025
@carlcsaposs-canonical
Copy link
Contributor

I think this could cause issues if you have multiple platforms built on the same base (e.g. to build two different "variants" of a charm [one with open source components & one with enterprise components]—implemented with different keys in platforms but same build-on and build-for), but not sure if charmcraft is supporting that use case

@carlcsaposs-canonical
Copy link
Contributor

@PietroPasotti to clarify, is the difference when using base vs platforms or when using bases vs platforms?

@lengau
Copy link
Collaborator

lengau commented Feb 14, 2025

Hi Pietro! Could you give me an example of the exact bases and platforms entries where this occurs? This is probably a side-effect of the multi-base platforms work (in which case the naming on the platforms syntax probably changed between 3.2 and 3.3).

@lengau
Copy link
Collaborator

lengau commented Feb 14, 2025

FWIW, when using the platforms syntax, Charmcraft should add exactly the platform name to your filename, so if you set the platform name to ubuntu-22.04 it should output foo-ubuuntu-22.04.charm, whereas if you set it to [email protected] it should output [email protected]. This might be an issue with the multi-base platforms work if we're requiring the platforms to have specific names.

@PietroPasotti
Copy link
Author

bases:
  - build-on:
      - name: "ubuntu"
        channel: "22.04"
    run-on:
      - name: "ubuntu"
        channel: "22.04"

vs

platforms:
  [email protected]:amd64:
  [email protected]:amd64:

@mr-cal
Copy link
Contributor

mr-cal commented Feb 14, 2025

I wonder if we should modify the bases->platforms conversion to match the shorthand multi-base syntax.

@lengau
Copy link
Collaborator

lengau commented Feb 18, 2025

I think this might be working as intended. We don't want to change the bases -> platforms conversion because that's intentionally kept the same from charmcraft 2.x, but the following platforms entry should provide the same output:

platforms:
  ubuntu-24.04-amd64:
    build-on: [[email protected]:amd64]
    build-for: [[email protected]:amd64]
  ubuntu-22.04-amd64:
    build-on: [[email protected]:amd64]
    build-for: [[email protected]:amd64]

Not sure if the current implementation accepts that input though. If it doesn't, it probably should.

@PietroPasotti
Copy link
Author

What do you mean with "it might be working as intended"?
Are you saying that my choice of one of N equivalent ways of declaring metadata are meant to determine the name of the output package?

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

No branches or pull requests

4 participants