canonical / charmcraft

Collaborate, build and publish charmed operators for Kubernetes, Linux and Windows.
Apache License 2.0
65 stars 69 forks source link

charmcraft upload of "bash"/"hooks only" charm doesn't work #329

Closed erik78se closed 3 years ago

erik78se commented 3 years ago

I'm trying to upload a "hooks only charm" ............... that fails.

  1. The documentation on publishing does not cover this scenario at all https://juju.is/docs/sdk/publishing

  2. The video covering the process is now outdated and contains stuff that is invalid today. Such as referencing "--charm-file"-

  3. charmcraft upload fails when a simple "hooks only" charm has been zip:ed into a file.

    charmcraft upload gitlab-runner.charm
    The indicated zip file 'gitlab-runner.charm' is not a charm ('metadata.yaml' not found) nor a bundle ('bundle.yaml' not found). (full execution logs in /home/erik/snap/charmcraft/common/charmcraft-log-afu1wu5p)
erik78se commented 3 years ago

In the description of charmcraft (https://discourse.charmhub.io/t/release-1-0-0/4537) it say:

We recommend the Charmed Operator Framework for charm development, but Charmcraft will help you publish charms written in any language. ...

So, charms written in bash "should" work?

jameinel commented 3 years ago

charms written in bash might not be supported by charmcraft but should be usable by both the store and juju.

The actual error was no 'metadata.yaml' which is definitely needed by all parties involved. But it may be that charmcraft pack failed to assemble the contents because of other incompatibilities.

On Sun, May 2, 2021, 06:27 Erik Lönroth @.***> wrote:

In the description of charmcraft ( https://discourse.charmhub.io/t/release-1-0-0/4537) it say:

We recommend the Charmed Operator Framework for charm development, but Charmcraft will help you publish charms written in any language. ...

So, charms written in bash "should" work?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/canonical/charmcraft/issues/329#issuecomment-830786208, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABRQ7M6QRUKHAOE6EQ5UZ3TLUSHRANCNFSM437IBTMA .

erik78se commented 3 years ago

... but there is a metadata.yaml in my charm.

https://github.com/erik78se/charm-gitlab-runner

I don't know how to get my charm uploaded atm.

Should I use "charm push" instead?

Den sön 2 maj 2021 14:22John Arbash Meinel @.***> skrev:

charms written in bash might not be supported by charmcraft but should be usable by both the store and juju.

The actual error was no 'metadata.yaml' which is definitely needed by all parties involved. But it may be that charmcraft pack failed to assemble the contents because of other incompatibilities.

On Sun, May 2, 2021, 06:27 Erik Lönroth @.***> wrote:

In the description of charmcraft ( https://discourse.charmhub.io/t/release-1-0-0/4537) it say:

We recommend the Charmed Operator Framework for charm development, but Charmcraft will help you publish charms written in any language. ...

So, charms written in bash "should" work?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/canonical/charmcraft/issues/329#issuecomment-830786208 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AABRQ7M6QRUKHAOE6EQ5UZ3TLUSHRANCNFSM437IBTMA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/canonical/charmcraft/issues/329#issuecomment-830801431, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGPVK5TGMWZDSGUJGPM6GLTLU72BANCNFSM437IBTMA .

facundobatista commented 3 years ago

Hello erik78se,

Would you please attach here the building logs? You can see those by doing charmcraft build --verbose, thanks.

jameinel commented 3 years ago

The existing tooling (charm push) should still be working publishing to Charmstore. If you are using Juju 2.9, you can reference them as cs:~user/charm-name.

erik78se commented 3 years ago

Thanx for the update.

Den fre 7 maj 2021 17:14John Arbash Meinel @.***> skrev:

The existing tooling (charm push) should still be working publishing to Charmstore. If you are using Juju 2.9, you can reference them as cs:~user/charm-name.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/canonical/charmcraft/issues/329#issuecomment-834505269, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGPVK2IY52I6M3EWH4DGLDTMP7WPANCNFSM437IBTMA .

jnsgruk commented 3 years ago

@erik78se Let me know if you'd like a hand packaging your charms for publishing on Charmhub, but also feel free to carry on using the Charm Store as @jameinel stated above if that's easier.

For troubleshooting this particular issue, could you upload the gitlab-runner.charm you tried to push to Charmhub so we can take a look? Thanks.

erik78se commented 3 years ago

I really appreciate you taking the time to help me. But I headed out to refactoring to operator for the pieces.

I kind of agree on the line of charmcraft and operators which I think will lead to better charms long term.

But it's caused major issues for my/our legacy versions that still work well.

I will be able to get through this so I rather see you focus on the charmcraft tool to be a good experience also for other classes of charm than ops and K8.

Den fre 7 maj 2021 17:38Jon Seager @.***> skrev:

@erik78se https://github.com/erik78se Let me know if you'd like a hand packaging your charms for publishing on Charmhub, but also feel free to carry on using the Charm Store as @jameinel https://github.com/jameinel stated above if that's easier.

For troubleshooting this particular issue, could you upload the gitlab-runner.charm you tried to push to Charmhub so we can take a look? Thanks.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/canonical/charmcraft/issues/329#issuecomment-834541760, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGPVK6PY2Q7NXO5JDBNNZLTMQCN5ANCNFSM437IBTMA .

erik78se commented 3 years ago

https://charmhub.io/gitlab-runner

On Fri, May 7, 2021 at 5:54 PM Erik Lönroth @.***> wrote:

I really appreciate you taking the time to help me. But I headed out to refactoring to operator for the pieces.

I kind of agree on the line of charmcraft and operators which I think will lead to better charms long term.

But it's caused major issues for my/our legacy versions that still work well.

I will be able to get through this so I rather see you focus on the charmcraft tool to be a good experience also for other classes of charm than ops and K8.

Den fre 7 maj 2021 17:38Jon Seager @.***> skrev:

@erik78se https://github.com/erik78se Let me know if you'd like a hand packaging your charms for publishing on Charmhub, but also feel free to carry on using the Charm Store as @jameinel https://github.com/jameinel stated above if that's easier.

For troubleshooting this particular issue, could you upload the gitlab-runner.charm you tried to push to Charmhub so we can take a look? Thanks.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/canonical/charmcraft/issues/329#issuecomment-834541760, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGPVK6PY2Q7NXO5JDBNNZLTMQCN5ANCNFSM437IBTMA .

EMCP commented 3 years ago

I am now attempting to publish a similar charm... and stuck trying to use the charm store... reading this thread makes me wonder.. is the charm HUB different from the charm Store? I have added the required charmcraft init call .. saved and rebuilt... but still stuck as outline at this discourse

https://discourse.charmhub.io/t/stuck-unable-to-publish-says-store-failure/4804/12

$ charmcraft upload artifactory-ce-cpp.charm
Store failure! Name artifactory-ce-cpp not found in the charm namespace [code: resource-not-found] (full execution logs in ~/snap/charmcraft/common/charmcraft-log-kz_8eflj)

@erik78se did you get this working by using charmcraft push instead of charmcraft upload ?

latest code with configs/yamls is up at

https://github.com/JRGEMCP/artifactory-ce-cpp-charm/tree/make_publishable

In the end I am trying to upload a mix of public and private charms.. and just trying to start with a public one.. but if this flow differs for private charms I have not found directions other than the mention in the charmcraft.yaml about some store apis in order to get a private store

Thanks

EMCP commented 3 years ago

im just now realizing .. there are two tools at play and this tutorial actually is using a set of tools called charm .. is charmcraft superseding this eventually?

https://github.com/juju/charm-tools

https://juju.is/tutorials/tutorial-charm-development-part1#4-create-an-example-charm

should I switch to charm tool tp upload today?? or is charmcraft supposed to work ?

facundobatista commented 3 years ago

Hello @EMCP,

The recommended way of building charms is using the Operator Framework and the charmcraft tool. You can see the docs for this process.

charmcraft does not currently support packing "non Operator Framework" charms, but it will in the future.

Regarding your mention about "not public charms", I'm not sure if your idea is to push private charms to public Charmhub, or setup a private Charmhub somehow.

A couple of words about the "charmhub"/"charm store" confusion: the correct name is Charmhub (which can be accessed here from an end user perspective), but we tend to refer as "the store" to the backend system that serves that web site and which is what charmcraft interacts with).

Please let me know if we can help you with anything of this. Thanks!

EMCP commented 3 years ago

thank you @facundobatista , I indeed took your advice and proceeded to perform a charmcraft init as per https://discourse.charmhub.io/t/stuck-unable-to-publish-says-store-failure/4804/10?u=emcp

Where it got stuck was on the

$ charmcraft upload artifactory-ce-cpp.charm
Store failure! Name artifactory-ce-cpp not found in the charm namespace [code: resource-not-found] (full execution logs in ~/snap/charmcraft/common/charmcraft-log-kz_8eflj)

which I worked around via

charm push artifactory-ce-cpp.charm artifactory-ce-cpp
Opening an authorization web page in your browser.
If it does not open, please open this URL:
https://api.jujucharms.com/identity/login?did=<SOME_ID>
url: cs:~emcp/artifactory-ce-cpp-0
channel: unpublished

and then

charm release cs:~emcp/artifactory-ce-cpp-0
url: cs:~emcp/artifactory-ce-cpp-0
channel: stable
warning: bugs-url and homepage are not set.  See set command.

I have not had time to test juju deploy cs:~emcp:..... yet .. but I imagine it will work and I can continue from there adding things as per charm proof recommendations..

I guess the error from charmcraft upload was triggered by maybe me missing something as per the Operator Framework.. I will have to re-read but I thought I had everything minimally required to publish fully.. but I could be wrong

facundobatista commented 3 years ago

You're mixing the tools. charmcraft works with the new Charmhub, charm works with the legacy one.

Let's use only the new one, charmcraft.

After doing charmcraft init, I guess that at some point you used build or pack to generate the .charm file. But before uploading it, you need to register the name, with charmcraft register, see the whole procedure here.

EMCP commented 3 years ago

I think I see my error now, replied in discourse

https://discourse.charmhub.io/t/stuck-unable-to-publish-says-store-failure/4804/17?u=emcp

basically I need to be very careful to register the name and if i drop say the ____-charm which had somehow been injected.. be sure to double check against whatever i register.

EDIT:

while in the CLI i inadvertantly created some names which are perhaps... not real names.. hoping I can just ignore it and move on but... just letting you know incase you or I need to erase names and list now... :(

Screen Shot 2021-07-12 at 21 52 18