diff options
| -rw-r--r-- | .gitignore | 4 | ||||
| -rw-r--r-- | README.rst | 32 | ||||
| -rwxr-xr-x | playground/execute.sh | 2 | ||||
| -rwxr-xr-x | playground/server.sh | 4 | ||||
| -rw-r--r-- | schemas_json/action.yaml | 2 | ||||
| -rw-r--r-- | schemas_json/server.yaml | 4 | ||||
| -rw-r--r-- | src_doit/__init__.py | 12 | ||||
| -rw-r--r-- | src_py/boxhatter/__init__.py (renamed from src_py/hatter/__init__.py) | 0 | ||||
| -rw-r--r-- | src_py/boxhatter/__main__.py (renamed from src_py/hatter/__main__.py) | 4 | ||||
| -rw-r--r-- | src_py/boxhatter/backend.py (renamed from src_py/hatter/backend.py) | 2 | ||||
| -rw-r--r-- | src_py/boxhatter/common.py (renamed from src_py/hatter/common.py) | 0 | ||||
| -rw-r--r-- | src_py/boxhatter/main.py (renamed from src_py/hatter/main.py) | 38 | ||||
| -rw-r--r-- | src_py/boxhatter/server.py (renamed from src_py/hatter/server.py) | 10 | ||||
| -rw-r--r-- | src_py/boxhatter/ui.py (renamed from src_py/hatter/ui.py) | 12 |
14 files changed, 63 insertions, 63 deletions
@@ -1,5 +1,5 @@ /.doit.* /build -/src_py/hatter/json_schema_repo.json -/src_py/hatter/ui/main.css +/src_py/boxhatter/json_schema_repo.json +/src_py/boxhatter/ui/main.css __pycache__ @@ -1,7 +1,7 @@ -Hatter -====== +Box Hatter +========== -Hatter is continuous integration server/executor. It provides isolated +Box Hatter is continuous integration server/executor. It provides isolated execution environments, for running automated actions, as containers managed by podman. @@ -28,35 +28,35 @@ Install :: - $ pip install hatter + $ pip install boxhatter Running ------- -Hatter enables execution of actions described by simple YAML files which +Box Hatter enables execution of actions described by simple YAML files which contain container image name and Posix shell execution script. Actions files are stored as part of git repositories (default name of action file is -`.hatter.yaml`, stored in root of git working tree). +`.boxhatter.yaml`, stored in root of git working tree). These actions can be executed with:: - $ hatter execute <path> + $ boxhatter execute <path> where ``<path>`` is path to git repository containing action definition. Referenced git repository can be local or remote. -Additionally, hatter can be run as daemon providing web server interface:: +Additionally, Box Hatter can be run as daemon providing web server interface:: - $ hatter server + $ boxhatter server -When run as server, hatter periodically lists configured git repository +When run as server, Box Hatter periodically lists configured git repository references, and schedules action executions if new commits are available. New commit checking can also be triggered by webhooks available at listening `/repo/<repo_name>/webhook` URL path (``<repo_name>`` is configured repository name). -Hatter server provides basic web GUI which can be used for monitoring +Box Hatter server provides basic web GUI which can be used for monitoring action executions and scheduling new executions based on user provided git reference. @@ -65,13 +65,13 @@ Action and server configurations are defined and documented by JSON schemas For additional options, see:: - $ hatter --help + $ boxhatter --help Configuration example --------------------- -* `.hatter.yaml` +* `.boxhatter.yaml` :: @@ -93,7 +93,7 @@ Configuration example Build ----- -Build tool used for Hatter is pydoit (`<http://pydoit.org>`_). It can be +Build tool used for Box Hatter is pydoit (`<http://pydoit.org>`_). It can be installed together with other python dependencies by running:: $ pip install -r requirements.pip.dev.txt @@ -106,13 +106,13 @@ Default task:: $ doit -creates `build` folder containing Hatter distribution. +creates `build` folder containing Box Hatter distribution. License ------- -hatter - continuous integration server/executor +boxhatter - continuous integration server/executor Copyright (C) 2017-2022 Bozo Kopic This program is free software: you can redistribute it and/or modify diff --git a/playground/execute.sh b/playground/execute.sh index 0325904..879b987 100755 --- a/playground/execute.sh +++ b/playground/execute.sh @@ -2,5 +2,5 @@ . $(dirname -- "$0")/env.sh -exec $PYTHON -m hatter execute \ +exec $PYTHON -m boxhatter execute \ "$@" diff --git a/playground/server.sh b/playground/server.sh index 567ff81..3002f3d 100755 --- a/playground/server.sh +++ b/playground/server.sh @@ -2,7 +2,7 @@ . $(dirname -- "$0")/env.sh -exec $PYTHON -m hatter server \ +exec $PYTHON -m boxhatter server \ --conf $RUN_PATH/server.yaml \ - --db $DATA_PATH/hatter.db \ + --db $DATA_PATH/boxhatter.db \ "$@" diff --git a/schemas_json/action.yaml b/schemas_json/action.yaml index 67f6550..8f823de 100644 --- a/schemas_json/action.yaml +++ b/schemas_json/action.yaml @@ -1,6 +1,6 @@ --- "$schema": "http://json-schema.org/schema#" -id: "hatter://action.yaml#" +id: "boxhatter://action.yaml#" type: object required: - image diff --git a/schemas_json/server.yaml b/schemas_json/server.yaml index 988f811..198cae6 100644 --- a/schemas_json/server.yaml +++ b/schemas_json/server.yaml @@ -1,6 +1,6 @@ --- "$schema": "http://json-schema.org/schema#" -id: "hatter://server.yaml#" +id: "boxhatter://server.yaml#" type: object required: - repos @@ -36,7 +36,7 @@ properties: action: type: string decription: action file path inside repository - default: ".hatter.yaml" + default: ".boxhatter.yaml" min_sync_delay: type: - number diff --git a/src_doit/__init__.py b/src_doit/__init__.py index 231061d..7414d36 100644 --- a/src_doit/__init__.py +++ b/src_doit/__init__.py @@ -18,9 +18,9 @@ src_py_dir = Path('src_py') src_scss_dir = Path('src_scss') schemas_json_dir = Path('schemas_json') -ui_dir = src_py_dir / 'hatter/ui' +ui_dir = src_py_dir / 'boxhatter/ui' -json_schema_repo_path = src_py_dir / 'hatter/json_schema_repo.json' +json_schema_repo_path = src_py_dir / 'boxhatter/json_schema_repo.json' main_scss_path = src_scss_dir / 'main.scss' main_css_path = ui_dir / 'main.css' @@ -39,12 +39,12 @@ def task_wheel(): build_wheel( src_dir=src_py_dir, dst_dir=build_dir, - name='hatter', + name='boxhatter', description='Continuous integration server/executor', - url='https://github.com/bozokopic/hatter', + url='https://github.com/bozokopic/boxhatter', license=common.License.GPL3, - packages=['hatter'], - console_scripts=['hatter = hatter.main:main']) + packages=['boxhatter'], + console_scripts=['boxhatter = boxhatter.main:main']) return {'actions': [build], 'task_dep': ['json_schema_repo', diff --git a/src_py/hatter/__init__.py b/src_py/boxhatter/__init__.py index e69de29..e69de29 100644 --- a/src_py/hatter/__init__.py +++ b/src_py/boxhatter/__init__.py diff --git a/src_py/hatter/__main__.py b/src_py/boxhatter/__main__.py index 065fe88..fdd8f51 100644 --- a/src_py/hatter/__main__.py +++ b/src_py/boxhatter/__main__.py @@ -1,8 +1,8 @@ import sys -from hatter.main import main +from boxhatter.main import main if __name__ == '__main__': - sys.argv[0] = 'hatter' + sys.argv[0] = 'boxhatter' sys.exit(main()) diff --git a/src_py/hatter/backend.py b/src_py/boxhatter/backend.py index dd6a4f7..ad83851 100644 --- a/src_py/hatter/backend.py +++ b/src_py/boxhatter/backend.py @@ -4,7 +4,7 @@ import typing from hat import aio -from hatter import common +from boxhatter import common async def create(db_path: Path diff --git a/src_py/hatter/common.py b/src_py/boxhatter/common.py index ae314a5..ae314a5 100644 --- a/src_py/hatter/common.py +++ b/src_py/boxhatter/common.py diff --git a/src_py/hatter/main.py b/src_py/boxhatter/main.py index 8ceb892..2cc30cc 100644 --- a/src_py/hatter/main.py +++ b/src_py/boxhatter/main.py @@ -13,17 +13,17 @@ from hat import json import appdirs import click -from hatter import common -import hatter.backend -import hatter.server -import hatter.ui +from boxhatter import common +import boxhatter.backend +import boxhatter.server +import boxhatter.ui -user_config_dir: Path = Path(appdirs.user_config_dir('hatter')) -user_data_dir: Path = Path(appdirs.user_data_dir('hatter')) +user_config_dir: Path = Path(appdirs.user_config_dir('boxhatter')) +user_data_dir: Path = Path(appdirs.user_data_dir('boxhatter')) default_conf_path: Path = user_config_dir / 'server.yaml' -default_db_path: Path = user_data_dir / 'hatter.db' +default_db_path: Path = user_data_dir / 'boxhatter.db' ssh_key_path: typing.Optional[Path] = None @@ -58,7 +58,7 @@ def main(log_level: str, @main.command() -@click.option('--action', default='.hatter.yaml', +@click.option('--action', default='.boxhatter.yaml', help="action file path inside repository") @click.option('--env', multiple=True, help="environment variables") @@ -93,16 +93,16 @@ def execute(action: str, check=True) conf = json.decode_file(repo_dir / action) - common.json_schema_repo.validate('hatter://action.yaml#', conf) + common.json_schema_repo.validate('boxhatter://action.yaml#', conf) image = conf['image'] command = conf['command'] subprocess.run(['podman', 'run', '-i', '--rm', - '-v', f'{repo_dir}:/hatter', + '-v', f'{repo_dir}:/boxhatter', *itertools.chain.from_iterable(('--env', i) for i in env), image, '/bin/sh'], - input=f'set -e\ncd /hatter\n{command}\n', + input=f'set -e\ncd /boxhatter\n{command}\n', encoding='utf-8', check=True) @@ -113,17 +113,17 @@ def execute(action: str, @click.option('--port', default=24000, type=int, help="listening TCP port (default 24000)") @click.option('--conf', default=default_conf_path, metavar='PATH', type=Path, - help="configuration defined by hatter://server.yaml# " - "(default $XDG_CONFIG_HOME/hatter/server.yaml)") + help="configuration defined by boxhatter://server.yaml# " + "(default $XDG_CONFIG_HOME/boxhatter/server.yaml)") @click.option('--db', default=default_db_path, metavar='PATH', type=Path, help="sqlite database path " - "(default $XDG_CONFIG_HOME/hatter/hatter.db") + "(default $XDG_CONFIG_HOME/boxhatter/boxhatter.db") def server(host: str, port: int, conf: Path, db: Path): conf = json.decode_file(conf) - common.json_schema_repo.validate('hatter://server.yaml#', conf) + common.json_schema_repo.validate('boxhatter://server.yaml#', conf) with contextlib.suppress(asyncio.CancelledError): aio.run_asyncio(async_server(host, port, conf, db)) @@ -136,13 +136,13 @@ async def async_server(host: str, async_group = aio.Group() try: - backend = await hatter.backend.create(db_path) + backend = await boxhatter.backend.create(db_path) _bind_resource(async_group, backend) - server = await hatter.server.create(conf, backend) + server = await boxhatter.server.create(conf, backend) _bind_resource(async_group, server) - ui = await hatter.ui.create(host, port, server) + ui = await boxhatter.ui.create(host, port, server) _bind_resource(async_group, ui) await async_group.wait_closing() @@ -158,5 +158,5 @@ def _bind_resource(async_group, resource): if __name__ == '__main__': - sys.argv[0] = 'hatter' + sys.argv[0] = 'boxhatter' main() diff --git a/src_py/hatter/server.py b/src_py/boxhatter/server.py index 5f00707..24e4af0 100644 --- a/src_py/hatter/server.py +++ b/src_py/boxhatter/server.py @@ -12,12 +12,12 @@ import typing from hat import aio from hat import json -from hatter import common -import hatter.backend +from boxhatter import common +import boxhatter.backend async def create(conf: json.Data, - backend: hatter.backend.Backend + backend: boxhatter.backend.Backend ) -> 'Server': server = Server() server._conf = conf @@ -137,7 +137,7 @@ class Server(aio.Resource): while True: commit = await self._run_queue.get() repo_conf = self._conf['repos'][commit.repo] - action = repo_conf.get('action', '.hatter.yaml') + action = repo_conf.get('action', '.boxhatter.yaml') env = {**self._conf.get('env', {}), **repo_conf.get('env', {})} url = repo_conf['url'] @@ -169,7 +169,7 @@ class Server(aio.Resource): async def _execute(action, env, url, ref): - cmd = [sys.executable, '-m', 'hatter', 'execute', + cmd = [sys.executable, '-m', 'boxhatter', 'execute', '--action', action, *itertools.chain.from_iterable(('--env', i) for i in env), url, ref] diff --git a/src_py/hatter/ui.py b/src_py/boxhatter/ui.py index a10eede..2cf174d 100644 --- a/src_py/hatter/ui.py +++ b/src_py/boxhatter/ui.py @@ -4,8 +4,8 @@ import datetime from hat import aio import aiohttp.web -from hatter import common -import hatter.server +from boxhatter import common +import boxhatter.server static_dir: Path = common.package_path / 'ui' @@ -13,7 +13,7 @@ static_dir: Path = common.package_path / 'ui' async def create(host: str, port: int, - server: hatter.server.Server + server: boxhatter.server.Server ) -> 'UI': ui = UI() ui._server = server @@ -64,13 +64,13 @@ class UI(aio.Resource): body = (f'{_generate_repos(self._server.repos)}\n' f'{_generate_commits(commits)}') - return _create_html_response('hatter', body) + return _create_html_response('Box Hatter', body) async def _process_get_repo(self, request): repo = self._get_repo(request) commits = await self._server.get_commits(repo) - title = f'hatter - {repo}' + title = f'Box Hatter - {repo}' body = (f'{_generate_commits(commits)}\n' f'{_generate_run(repo)}') return _create_html_response(title, body) @@ -78,7 +78,7 @@ class UI(aio.Resource): async def _process_get_commit(self, request): commit = await self._get_commit(request) - title = f'hatter - {commit.repo}/{commit.hash}' + title = f'Box Hatter - {commit.repo}/{commit.hash}' body = _generate_commit(commit) return _create_html_response(title, body) |
