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

charm push allows pushing of a charm that's not been built #143

Open
mitechie opened this issue Aug 31, 2017 · 8 comments
Open

charm push allows pushing of a charm that's not been built #143

mitechie opened this issue Aug 31, 2017 · 8 comments
Milestone

Comments

@mitechie
Copy link

It should detect that I have a layer.yaml file and if there's no hooks directory fail to push the charm. This would prevent sending up the unbuilt version of the code up to the charmstore.

@kwmonroe
Copy link
Member

kwmonroe commented Sep 1, 2017

I ran charm proof on a layer and got the following:

$ charm proof
I: metadata name (giraph) must match directory name (layer-giraph) exactly for local deployment.
I: no hooks directory
I: missing recommended hook install
I: missing recommended hook start
I: missing recommended hook stop
I: File config.yaml not found.

Perhaps we should change the I: no hooks directory to an E, and require charm push to run proof first. That way, push would fail because proof would fail. Also, we shouldn't let people push charms that don't pass proof.

@johnsca
Copy link
Contributor

johnsca commented Jan 29, 2018

I think just detecting the presence or lack of a .build.manifest file should be enough. If that's missing, disable push (or, better yet, require a --force option).

It looks like this would be the section of code to modify.

@kwmonroe
Copy link
Member

Just hit this again when someone accidentally pushed/released a charm layer:

https://jujucharms.com/telegraf/8

While it does have a ./hooks directory, it does not have a ./wheelhouse, or other things you would expect in a built reactive charm. +1 to @johnsca for having proof or push or release check for -f layer.yaml && -f .build.manifest before allowing the action to succeed.

@johnsca
Copy link
Contributor

johnsca commented Jan 29, 2018

Not all charms will have a layer.yaml. It's also technically valid to have a charm with no hooks, though it would be pointless in practice. I'm fine with either -f .build.manifest or making the check for the hooks directory fatal and forcing proof before push.

@johnsca
Copy link
Contributor

johnsca commented Jan 29, 2018

Oh, I missed the bit about having hooks leading to false positives. Could do both, but the .build.manifest check would be quick and easy.

@johnsca
Copy link
Contributor

johnsca commented Jan 29, 2018

I also just realized that I misread what you were saying about layers.yaml. I agree that the condition should be something like:

if not force and (-f layer.yaml and not -f .build.manifest):
    fail "Attempting to push source layer"

@fabricematrat
Copy link
Contributor

juju/charmstore#769

@johnsca
Copy link
Contributor

johnsca commented Aug 1, 2018

@kwmonroe I should note that, since charm proof is implemented in charm-tools, it would likely be too difficult to be practical to have charm push gate on it, unless we wrapped charm push in charm-tools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants