Esempio n. 1
0
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()
Esempio n. 2
0
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()