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

hook-deploy CLI always creates new hook instead of updating existing #14

Open
kolya-ay opened this issue Dec 3, 2017 · 7 comments
Open

Comments

@kolya-ay
Copy link

kolya-ay commented Dec 3, 2017

Is that by design?

Currently I workaround this by creating custom update utility, but it's not convenient at all. Is there plans to allow passing config params through environment variables, i.e for CD needs?

@Marak
Copy link
Collaborator

Marak commented Dec 3, 2017

That shouldn't be happening.

Are you seeing duplicate hooks with the same name? It shouldn't be possible to create multiple hooks with the same name.

Can you provide steps to reproduce?

@kolya-ay
Copy link
Author

kolya-ay commented Dec 3, 2017

Thank you for immediate response. hook.io looks very cool, but a bit uncrowned here and there.

Are you seeing duplicate hooks with the same name?

Yes, just tried

$ mkdir hook
$ echo "module.exports = () => console.log('Hello world');" > hook/broken.js
$ node_modules/.bin/hook deploy hook/broken.js
$ node_modules/.bin/hook deploy hook/broken.js

Two last commands give the same message created new service at: https://hook.io/kolya-ay/hookbroken-js. I can provide you my production.json if it's necessary.

@Marak
Copy link
Collaborator

Marak commented Dec 3, 2017

Thanks for the additional information. I agree that the production site still needs improvement, we are actively working on it.

I'm guessing this issue may be because there isn't a package.json manifest for the service. I'm not certain we support the command syntax you are trying to use. I'll see what I can do about making sure we catch the error condition causing this confusing created message.

Can you try running hook-init in the folder for your service? From there you can define the entry point and service name. Once initialized you should be able to hook deploy

@Marak
Copy link
Collaborator

Marak commented Dec 3, 2017

I also just noticed that the example code you posted isn't using the hook.res or res variable which is required for JavaScript services in order to end the request.

For more examples you can try deploying any of these folders: https://github.com/stackvana/microcule-examples

Marak added a commit that referenced this issue Dec 3, 2017
  * Ensures ENOENT package error is sent to user
  * Adds confirmation step to deploy
  * Adds yes/no CLI helper
Marak added a commit that referenced this issue Dec 4, 2017
  * Can now deploy single files without package
  * Moves require logic from `Hook.deploy` to bin
  * Should resolve #14
@Marak Marak reopened this Dec 4, 2017
@Marak
Copy link
Collaborator

Marak commented Dec 4, 2017

Didn't mean to close the issue yet.

I've updated master to fix this deployment issue, as well as generally improve the hook-deploy command.

The crux of the issue was that sdk client previously was unable to smoothly deploy single files without a valid package.json file. Now it should be possible to deploy either a folder with a package.json, or a single file.

We should be pushing out a new sdk release and production update soon.

@kolya-ay
Copy link
Author

kolya-ay commented Dec 4, 2017

Thank you. Just hadn't found in the docs that package.json is required or either used somehow. I'm totally fine with that especially because it addresses my another question how to specify exact hook name from command line;)

I think also that package.json semantic could be extended to optionally contain some data from the hook.io-sdk/config manifest. It's just my suggestion but it seems to be the right place (user/email fields are already there). It may be related to global hook config the same way as git system/git local configurations relate to each other. This would partially solve CI deployment issue. Not sure how to deal with the private_key though.

By the way, where is the right place to ask questions or make feature requests? Is there some slack/gitter channel?

Fill free to close the issue as my particular use-case is satisfied.

@Marak
Copy link
Collaborator

Marak commented Dec 4, 2017

@kolya-ay -

Would it help at all if we exposed hook_private_key and user and other config properties as arguments to the CLI commands? Are you trying to run hook-deploy binary as part of a CD script?

It might make more sense for you to create a custom deployment script doing something like:

var sdk = require("hook.io-sdk");

var client = sdk.createClient({
  // custom configuration goes here
});

client.hook.deploy(pkg, function (err, res){
  console.log(err, res)
});

The best place to request features is as Github Issues or the related repos or using http://hook.io/wishlist

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

No branches or pull requests

2 participants