Beispiel #1
0
def parse_buildbot_message(payload):
    """Parse incoming buildbot pulse message.

    Args:
        payload (kombu.Message.body): the pulse message payload
    Returns:
        dict: all the task information needed to submit a partial
            mar generation task.

    This is extracted from the previous incarnation, which only
    understood buildbot messages. The relevant details are all
    in the pulse message, so just need to be extracted.
    """
    graph_data = dict()

    buildername = payload["build"]["builderName"]
    if not interesting_buildername(buildername):
        log.debug("Ignoring %s: not interested", buildername)
        return

    job_result = payload["results"]
    if job_result != 0:
        log.debug("Ignoring %s with result %s", buildername, job_result)
        return

    properties = properties_to_dict(payload["build"]["properties"])

    # try to guess chunk number, last digit in the buildername
    try:
        graph_data['chunk_name'] = int(buildername.split("-")[-1])
    except ValueError:
        # undefined (en-US) use 0
        graph_data['chunk_name'] = "en-US"

    if "locales" in properties:
        log.debug("L10N repack detected")
        funsize_info = json.loads(properties['funsize_info'])
        locales = json.loads(properties['locales'])
        graph_data['locales'] = [
            locale for locale, result in locales.iteritems()
            if str(result).lower() == 'success' or str(result) == '0'
        ]
        graph_data['mar_urls'] = funsize_info['completeMarUrls']
        graph_data['platform'] = funsize_info["platform"]
        graph_data['branch'] = funsize_info["branch"]
        graph_data['product'] = funsize_info["appName"]
        graph_data['mar_signing_format'] = funsize_info.get(
            'mar_signing_format', 'mar')
        graph_data['revision'] = properties['revision']
    else:
        graph_data['locales'] = ['en-US']
        graph_data['mar_urls'] = {'en-US': properties['completeMarUrl']}
        graph_data['platform'] = properties['platform']
        graph_data['branch'] = properties['branch']
        graph_data['product'] = properties['appName']
        graph_data['revision'] = properties['revision']
        graph_data['mar_signing_format'] = properties.get(
            'mar_signing_format', 'mar')

    return graph_data
Beispiel #2
0
def parse_buildbot_message(payload):
    """Parse incoming buildbot pulse message.

    Args:
        payload (kombu.Message.body): the pulse message payload
    Returns:
        dict: all the task information needed to submit a partial
            mar generation task.

    This is extracted from the previous incarnation, which only
    understood buildbot messages. The relevant details are all
    in the pulse message, so just need to be extracted.
    """
    graph_data = dict()

    buildername = payload["build"]["builderName"]
    if not interesting_buildername(buildername):
        log.debug("Ignoring %s: not interested", buildername)
        return

    job_result = payload["results"]
    if job_result != 0:
        log.debug("Ignoring %s with result %s", buildername, job_result)
        return

    properties = properties_to_dict(payload["build"]["properties"])

    # try to guess chunk number, last digit in the buildername
    try:
        graph_data['chunk_name'] = int(buildername.split("-")[-1])
    except ValueError:
        # undefined (en-US) use 0
        graph_data['chunk_name'] = "en-US"

    if "locales" in properties:
        log.debug("L10N repack detected")
        funsize_info = json.loads(properties['funsize_info'])
        locales = json.loads(properties['locales'])
        graph_data['locales'] = [locale for locale, result in locales.iteritems()
                                 if str(result).lower() == 'success' or
                                 str(result) == '0']
        graph_data['mar_urls'] = funsize_info['completeMarUrls']
        graph_data['platform'] = funsize_info["platform"]
        graph_data['branch'] = funsize_info["branch"]
        graph_data['product'] = funsize_info["appName"]
        graph_data['mar_signing_format'] = funsize_info.get(
            'mar_signing_format', 'mar')
        graph_data['revision'] = properties['revision']
    else:
        graph_data['locales'] = ['en-US']
        graph_data['mar_urls'] = {'en-US': properties['completeMarUrl']}
        graph_data['platform'] = properties['platform']
        graph_data['branch'] = properties['branch']
        graph_data['product'] = properties['appName']
        graph_data['revision'] = properties['revision']
        graph_data['mar_signing_format'] = properties.get(
            'mar_signing_format', 'mar')

    return graph_data
Beispiel #3
0
    def dispatch_message(self, body):
        """Dispatches incoming pulse messages.
        If the method detects L10N repacks, it creates multiple Taskcluster
        tasks, otherwise a single en-US task is created.
        :type body: kombu.Message.body
        """
        payload = body["payload"]
        buildername = payload["build"]["builderName"]
        if not interesting_buildername(buildername):
            log.debug("Ignoring %s: not interested", buildername)
            return
        job_result = payload["results"]
        if job_result != 0:
            log.debug("Ignoring %s with result %s", buildername, job_result)
            return
        properties = properties_to_dict(payload["build"]["properties"])
        # try to guess chunk number, last digit in the buildername
        try:
            chunk_name = int(buildername.split("-")[-1])
        except ValueError:
            # undefined (en-US) use 0
            chunk_name = "en-US"

        if "locales" in properties:
            log.debug("L10N repack detected")
            funsize_info = json.loads(properties["funsize_info"])
            locales = json.loads(properties["locales"])
            locales = [locale for locale, result in locales.iteritems()
                       if str(result).lower() == "success" or
                       str(result) == '0']
            platform = funsize_info["platform"]
            branch = funsize_info["branch"]
            product = funsize_info["appName"]
            self.create_partials(
                product=product, branch=branch, platform=platform,
                locales=locales, revision=properties["revision"],
                chunk_name=chunk_name)
        else:
            log.debug("en-US build detected")
            self.create_partials(
                product=properties["appName"], branch=properties["branch"],
                platform=properties["platform"], locales=['en-US'],
                revision=properties["revision"], chunk_name=chunk_name)
Beispiel #4
0
 def test_truncated(self, l1, l2):
     props = [l1, l2]
     self.assertDictEqual({l2[0]: l2[1]},
                          properties_to_dict(props))
Beispiel #5
0
 def test_short(self, l1, l2):
     props = [l1, l2]
     self.assertDictEqual({l1[0]: l1[1], l2[0]: l2[1]},
                          properties_to_dict(props))
Beispiel #6
0
 def test_truncated(self, l1, l2):
     props = [l1, l2]
     self.assertDictEqual({l2[0]: l2[1]}, properties_to_dict(props))
Beispiel #7
0
 def test_short(self, l1, l2):
     props = [l1, l2]
     self.assertDictEqual({
         l1[0]: l1[1],
         l2[0]: l2[1]
     }, properties_to_dict(props))