示例#1
0
文件: buildbot.py 项目: fr0l/webkit
 def fetch_config(cls):
     config_url = 'https://{}/config.json'.format(
         config.BUILDBOT_SERVER_HOST)
     config_data = util.fetch_data_from_url(config_url)
     if not config_data:
         return {}
     return config_data.json()
示例#2
0
 def update_builder_name_to_id_mapping(cls):
     url = 'https://{}/api/v2/builders'.format(config.BUILDBOT_SERVER_HOST)
     builders_data = util.fetch_data_from_url(url)
     if not builders_data:
         return
     for builder in builders_data.json().get('builders', []):
         name = builder.get('name')
         Buildbot.builder_name_to_id_mapping[name] = builder.get('builderid')
示例#3
0
 def fetch_config(cls):
     config_url = 'https://{}/config.json'.format(config.BUILDBOT_SERVER_HOST)
     config_data = util.fetch_data_from_url(config_url)
     if not config_data:
         return {}
     try:
         return config_data.json()
     except Exception as e:
         _log.error('Error in fetching {}. Error: {}'.format(config_url, e))
         return {}
示例#4
0
 def fetch_pending_and_inprogress_builds(cls, builder_full_name):
     builderid = Buildbot.builder_name_to_id_mapping.get(builder_full_name)
     if not builderid:
         _log.error('Invalid builder: {}'.format(builder_full_name))
         return {}
     url = 'https://{}/api/v2/builders/{}/buildrequests?complete=false&property=*'.format(
         config.BUILDBOT_SERVER_HOST, builderid)
     builders_data = util.fetch_data_from_url(url)
     if not builders_data:
         return {}
     return builders_data.json()
示例#5
0
 def get_builder_id_to_name_mapping(cls):
     builder_id_to_name_mapping = {}
     builder_url = 'http://{}/api/v2/builders'.format(config.BUILDBOT_SERVER_HOST)
     builders_data = util.fetch_data_from_url(builder_url)
     if not builders_data:
         return {}
     for builder in builders_data.json().get('builders', []):
         builder_id = builder['builderid']
         builder_name = builder.get('name')
         display_name = builder.get('description')
         if not display_name:
             display_name = Buildbot._get_display_name_from_builder_name(builder_name)
         builder_id_to_name_mapping[builder_id] = {'builder_name': builder_name, 'display_name': display_name}
     return builder_id_to_name_mapping
示例#6
0
    def fetch_pending_and_inprogress_builds(cls, builder_full_name):
        builderid = Buildbot.builder_name_to_id_mapping.get(builder_full_name)
        if not Buildbot.builder_name_to_id_mapping:
            _log.warn('Missing builder_name_to_id_mapping, refetching it from {}'.format(config.BUILDBOT_SERVER_HOST))
            cls.update_builder_name_to_id_mapping()

        if not builderid:
            _log.error('Invalid builder: {}. Number of builders: {}'.format(builder_full_name, len(cls.builder_name_to_id_mapping)))
            return {}
        url = 'https://{}/api/v2/builders/{}/buildrequests?complete=false&property=*'.format(config.BUILDBOT_SERVER_HOST, builderid)
        builders_data = util.fetch_data_from_url(url)
        if not builders_data:
            return {}
        return builders_data.json()
示例#7
0
    def _fetch_attachment_json(cls, attachment_id):
        if not Patch.is_valid_patch_id(attachment_id):
            _log.warn('Invalid attachment id: "{}", skipping download.'.format(
                attachment_id))
            return None

        attachment_url = '{}rest/bug/attachment/{}'.format(
            config.BUG_SERVER_URL, attachment_id)
        attachment = util.fetch_data_from_url(attachment_url)
        if not attachment:
            return None
        attachment_json = attachment.json().get('attachments')
        if not attachment_json or len(attachment_json) == 0:
            return None
        return attachment_json.get(str(attachment_id))
示例#8
0
文件: bugzilla.py 项目: fr0l/webkit
    def _get_commit_queue_patches_from_bug(cls, bug_id):
        if not util.is_valid_id(bug_id):
            _log.warn('Invalid bug id: "{}"'.format(bug_id))
            return []

        bug_url = '{}rest/bug/{}/attachment'.format(config.BUG_SERVER_URL, bug_id)
        api_key = os.getenv('BUGZILLA_API_KEY', None)
        if api_key:
            bug_url += '?api_key={}'.format(api_key)
        bug = util.fetch_data_from_url(bug_url)
        if not bug:
            return []
        bug_json = bug.json().get('bugs')
        if not bug_json or len(bug_json) == 0:
            return []

        commit_queue_patches = []
        for patch_json in bug_json.get(str(bug_id)):
            if cls._is_patch_cq_plus(patch_json) == 1:
                commit_queue_patches.append(patch_json.get('id'))

        return commit_queue_patches