Tweak routes

This commit is contained in:
Stéphane Bidoul 2021-11-06 11:02:01 +01:00
parent 87b1126721
commit a0052c878b
No known key found for this signature in database
GPG key ID: BCAB2555446B5B92
3 changed files with 5 additions and 3 deletions

View file

@ -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:

View file

@ -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)

View file

@ -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":