Stuck unable to publish, says store failure?

EDIT: For background this thread started out with an error due to missing some basic .py files to upload the hook… but as you can see at the tail end… I get stuck on an error involving the store… and unsure how to proceed…


I am not new to juju… but my charms are quite rudimentary. I am ready to start publishing a few simple ones (they simply install and setup JFrog Artifactories free C++ server … but when I goto charmpack I get an error because… I never had any python involved

:artifactory-ce-cpp-charm$ charmcraft pack
Charm entry point was not found: '/artifactory-ce-cpp-charm/src/charm.py' (full execution logs in /snap/charmcraft/common/charmcraft-log-6vwm294c)

is the best way to fix this … to utilize these instructions to start a vanilla charm??

charm create vanilla

1 Like

This hit me aswell some months ago, but I was under the impression it was resolved.

Perhaps you need to use charmcraft?

What documentation are you using?

@davidbooth might know more?

@jamesbeedy

1 Like

Hej @erik-lonroth thanks,

Yeah I pasted the charmcraft command above… maybe you mean I need to ignore this pack command? I just followed the publishing documentation linked above… One comment I got back from my colleague was, he is very used to one place for all documentation and right now the charm docs are a bit scattered… I am thinking this is a known issue and it takes some volunteering to translate discourse posts and articles into something more… if there’s an effort underway perhaps I can help?

2 Likes

@emcp - I totally agree here aswell and I know documentation and all this takes some time to decrypt - and as you say - figure out how it works.

I also agree on the fragmentation of documentation, but it is what it is at the moment. @pedroleaoc is a guy that takes this seriously at the moment.

I can probably help you through this if you need since I’m in the process aswell.

What state is your charm in at the moment? Can I see it ?

1 Like

… Not long ago, it wasn’t possible to even build a hooks-only charm…

https://github.com/canonical/charmcraft/pull/335

@jnsgruk might have updates on this topic “Are bash charms allowed to be published” aswell?

1 Like

here you go https://github.com/JRGEMCP/artifactory-ce-cpp-charm.git

it’s quite rough so… feedback welcome!

tack

2 Likes

Jon and David are on PTO, bu I’ve asked someone from the team to take a look into bash charms.

About documentation, my thinki-- you know what, I will just open a new topic :sweat_smile: Organising documentation

1 Like

If you’re starting with Juju and charming, the recommended way would be for you to start using the Operator Framework, can read all the documentation here.

TL;DR: just do charmcraft init and you will have a template of a Operator Charm, then you can fill in with a couple of Python lines and that will get you running.

All that said, charmcraft will support building all types of charms, see here.

Regards,

1 Like

Hi Facundo

Thanks for the tip, I will try that asap… I am aware of the python operators but will be honest the bash only hooks have gotten me quite far and I’ve not yet found a reason to pick the python operator framework up yet… I am sure as I get more and more steeped in production grade workloads beyond my hobbying this will change… for me the bash hooks is a fantastic method of getting not just myself bootstrapped but getting colleagues who are not python coders started up.

1 Like

Wonderful! Note though that using the Operator Framework is not just a matter of which language to use, but other aspects that are important in the medium/long term (e.g.: the framework provides a testing harness with which is super easy to have unittests for your charm)

1 Like

I love this kind of simplistic charms @emcp.

It shows that you don’t need 100 lines of code to get something started.

This is sooooo common of a misunderstanding of juju.

You do not need alot to get from nothing to a deploy with a general understanding of the state machine.

This is why it’s so important NOT to require a deep dev background to start with juju.

Your charm is fantastic just because it’s so incredibly simplistic.

2 Likes

What I would do though in your charm would be:

  • Implement all the core hook (despite them not being used). It’s good a good practice.
  • Add a config.yaml for the same reason.
1 Like

this charm now has a branch called make_publishable … and I was following the instructions again after a charmpark init and some fiddling with the removal of TODOs but now the error about namespace and the instructions don’t seem to talk about how to set a namespace

$ 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)

guessing I need to add a namespace in the metadata.yaml via namespace:charm-name

My quick googling seems to pop up only instructions talking about k8s charms, which these are not

$ cat ~/snap/charmcraft/common/charmcraft-log-kz_8eflj
2021-07-08 12:05:48,688  charmcraft.guard               DEBUG    Starting charmcraft version 1.0.0
2021-07-08 12:05:48,688  charmcraft.main                DEBUG    Raw pre-parsed sysargs: args={'help': False, 'verbose': False, 'quiet': False, 'project_dir': None} filtered=['upload', 'artifactory-ce-cpp.charm']
2021-07-08 12:05:48,688  charmcraft.commands            DEBUG    Couldn't find config file ~/artifactory-ce-cpp-charm/charmcraft.yaml
2021-07-08 12:05:48,688  charmcraft.main                DEBUG    General parsed sysargs: command='upload' args=['artifactory-ce-cpp.charm']
2021-07-08 12:05:48,689  charmcraft.main                DEBUG    Command parsed sysargs: Namespace(filepath=PosixPath('artifactory-ce-cpp.charm'), release=None)
2021-07-08 12:05:48,706  charmcraft.commands.store      DEBUG    Starting to push artifactory-ce-cpp.charm
2021-07-08 12:05:49,304  charmcraft.commands.store      DEBUG    Uploading bytes ended, id <some_id>
2021-07-08 12:05:49,304  charmcraft.commands.store      DEBUG    Hitting the store: POST https://api.charmhub.io/v1/charm/artifactory-ce-cpp/revisions {'upload-id': '<some_id>'}
2021-07-08 12:05:49,304  charmcraft.commands.store      DEBUG    Loading credentials from file: '~/snap/charmcraft/common/config/charmcraft.credentials'
2021-07-08 12:05:51,715  charmcraft                     ERROR    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)

EDIT:

AH, I can see now I must get a charmcraft.yaml configuration file setup… and I have found the instructions for that here

I think I’m back on track then

One or two suggestions … and I wonder where do I ask or suggest this… but
1)
according to docs

From Charmcraft v0.8.0 onwards, this configuration file mandatory for packing bundles, but is optional optional for the rest of the commands.

when packing I got no warning at a lack of config… would be great to get that warning earlier in the chain of events

  1. charmcraft version not checkable in cli?

I did a quick charmcraft --version and the command was not there… nor does it show the version installed on charmcraft --help ?
maybe I am just daft and it is somewhere else? I installed via snap so maybe I can check what version I have that way?

Edit2: I’ve gotten the version now… i’m on v1.0.0

$ snap info charmcraft
name:      charmcraft
summary:   The charming tool
publisher: Canonical✓
store-url: https://snapcraft.io/charmcraft
license:   Apache-2.0
description: |
  Charmcraft enables charm creators to build, publish, and manage charmed operators for Kubernetes,
  metal and virtual machines.
commands:
  - charmcraft
snap-id:      gcqfpVCOUvmDuYT0Dh5PjdeGypSEzNdV
tracking:     latest/stable
refresh-date: yesterday at 10:42 CEST
channels:
  latest/stable:    1.0.0             2021-04-30 (403) 10MB -
  latest/candidate: 1.1.0             2021-07-05 (495) 30MB classic
  latest/beta:      1.1.0             2021-07-05 (495) 30MB classic
  latest/edge:      1.1.0+25.g4631091 2021-07-07 (503) 51MB classic
installed:          1.0.0                        (403) 10MB -

I found someone else with a slightly similar error… still not following exactly how to get this published but… I think it just requires that charmcraft config…

one thing I am seeing is the notion of private charm stores… but I haven’t quite grasped how I set that up… or how I get a namespace registered in the official charmstore

even when i fill in the charmcraft.yaml with the only required piece… I am getting same error about the store

$ cat charmcraft.yaml 
type: charm

I had to drop the rest, as I am on charmcraft 1.0 and it wasn’t recognizing base: key

$ 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-8znykcje)

feels like I am missing something here that has to do with registering or getting a namespace…?

$ charmcraft names
Name                      Type    Visibility    Status
artifactory-ce-cpp-charm  charm   public        registered

I just clicked for me that… this is a known issue and perhaps this charmcraft tool is still in the works… and for now I might be able to use the legacy tool charm push command instead… according to this

https://github.com/canonical/charmcraft/issues/329#issuecomment-834505269

$ 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

now what? I recall there was like a charm store interface but I cannot reach it everything seems to redirect now to the hub listing everyone elses operators

Thanks

Edit:

I think I got it …?

$ 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.

Question, did you register the name with charmcraft? See procedure here, thanks.

1 Like

indeed I thought I had… here’s the output from charmcraft names

$ charmcraft names
Name                      Type    Visibility    Status
artifactory-ce-cpp-charm  charm   public        registered

edit: I think I see the issue… I ad the name ____-charm on my project and repo… let me retry registering without the ____-charm at the end of the name… I think it picked it up from either my git repo name or something in my charms metadata.yaml lesson learned don’t name it like this going forward

EDIT2:

okay well… problem solved (sort of)… I’d dropped ___-charm from the charm in every place except the registration… and now … charmcraft upload works…

I updated the github ticket with the same

:~/artifactory-ce-cpp-charm$ charmcraft register artifactory-ce-cpp
You are now the publisher of charm 'artifactory-ce-cpp' in Charmhub.
:~/artifactory-ce-cpp-charm$ charmcraft names
Name                      Type    Visibility    Status
artifactory-ce-cpp        charm   public        registered
emcp-artifactory-ce-cpp   charm   public        published
names                     charm   public        registered
list                      charm   public        registered
artifactory-ce-cpp-charm  charm   public        registered
:~/artifactory-ce-cpp-charm$ ls -la
total 912
drwxrwxr-x 7 emcp emcp   4096 jul 11 18:17 .
drwxrwxr-x 3 emcp emcp   4096 jul  8 10:15 ..
-rw-rw-r-- 2 emcp emcp    214 jul  8 11:45 actions.yaml
-rw-rw-r-- 1 emcp emcp 854136 jul 11 18:12 artifactory-ce-cpp.charm
drwxrwxr-x 6 emcp emcp   4096 jul 11 18:12 build
-rw-rw-r-- 2 emcp emcp     12 jul  8 18:29 charmcraft.yaml
-rw-rw-r-- 2 emcp emcp    167 jul 11 18:17 config.yaml
-rw-rw-r-- 2 emcp emcp     99 jul  8 11:29 .flake8
drwxrwxr-x 8 emcp emcp   4096 jul 11 18:17 .git
-rw-rw-r-- 2 emcp emcp   1808 jul  8 12:04 .gitignore
drwxrwxr-x 2 emcp emcp   4096 jul  8 10:15 hooks
-rw-rw-r-- 1 emcp emcp     24 jul  8 11:29 .jujuignore
-rw-rw-r-- 2 emcp emcp    241 jul  8 10:15 metadata.yaml
-rw-rw-r-- 2 emcp emcp    575 jul  8 10:15 README.md
-rw-rw-r-- 2 emcp emcp     36 jul  8 11:29 requirements-dev.txt
-rw-rw-r-- 2 emcp emcp     13 jul  8 11:29 requirements.txt
-rwxrwxr-x 2 emcp emcp    336 jul  8 11:29 run_tests
-rw-rw-r-- 2 emcp emcp    186 jul  8 10:15 setup_ports.sh
drwxrwxr-x 2 emcp emcp   4096 jul  8 12:05 src
drwxrwxr-x 2 emcp emcp   4096 jul  8 11:45 tests
~/artifactory-ce-cpp-charm$ charmcraft upload artifactory-ce-cpp.charm
Revision 1 of 'artifactory-ce-cpp' created
~/artifactory-ce-cpp-charm$ 

feel stupid for not catching it but… charmcraft upload is confirmed then

2 Likes