コード例 #1
0
ファイル: base_images.py プロジェクト: tomrittervg/oss-fuzz
def base_builder(event, context):
  """Cloud function to build base images."""
  del event, context
  credentials, _ = google.auth.default()
  tag_prefix = f'gcr.io/{BASE_PROJECT}/'
  build_body = {
      'steps':
          build_base_images.get_steps(build_base_images.BASE_IMAGES,
                                      tag_prefix),
      'timeout':
          str(4 * 3600) + 's',
      'options': {
          'machineType': 'N1_HIGHCPU_32'
      },
      'images': [
          tag_prefix + base_image
          for base_image in build_base_images.BASE_IMAGES
      ],
  }
  cloudbuild = build('cloudbuild',
                     'v1',
                     credentials=credentials,
                     cache_discovery=False)
  build_info = cloudbuild.projects().builds().create(projectId=BASE_PROJECT,
                                                     body=build_body).execute()
  build_id = build_info['metadata']['build']['id']
  logging.info('Build ID: %s', build_id)
  logging.info('Logs: %s',
               build_base_images.get_logs_url(build_id, BASE_PROJECT))
コード例 #2
0
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'

    steps = build_base_images.get_steps([
        'base-sanitizer-libs-builder',
        'msan-libs-builder',
    ])

    steps.extend([{
        'name':
        image,
        'args': [
            'bash',
            '-c',
            'cd /msan && zip -r /workspace/libs.zip .',
        ],
    }, {
        'name':
        'gcr.io/cloud-builders/gsutil',
        'args': [
            'cp',
            '/workspace/libs.zip',
            'gs://oss-fuzz-msan-libs/' + upload_name,
        ],
    }])

    return steps
コード例 #3
0
def base_builder(event, context):
    """Cloud function to build base images."""
    del event, context

    tag_prefix = f'gcr.io/{BASE_PROJECT}/'
    steps = build_base_images.get_steps(build_base_images.BASE_IMAGES,
                                        tag_prefix)
    images = [
        tag_prefix + base_image for base_image in build_base_images.BASE_IMAGES
    ]

    run_build(steps, images)
コード例 #4
0
def main():
  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 = 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,
      'args': [
          'bash',
          '-c',
          'cd /msan && zip -r /workspace/libs.zip .',
      ],
  }, {
      'name':
          'gcr.io/cloud-builders/gsutil',
      'args': [
          'cp',
          '/workspace/libs.zip',
          'gs://oss-fuzz-msan-libs/' + upload_name,
      ],
  }])

  build_body = {
      'steps': steps,
      'timeout': str(6 * 3600) + 's',
      'options': options,
      'images': [
          'gcr.io/oss-fuzz-base/base-sanitizer-libs-builder',
          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
コード例 #5
0
ファイル: build_msan_libs.py プロジェクト: google/oss-fuzz
def main():
  options = {}
  if 'GCB_OPTIONS' in os.environ:
    options = yaml.safe_load(os.environ['GCB_OPTIONS'])

  image = 'gcr.io/oss-fuzz-base/msan-builder'
  steps = build_base_images.get_steps(['base-msan-builder', 'msan-builder'])
  ts = datetime.datetime.utcnow().strftime('%Y%m%d%H%M')
  upload_name = 'msan-libs-' + ts + '.zip'

  steps.extend([{
      'name': image,
      'args': [
          'bash',
          '-c',
          'cd /msan && zip -r /workspace/libs.zip .',
      ],
  }, {
      'name':
          'gcr.io/cloud-builders/gsutil',
      'args': [
          'cp',
          '/workspace/libs.zip',
          'gs://oss-fuzz-msan-libs/' + upload_name,
      ],
  }])

  build_body = {
      'steps': steps,
      'timeout': str(6 * 3600) + 's',
      'options': options,
      'images': [
          'gcr.io/oss-fuzz-base/base-msan-builder',
          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
コード例 #6
0
ファイル: build_msan_libs.py プロジェクト: titanous/oss-fuzz
def main():
    options = {}
    if "GCB_OPTIONS" in os.environ:
        options = yaml.safe_load(os.environ["GCB_OPTIONS"])

    build_body = {
        'steps': build_base_images.get_steps(['msan-builder']),
        'timeout': str(6 * 3600) + 's',
        'options': options,
        'images': [
            'gcr.io/oss-fuzz-base/msan-builder',
        ],
    }

    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 build_id