aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Oliver Chang <oliverchang@users.noreply.github.com>2022-05-02 11:26:44 +1000
committerGravatar GitHub <noreply@github.com>2022-05-02 11:26:44 +1000
commit03719efa0a0c33dd8cbf814891fc9832e4e1d765 (patch)
tree7ec63c9434f9d054cb9178ea345869db5f11a056
parente2edcfcbdd69193394211e3362c1e5465ad05c7b (diff)
Fix base image builds. (#7651)
Fixes #7650.
-rw-r--r--infra/build/functions/base_images.py9
-rw-r--r--infra/build/functions/build_lib.py19
2 files changed, 20 insertions, 8 deletions
diff --git a/infra/build/functions/base_images.py b/infra/build/functions/base_images.py
index 7b6925bf..7d411c6f 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 1faf5b9f..f1e46dc5 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',