def run_build(oss_fuzz_project, build_steps, credentials, build_type, cloud_project='oss-fuzz', extra_tags=None): """Run the build for given steps on cloud build. |build_steps| are the steps to run. |credentials| are are used to authenticate to GCB and build in |cloud_project|. |oss_fuzz_project| and |build_type| are used to tag the build in GCB so the build can be queried for debugging purposes.""" if extra_tags is None: extra_tags = [] tags = [oss_fuzz_project + '-' + build_type, build_type, oss_fuzz_project] tags.extend(extra_tags) timeout = build_lib.BUILD_TIMEOUT body_overrides = { 'logsBucket': GCB_LOGS_BUCKET, 'queueTtl': str(QUEUE_TTL_SECONDS) + 's', } return build_lib.run_build(build_steps, credentials, cloud_project, timeout, body_overrides=body_overrides, tags=tags)
def run_build(steps, images, tags=None, build_version=MAJOR_TAG): """Execute the retrieved build steps in gcb.""" credentials, _ = google.auth.default() body_overrides = { 'images': images + [f'{image}:{build_version}' for image in images] } return build_lib.run_build(steps, credentials, BASE_PROJECT, body_overrides, tags)
def run_build(steps, images, tags=None, build_version=MAJOR_TAG): """Execute the retrieved build steps in gcb.""" credentials, _ = google.auth.default() body_overrides = { 'images': images + [f'{image}:{build_version}' for image in images], 'options': { 'machineType': 'E2_HIGHCPU_32' }, } return build_lib.run_build(steps, credentials, BASE_PROJECT, TIMEOUT, body_overrides, tags, use_build_pool=False)
def gcb_build_and_push_images(test_image_suffix): """Build and push test versions of base images using GCB.""" steps = [build_lib.get_git_clone_step()] test_images = [] for base_image in base_images.BASE_IMAGES: image_name = TAG_PREFIX + base_image test_image_name = f'{image_name}-{test_image_suffix}' test_images.append(test_image_name) directory = os.path.join('infra', 'base-images', base_image) step = build_lib.get_docker_build_step([image_name, test_image_name], directory, buildkit_cache_image=test_image_name) steps.append(step) overrides = {'images': test_images} credentials = oauth2client.client.GoogleCredentials.get_application_default() build_id = build_lib.run_build(steps, credentials, base_images.BASE_PROJECT, base_images.TIMEOUT, overrides, ['trial-build']) return trial_build.wait_on_builds({'base-images': build_id}, credentials, CLOUD_PROJECT)
def run_build(oss_fuzz_project, build_steps, credentials, build_type, cloud_project='oss-fuzz'): """Run the build for given steps on cloud build. |build_steps| are the steps to run. |credentials| are are used to authenticate to GCB and build in |cloud_project|. |oss_fuzz_project| and |build_type| are used to tag the build in GCB so the build can be queried for debugging purposes.""" tags = [oss_fuzz_project + '-' + build_type, build_type, oss_fuzz_project] timeout = build_lib.BUILD_TIMEOUT # TODO(navidem): This is temporary until I fix shorter failing projects. if build_type == 'introspector': timeout /= 4 body_overrides = { 'logsBucket': GCB_LOGS_BUCKET, 'queueTtl': str(QUEUE_TTL_SECONDS) + 's', } return build_lib.run_build(build_steps, credentials, cloud_project, timeout, body_overrides=body_overrides, tags=tags)