aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra/gcb/build_msan_libs.py
diff options
context:
space:
mode:
Diffstat (limited to 'infra/gcb/build_msan_libs.py')
-rwxr-xr-xinfra/gcb/build_msan_libs.py47
1 files changed, 36 insertions, 11 deletions
diff --git a/infra/gcb/build_msan_libs.py b/infra/gcb/build_msan_libs.py
index 4b58fd56..33526247 100755
--- a/infra/gcb/build_msan_libs.py
+++ b/infra/gcb/build_msan_libs.py
@@ -1,13 +1,29 @@
+# Copyright 2020 Google Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+################################################################################
#!/usr/bin/python2
"""Build base images on Google Cloud Builder.
Usage: build_base_images.py
"""
+from __future__ import print_function
import datetime
import os
-import yaml
import sys
+import yaml
from oauth2client.client import GoogleCredentials
from googleapiclient.discovery import build
@@ -15,18 +31,16 @@ from googleapiclient.discovery import build
import build_base_images
-def main():
- options = {}
- if 'GCB_OPTIONS' in os.environ:
- options = yaml.safe_load(os.environ['GCB_OPTIONS'])
+def get_steps(image):
+ """Get build steps for msan-libs-builder."""
+
+ timestamp = datetime.datetime.utcnow().strftime('%Y%m%d%H%M')
+ upload_name = 'msan-libs-' + timestamp + '.zip'
- image = 'gcr.io/oss-fuzz-base/msan-libs-builder'
steps = build_base_images.get_steps([
'base-sanitizer-libs-builder',
'msan-libs-builder',
])
- ts = datetime.datetime.utcnow().strftime('%Y%m%d%H%M')
- upload_name = 'msan-libs-' + ts + '.zip'
steps.extend([{
'name': image,
@@ -45,6 +59,18 @@ def main():
],
}])
+ return steps
+
+
+# pylint: disable=no-member
+def main():
+ """Build msan libs."""
+ options = {}
+ if 'GCB_OPTIONS' in os.environ:
+ options = yaml.safe_load(os.environ['GCB_OPTIONS'])
+
+ image = 'gcr.io/oss-fuzz-base/msan-libs-builder'
+ steps = get_steps(image)
build_body = {
'steps': steps,
'timeout': str(6 * 3600) + 's',
@@ -54,15 +80,14 @@ def main():
image,
],
}
-
credentials = GoogleCredentials.get_application_default()
cloudbuild = build('cloudbuild', 'v1', credentials=credentials)
build_info = cloudbuild.projects().builds().create(projectId='oss-fuzz-base',
body=build_body).execute()
build_id = build_info['metadata']['build']['id']
- print >> sys.stderr, 'Logs:', build_base_images.get_logs_url(build_id)
- print build_id
+ print('Logs:', build_base_images.get_logs_url(build_id), file=sys.stderr)
+ print(build_id)
if __name__ == '__main__':