Giter Site home page Giter Site logo

docker-hook's People

Contributors

karate avatar martinthoma avatar schickling avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-hook's Issues

Docs are inconsistent with current script

The README says the way to use docker-hook is

docker-hook my-super-safe-token ./deploy.sh

But you need to call it like

docker-hook -t my-super-safe-token -c ./deploy.sh

If you really want to have it without named arguments (but positional arguments), just remove the name (hence removing required=True and "-t", "--token", and "-c", "--cmd".

But I really like named arguments. It makes stuff much clearer.

Make AuthToken optional as a command-line argument

Giving the AuthToken as a command-line argument is not very secure, because it's visible in top, w and history. You could make the AuthToken argument optional, and fallback to a hardcoded value inside the scipt. So someone could put their AuthToken in the script, and call the script with

$ docker-hook -c <command>

I can make a PR if you're ok with it

Not working anymore with docker registry 2 ?

I see exceptions raised by docker-hook for every single action I do with my registry.

Exception happened during processing of request from ('127.0.0.1', 41065)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 655, in __init__
    self.handle()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
    self.handle_one_request()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
    method()
  File "/usr/local/bin/docker-hook", line 40, in do_POST
    for var, val in json_params['repository'].items())
KeyError: 'repository'

This issue comes from the fact that docker-hook expects the POSTed Json to contain a single event. Digging in the code, it seems that nothing is built to handle "grouped" events ({events: [...]})

Docker doc for registry notifications states:

While events may be sent in the same envelope, the set of events within that envelope have no implied relationship. For example, the registry may choose to group unrelated events and send them in the same envelope to reduce the total number of requests.

I am wondering if the script is made to be used with docker registry 2 (private registry) ?

Possible to have several docker-hook listning?

Hello,

When looking at the docs, it seems it's only possible to consume one web hook.

I have several projects on docker hub, that should deploy. The correct solution would be to have docker-hook to listning on different ports for the different projects ?

OSError: [Errno 8] Exec format error

I'm running docker-hock using this commandline:
docker-hook -t token -c ./mydeplyoscript.sh

When receiving the hook from Docker Hub I get this exception:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/local/lib/python2.7/SocketServer.py", line 321, in process_request
    self.finish_request(request, client_address)
  File "/usr/local/lib/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/local/lib/python2.7/SocketServer.py", line 649, in __init__
    self.handle()
  File "/usr/local/lib/python2.7/BaseHTTPServer.py", line 340, in handle
    self.handle_one_request()
  File "/usr/local/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
    method()
  File "/usr/local/bin/docker-hook", line 32, in do_POST
    Popen(args.cmd, env=env).wait()
  File "/usr/local/lib/python2.7/subprocess.py", line 709, in __init__
    errread, errwrite)
  File "/usr/local/lib/python2.7/subprocess.py", line 1326, in _execute_child
    raise child_exception
OSError: [Errno 8] Exec format error

When running ./mydeployscript.sh standalone, everything works fine.

store logs for executing script while running docker hook in background

I think docker-hook command not running in the background, So I've used nohup command to docker hook in the background.

I want to store logs in deploy.log when the script is executed by hook.
I've tried below command but it's not working
nohup docker-hook -t $SECRET_KEY -c sh <myscript.sh> >> /deploy.log > /dev/null 2>&1 &

Also, I've tried to pass -c params in " quotation but still logs are not going to deploy.log

nohup docker-hook -t $SECRET_KEY -c sh "sh <myscript.sh> >> /deploy.log" > /dev/null 2>&1 &

If AuthToken is not valid but contains substring of valid AuthToken request still works

I know this is a bit silly but I just noticed that if lets say my auth token is: testing123

$ curl -I -X POST localhost:8555/testing123
HTTP/1.0 200 OK
Server: BaseHTTP/0.3 Python/2.7.12
Date: Fri, 29 Jul 2016 05:34:57 GMT


$ curl -I -X POST localhost:8555/abctesting12356
HTTP/1.0 200 OK
Server: BaseHTTP/0.3 Python/2.7.12
Date: Fri, 29 Jul 2016 05:35:45 GMT

$ curl -I -X POST localhost:8555/abctesxting12356
HTTP/1.0 401 Not authorized
Server: BaseHTTP/0.3 Python/2.7.12
Date: Fri, 29 Jul 2016 05:35:58 GMT

Second request should not be supposed to work right?

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.