diff --git a/infra/build/functions/base_images.py b/infra/build/functions/base_images.py index 7b6925bf2..7d411c6f3 100644 --- a/infra/build/functions/base_images.py +++ b/infra/build/functions/base_images.py @@ -102,8 +102,13 @@ def run_build(steps, images, tags=None, build_version=MAJOR_TAG): body_overrides = { 'images': images + [f'{image}:{build_version}' for image in images] } - return build_lib.run_build(steps, credentials, BASE_PROJECT, body_overrides, - tags) + return build_lib.run_build(steps, + credentials, + BASE_PROJECT, + TIMEOUT, + body_overrides, + tags, + use_build_pool=False) def base_builder(event, context): diff --git a/infra/build/functions/build_lib.py b/infra/build/functions/build_lib.py index 1faf5b9f9..f1e46dc52 100644 --- a/infra/build/functions/build_lib.py +++ b/infra/build/functions/build_lib.py @@ -74,10 +74,9 @@ ENGINE_INFO = { supported_architectures=['x86_64']), } -BUILDPOOL_NAME = os.getenv( +OSS_FUZZ_BUILDPOOL_NAME = os.getenv( 'GCB_BUILDPOOL_NAME', 'projects/oss-fuzz/locations/us-central1/' 'workerPools/buildpool') -DEFAULT_GCB_OPTIONS = {'pool': {'name': BUILDPOOL_NAME}} US_CENTRAL_CLIENT_OPTIONS = ClientOptions( api_endpoint='https://us-central1-cloudbuild.googleapis.com/') @@ -404,12 +403,15 @@ def get_gcb_url(build_id, cloud_project='oss-fuzz'): f'?project={cloud_project}') -def get_build_body(steps, timeout, body_overrides, tags): +def get_build_body(steps, timeout, body_overrides, tags, use_build_pool=True): """Helper function to create a build from |steps|.""" if 'GCB_OPTIONS' in os.environ: options = yaml.safe_load(os.environ['GCB_OPTIONS']) else: - options = DEFAULT_GCB_OPTIONS + options = {} + + if use_build_pool: + options['pool'] = {'name': OSS_FUZZ_BUILDPOOL_NAME} build_body = { 'steps': steps, @@ -432,10 +434,15 @@ def run_build( # pylint: disable=too-many-arguments cloud_project, timeout, body_overrides=None, - tags=None): + tags=None, + use_build_pool=True): """Runs the build.""" - build_body = get_build_body(steps, timeout, body_overrides, tags) + build_body = get_build_body(steps, + timeout, + body_overrides, + tags, + use_build_pool=use_build_pool) cloudbuild = cloud_build('cloudbuild', 'v1',