def ubuntu_builder(): project_name = 'test' working_dir = '/test' output_dir = '/out' tmp_dir = '/tmp' builder = UbuntuBuilder(project_name, working_dir, output_dir, tmp_dir) builder.run_command = mock.Mock() return UbuntuBuilder(project_name, working_dir, output_dir, tmp_dir)
def build(github_organization, github_repo, commit_hash_or_tag, source=None, logger=None): from bob import settings working_dir = os.path.expanduser(settings['bobb.work_dir']) output_dir = os.path.expanduser(settings['bobb.out_dir']) builder = UbuntuBuilder(github_repo, working_dir, output_dir, log_stream=logger) if not source: builder.prepare_workspace(github_organization, github_repo, commit_hash_or_tag) builder.parse_options() try: builder.prepare_system() builder.build() package_name = builder.package(commit_hash_or_tag) builder.upload(package_name) builder.notify_success(commit_hash_or_tag) except Exception as ex: builder.notify_failure(commit_hash_or_tag, ex) finally: builder.log('***finished***')