From a0052c878bb2efaafd084d960ab5cccd09149ff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sat, 6 Nov 2021 11:02:01 +0100 Subject: [PATCH] Tweak routes --- README.md | 2 ++ src/runboat/app.py | 2 +- src/runboat/webhooks.py | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5fb9d28..e37912c 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,7 @@ in a different cluster. - create a virtualenv, make sure to have pip>=21.3.1 and `pip install -c requirements.txt -e .[test]` - run with `uvicorn runboat.app:app --log-config=log-config.yaml` +- api documentation is at `http://localhost:8000/docs` - run tests with `pytest` (environment variables used in tests are declared in `.env.test`) @@ -126,6 +127,7 @@ resources: Prototype (min required to open the project): +- ignore non-main branches in webhook - plug it on a bunch of OCA and shopinvader repos to test load MVP: diff --git a/src/runboat/app.py b/src/runboat/app.py index 288c3b1..fb52cd3 100644 --- a/src/runboat/app.py +++ b/src/runboat/app.py @@ -5,7 +5,7 @@ from . import __version__, api, controller, k8s, webhooks app = FastAPI( title="Runboat", description="Runbot on Kubernetes ☸️", version=__version__ ) -app.include_router(api.router) +app.include_router(api.router, prefix="/api/v1") app.include_router(webhooks.router) diff --git a/src/runboat/webhooks.py b/src/runboat/webhooks.py index 0088156..5290fe9 100644 --- a/src/runboat/webhooks.py +++ b/src/runboat/webhooks.py @@ -10,7 +10,7 @@ _logger = logging.getLogger(__name__) router = APIRouter() -@router.post("/webhook/github") +@router.post("/webhooks/github") async def receive_payload( background_tasks: BackgroundTasks, request: Request, @@ -23,7 +23,7 @@ async def receive_payload( return repo = repo.lower() if repo not in settings.supported_repos: - _logger.info(f"Ignoring webhook delivery for unsupported repo {repo}.") + _logger.debug(f"Ignoring webhook delivery for unsupported repo {repo}.") return action = payload.get("action") if x_github_event == "pull_request":