diff --git a/README.md b/README.md index f6b8422..bc4859d 100644 --- a/README.md +++ b/README.md @@ -19,32 +19,46 @@ For running the controller: with permissions to create and delete service, deployment, ingress, secret and configmap resources. +## Developing + +- setup environment variables (start from `.env.sample`) +- create a virtualenv, make sure to have pip>=21.3.1 and `pip install -e .` +- run with `uvicorn runboat.app:app --reload --log-config=log-config-dev.yaml` + +## Author and contributors + +Authored by Stéphane Bidoul (@sbidoul). + +Contributions welcome. + ## TODO -Prototype: +Prototype (min required to do load testing): - plug it on a bunch of OCA and shopinvader repos to test load - handle init failures, add failed status -- basic API +- configuring many repos in a .env file may be difficult, switch to a toml file ? MVP: -- finish api +- deployment and more load testing - build/log and build/init-log api endpoints - report build status to github +- secure github webhooks - k8s init container timeout -- error handling in API +- better error handling in API (return 400 on user errors) - basic tests -- look at other TODO in code -- build and publis runboat container image -- deployment -- plug it on shopinvader and acsone to test on small scale -- create builds for all supported repos on startup (goes with sticky branches) -- advanced reaper (sticky branches) +- build and publish runboat container image - test what happens when the watcher looses connection to k8s +- look at other TODO in code to see if anything important remains +- basic UI (single page with a combo box to select repo and show builds by branch/pr, + with start/stop buttons) More: -- UI +- shiny UI - handle PR close (delete all builds for PR) - handle branch delete (delete all builds for branch) +- create builds for all supported repos on startup (goes with sticky branches) +- never undeploy last build of sticky branches +- make build images configurable (see `build_images.py`) diff --git a/log-config-dev.yaml b/log-config-dev.yaml new file mode 100644 index 0000000..604be08 --- /dev/null +++ b/log-config-dev.yaml @@ -0,0 +1,14 @@ +version: 1 +disable_existing_loggers: false +formatters: + rich: + datefmt: "[%X]" +handlers: + console: + class: rich.logging.RichHandler + level: NOTSET + formatter: rich + rich_tracebacks: true +root: + level: DEBUG + handlers: [console] diff --git a/pyproject.toml b/pyproject.toml index fae698b..9f69674 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,8 +13,9 @@ dependencies = [ "fastapi", "jinja2", "kubernetes_asyncio", - "uvicorn", "requests", # TODO for github, to replace by aiohttp or httpx + "rich", + "uvicorn", ] dynamic = ["version", "description"] diff --git a/requirements.txt b/requirements.txt index 0890dcb..16ad421 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,6 +8,8 @@ certifi==2021.10.8 chardet==4.0.0 charset-normalizer==2.0.7 click==8.0.3 +colorama==0.4.4 +commonmark==0.9.1 fastapi==0.70.0 h11==0.12.0 idna==3.3 @@ -16,9 +18,11 @@ kubernetes-asyncio==18.20.0 MarkupSafe==2.0.1 multidict==5.2.0 pydantic==1.8.2 +Pygments==2.10.0 python-dateutil==2.8.2 PyYAML==6.0 requests==2.26.0 +rich==10.12.0 six==1.16.0 sniffio==1.2.0 starlette==0.16.0 diff --git a/src/runboat/build_images.py b/src/runboat/build_images.py index a759366..f9f628f 100644 --- a/src/runboat/build_images.py +++ b/src/runboat/build_images.py @@ -22,8 +22,7 @@ def get_target_branch(branch_name: str) -> str: f"Malformed branch name {branch_name} " f"(it should start with an Odoo branch name)." ) - if mo: - key = mo.group(1) + key = mo.group(1) if key not in images: raise BranchNotSupported( f"No build image configured for {key} (from {branch_name})."