コード例 #1
0
ファイル: __init__.py プロジェクト: chandevel/buildtool
def run_build_cli(dry_run: bool, branch: str, commit_id: str):
    from app.build import Build
    from app.configuration import Configuration
    from app.runner import Runner

    conf = Configuration.from_file('config.yml', branch, commit_id)
    conf.dry_run = dry_run

    build = Build.from_configuration(conf)
    runner = Runner.from_build(build)
    runner.run()
コード例 #2
0
ファイル: server.py プロジェクト: chandevel/buildtool
def run_build(res):
    branch = res['ref'].rsplit('/', maxsplit=1)[1]

    tag = None
    if res['ref'].startswith('refs/heads/'):
        branch = res['ref'][len('refs/heads/'):]
    elif res['ref'].startswith('refs/tags/') and 'base_ref' in res:
        branch = res['base_ref'][len('refs/heads/'):]
        tag = res['ref'][len('refs/tags/'):]
    else:
        return

    commit_id = res['head_commit']['id']

    conf = Configuration.from_file('config.yml', branch, commit_id)
    if conf is None:
        return

    build = Build.from_configuration(conf)
    runner = Runner.from_build(build)
    runner.run()