def main(): """Update build statuses and badges.""" if len(sys.argv) != 2: usage() projects_dir = sys.argv[1] projects = scan_project_names(projects_dir) credentials = GoogleCredentials.get_application_default() cloudbuild = gcb_build('cloudbuild', 'v1', credentials=credentials) builds = get_builds(cloudbuild) update_build_status(builds, projects, build_project.FUZZING_BUILD_TAG, status_filename='status.json') update_build_status(builds, projects, build_and_run_coverage.COVERAGE_BUILD_TAG, status_filename='status-coverage.json') update_build_badges(builds, projects, build_tag=build_project.FUZZING_BUILD_TAG, coverage_tag=build_and_run_coverage.COVERAGE_BUILD_TAG)
def main(): if len(sys.argv) != 2: usage() projects_dir = sys.argv[1] credentials = GoogleCredentials.get_application_default() cloudbuild = gcb_build('cloudbuild', 'v1', credentials=credentials) successes = [] failures = [] for project in scan_project_names(projects_dir): print project query_filter = ('images="gcr.io/oss-fuzz/{0}" AND tags="{1}"'.format( project, build_project.FUZZING_BUILD_TAG)) try: response = execute_with_retries( cloudbuild.projects().builds().list(projectId='oss-fuzz', pageSize=2, filter=query_filter)) except googleapiclient.errors.HttpError as e: print >> sys.stderr, 'Failed to list builds for', project, ':', str( e) continue if not 'builds' in response: continue builds = response['builds'] last_build = find_last_build(builds) if not last_build: print >> sys.stderr, 'Failed to get build for', project continue print last_build['startTime'], last_build['status'], last_build['id'] if is_build_successful(last_build): successes.append({ 'name': project, 'build_id': last_build['id'], 'finish_time': last_build['finishTime'], 'success': True, }) else: failures.append({ 'name': project, 'build_id': last_build['id'], 'finish_time': last_build['finishTime'], 'success': False, }) upload_status(successes, failures)
def main(): if len(sys.argv) != 2: usage() projects_dir = sys.argv[1] projects = scan_project_names(projects_dir) credentials = GoogleCredentials.get_application_default() cloudbuild = gcb_build('cloudbuild', 'v1', credentials=credentials) builds = get_builds(cloudbuild) update_build_status(builds, projects, build_project.FUZZING_BUILD_TAG, status_filename='status.json') update_build_status(builds, projects, build_and_run_coverage.COVERAGE_BUILD_TAG, status_filename='status-coverage.json')
def main(): if len(sys.argv) != 2: usage() projects_dir = sys.argv[1] credentials = GoogleCredentials.get_application_default() cloudbuild = gcb_build('cloudbuild', 'v1', credentials=credentials) successes = [] failures = [] for project in scan_project_names(projects_dir): print project query_filter = ('(status="SUCCESS" OR status="FAILURE") AND ' + 'images="gcr.io/oss-fuzz/{0}"'.format(project)) response = cloudbuild.projects().builds().list( projectId='oss-fuzz', filter=query_filter).execute() if not 'builds' in response: continue builds = response['builds'] last_build = find_last_build(builds) if not last_build: print >> sys.stderr, 'Failed to get build for', project continue print last_build['startTime'], last_build['status'], last_build['id'] if is_build_successful(last_build): successes.append({ 'name': project, 'build_id': last_build['id'], 'finish_time': last_build['finishTime'], 'success': True, }) else: failures.append({ 'name': project, 'build_id': last_build['id'], 'finish_time': last_build['finishTime'], 'success': False, }) upload_status(successes, failures)