Giter VIP home page Giter VIP logo

Comments (9)

ryanbreen avatar ryanbreen commented on July 24, 2024

Yes, I believe this is covered by the hooks configuration of each repo. You configure the post-receive hook in Github or whatever to hit that web endpoint exposed by git2consul. Then, as soon as a commit is merged into a branch tracked by git2consul, the hook will notify git2consul and the appropriate action will be taken.

If that doesn't cover your use-case, please explain what I'm missing.

from git2consul.

michaelmior avatar michaelmior commented on July 24, 2024

I guess I could just write a simple post-receive hook which uses curl to hit the git2consul server. But if the repo is local to the server where I want to execute git2consul, it seems like there's no need for a server at all and I should just be able to call some executable to perform the changes. If that's not possible, I suppose it's not a big concern. It would just be nice not to have to deal with an additional server if it's not necessary.

from git2consul.

ryanbreen avatar ryanbreen commented on July 24, 2024

Ahh, I understand now. Let me give that some thought.

from git2consul.

ryanbreen avatar ryanbreen commented on July 24, 2024

I could see one or two ways to handle this. One is providing a simple webhook endpoint for git2consul (rather than the Stash / BitBucket / Github ones which expect certain formatting of an input POST). Then you could write a curl command, but it would be something obvious like curl -XPUT http://localhost/[branch_name]/ with a body like commit_id=abba1234cdecde. I like HTTP as the default means of sending commands to git2consul, so having curl be the thing your git hook calls feels OK to me.

Another option would be to allow git2consul to be pinged via signal, but there are a few issues with that. One is that a SIGHUP works fine on Unix but will terminate git2consul on Windows. The other is that a signal doesn't tell us which branch to update, so we would need to update all branches for all repos. Not the end of the world by any means, but it does feel like a broad brush.

Thoughts?

from git2consul.

michaelmior avatar michaelmior commented on July 24, 2024

How hard would it be to just not require the daemon to exist at all and have a separate binary which simply performs the updates when it runs?

from git2consul.

ryanbreen avatar ryanbreen commented on July 24, 2024

Ahh, a -runonce kind of option. I like that.

from git2consul.

ryanbreen avatar ryanbreen commented on July 24, 2024

Turns out that this is how git2consul works if you haven't registered any web listeners or polling hooks: it'll terminate as soon as all git -> consul operations are complete. The above patch gives us an option to make that behavior explicit.

from git2consul.

ryanbreen avatar ryanbreen commented on July 24, 2024

Let me know if this doesn't match your use case.

Thanks!

from git2consul.

michaelmior avatar michaelmior commented on July 24, 2024

I haven't had a chance to test this out, but it seems like it would do exactly what I was going for. Thanks!

from git2consul.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.