镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

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

Open

Description

@kolya-ay

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?

Activity

  1. Marak commented on Dec 3, 2017

    @Marak
    Collaborator

    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?

  2. kolya-ay commented on Dec 3, 2017

    @kolya-ay
    Author

    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.

  3. Marak commented on Dec 3, 2017

    @Marak
    Collaborator

    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

  4. Marak commented on Dec 3, 2017

    @Marak
    Collaborator

    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

  5. added a commit that references this issue on Dec 4, 2017
    7b0dbdf
  6. reopened this on Dec 4, 2017
  7. Marak commented on Dec 4, 2017

    @Marak
    Collaborator

    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.

  8. kolya-ay commented on Dec 4, 2017

    @kolya-ay
    Author

    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.

  9. Marak commented on Dec 4, 2017

    @Marak
    Collaborator

    @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions