def main(): if len(sys.argv) != 2: usage() project_dir = sys.argv[1].rstrip(os.path.sep) steps, image = get_build_steps(project_dir) build_project.run_build(steps, image, COVERAGE_BUILD_TAG)
def run_build(oss_fuzz_project, build_steps, credentials, build_type, cloud_project): """Execute build on cloud build. Wrapper around build_project.py that also updates the db.""" build_id = build_project.run_build(oss_fuzz_project, build_steps, credentials, build_type, cloud_project) update_build_history(oss_fuzz_project, build_id, build_type)
def main(): """Build and run coverage for projects.""" if len(sys.argv) != 2: usage() image_project = 'oss-fuzz' base_images_project = 'oss-fuzz-base' project_dir = sys.argv[1].rstrip(os.path.sep) project_name = os.path.basename(project_dir) dockerfile_path = os.path.join(project_dir, 'Dockerfile') project_yaml_path = os.path.join(project_dir, 'project.yaml') with open(dockerfile_path) as docker_file: dockerfile_lines = docker_file.readlines() with open(project_yaml_path) as project_yaml_file: steps = get_build_steps(project_name, project_yaml_file, dockerfile_lines, image_project, base_images_project) build_project.run_build(steps, project_name, COVERAGE_BUILD_TAG)
def _do_builds(args, config, credentials, build_type, projects): """Does |build_type| test builds of |projects|.""" build_ids = {} for project_name in projects: logging.info('Getting steps for: "%s".', project_name) try: project_yaml, dockerfile_contents = ( build_project.get_project_data(project_name)) except FileNotFoundError: logging.error('Couldn\'t get project data. Skipping %s.', project_name) continue build_project.set_yaml_defaults(project_yaml) print(project_yaml['sanitizers'], args.sanitizers) project_yaml_sanitizers = build_project.get_sanitizer_strings( project_yaml['sanitizers']) + ['coverage', 'introspector'] project_yaml['sanitizers'] = list( set(project_yaml_sanitizers).intersection(set(args.sanitizers))) project_yaml['fuzzing_engines'] = list( set(project_yaml['fuzzing_engines']).intersection( set(args.fuzzing_engines))) if not project_yaml['sanitizers'] or not project_yaml[ 'fuzzing_engines']: logging.info('Nothing to build for this project: %s.', project_name) continue steps = build_type.get_build_steps_func(project_name, project_yaml, dockerfile_contents, IMAGE_PROJECT, BASE_IMAGES_PROJECT, config) if not steps: logging.error('No steps. Skipping %s.', project_name) continue try: build_ids[project_name] = (build_project.run_build( project_name, steps, credentials, build_type.type_name, extra_tags=['trial-build'])) except Exception: # pylint: disable=broad-except # Handle flake. print('Failed to start build', project_name) return build_ids
def _do_builds(args, config, credentials, build_type, projects): """Does |build_type| test builds of |projects|.""" build_ids = {} for project_name in projects: logging.info('Getting steps for: "%s".', project_name) try: project_yaml, dockerfile_contents = ( build_project.get_project_data(project_name)) except FileNotFoundError: logging.error('Couldn\'t get project data. Skipping %s.', project_name) continue project_yaml['sanitizers'] = list( set(project_yaml['sanitizers']).intersection(set(args.sanitizers))) project_yaml['fuzzing_engines'] = list( set(project_yaml['fuzzing_engines']).intersection( set(args.fuzzing_engines))) if not project_yaml['sanitizers'] or not project_yaml[ 'fuzzing_engines']: logging.info('Nothing to build for this project: %s.', project_name) continue steps = build_type.get_build_steps_func(project_name, project_yaml, dockerfile_contents, IMAGE_PROJECT, BASE_IMAGES_PROJECT, config) if not steps: logging.error('No steps. Skipping %s.', project_name) continue build_ids[project_name] = (build_project.run_build( project_name, steps, credentials, build_type.type_name, extra_tags=['trial-build'])) return build_ids