Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Cleanups and fixes #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

harlowja
Copy link

Two commits (ya)! One is bigger :-/

- Allow the webhook to run on 0.0.0.0 so that it can
  be called by others.
- Add log verbosity option (so it is not always
  debug).
- Allow clients from config to pass there own proxy
  timeout (used when sending calls to them); defaults
  to a new global (PROXY_TIMEOUT)
- Use the github meta cidrs and validate against them
  and cache them (in memory) for up to 1 hour.
- Avoid blocking the response back to github and have
  all the proxying happen on a different part of the
  event loop (this way github will get a 200 back very
  quickly).
- Pass through 'X-GitHub-Delivery' header
- Use the right imports (flake8 errors fixed).
- Add in allowed ips from configuration (used along with
  the github cidrs to validate incoming ips); useful
  to allow specific other ips to call into post hooks.
- Logging cleanups and improvements.
- Import the right things (vs not).
@SpamapS SpamapS requested a review from jamielennox September 21, 2018 21:34
Copy link
Contributor

@jamielennox jamielennox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @harlowja 👋

So I'd need to remember how all this works and spin up an environment to actually test this out. The review notes are just first glance things.

The BonnyCI org hasn't been active in about a year now, are you looking to use this for something? I've been out of the Zuul loop, but i'm sure we'd be happy to donate it if it's useful to you.

What's the goal updating the old repo?

I'm happy someone's looking at this stuff again, there's some good bits in here :)

now = time.monotonic()
if (self.hook_blocks.last_updated is None or
(now - self.hook_blocks.last_updated) > GITHUB_META_CACHE_TTL):
resp = requests.get(GITHUB_META_URL,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would be a sync request in an async block.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose that could be changed, though I'm hoping its once per hour so does it matter that much?


def sig_handler():
LOG.info("Reloading configuration from %s", app.config_file)
app.load_config()

if app:
app.loop.add_signal_handler(signal.SIGHUP, sig_handler)
aiohttp.web.run_app(app.app, host='127.0.0.1', port=8080)
if opts.expose:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would prefer to specify a bind IP address, more generally useful. (although maybe less so in a docker world)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

@harlowja
Copy link
Author

And also 👋 lol

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

Successfully merging this pull request may close these issues.

2 participants