Beispiel #1
0
    def should_use_taskcluster(self):
        """
        Returns True if taskcluster should be used as the bisection method.

        Note that this method relies on the repo and build type defined.
        """
        return (branches.get_category(self.repo) == 'integration'
                or self.is_b2g_device()
                or self.build_type != 'opt')
    def should_use_taskcluster(self):
        """
        Returns True if taskcluster should be used as the bisection method.

        Note that this method relies on the repo and build type defined.
        """
        return (branches.get_category(self.repo) in ('integration', 'try') or
                # we can find the asan builds (firefox and jsshell) in
                # archives.m.o
                self.build_type not in ('opt', 'asan'))
    def should_use_taskcluster(self):
        """
        Returns True if taskcluster should be used as the bisection method.

        Note that this method relies on the repo and build type defined.
        """
        return (
            branches.get_category(self.repo) in ('integration', 'try') or
            # we can find the asan builds (firefox and jsshell) in
            # archives.m.o
            self.build_type not in ('opt', 'asan'))
Beispiel #4
0
    def should_use_archive(self):
        """
        Returns True if we should use the archive as an initial bisection
        method (archive.mozilla.org has a much longer retention period than
        taskcluster).

        Note that this method relies on the repo and build type defined.
        """
        # we can find the asan builds (firefox and jsshell) in archives.m.o
        return not (branches.get_category(
            self.repo) in ("integration", "try", "releases")
                    or self.build_type not in ("opt", "asan", "shippable"))
Beispiel #5
0
def test_get_category(name, expected):
    assert branches.get_category(name) == expected
Beispiel #6
0
    def handle_merge(self):
        # let's check if we are facing a merge, and in that case,
        # continue the bisection from the merged branch.
        result = None

        LOG.debug("Starting merge handling...")
        # we have to check the commit of the most recent push
        most_recent_push = self.build_range[1]
        jp = JsonPushes(most_recent_push.repo_name)
        push = jp.push(most_recent_push.changeset, full='1')
        msg = push.changeset['desc']
        LOG.debug("Found commit message:\n%s\n" % msg)
        branch = find_branch_in_merge_commit(msg)
        if not (branch and len(push.changesets) >= 2):
            # So we did not found a branch. Let's try with inbound anyway
            if get_category(most_recent_push.repo_name) != 'integration' and \
               len(push.changesets) >= 2:
                jp2 = JsonPushes("mozilla-inbound")
                try:
                    data = jp2.pushes_within_changes(
                        push.changesets[0]['node'],
                        push.changesets[-1]['node'])
                except MozRegressionError:
                    return
                LOG.info("************* Switching to mozilla-inbound by"
                         " default (no branch detected in commit message)")
                return ('mozilla-inbound',
                        data[0].changeset, data[-1].changeset)
            else:
                return
        try:
            # so, this is a merge. We can find the oldest and youngest
            # changesets, and the branch where the merge comes from.
            oldest = push.changesets[0]['node']
            # exclude the merge commit
            youngest = push.changesets[-2]['node']
            LOG.debug("This is a merge from %s" % branch)

            # we can't use directly the youngest changeset because we
            # don't know yet if it is good.
            #
            # PUSH1    PUSH2
            # [1 2] [3 4 5 6 7]
            #    G    MERGE  B
            #
            # so first, grab it. This needs to be done on the right branch.
            jp2 = JsonPushes(branch)
            raw = [int(p.push_id) for p in
                   jp2.pushes_within_changes(oldest, youngest)]
            data = jp2.pushes(
                startID=str(min(raw) - 2),
                endID=str(max(raw)),
            )

            oldest = data[0].changesets[0]
            youngest = data[-1].changesets[-1]

            # we are ready to bisect further
            LOG.info("************* Switching to %s" % branch)
            gr, br = self._reverse_if_find_fix(oldest, youngest)
            result = (branch, gr, br)
        except MozRegressionError:
            LOG.debug("Got exception", exc_info=True)
            raise MozRegressionError(
                "Unable to exploit the merge commit. Origin branch is {}, and"
                " the commit message for {} was:\n{}".format(
                    most_recent_push.repo_name,
                    most_recent_push.short_changeset,
                    msg
                )
            )
        LOG.debug('End merge handling')
        return result
Beispiel #7
0
def test_get_category(name, expected):
    assert branches.get_category(name) == expected
Beispiel #8
0
    def handle_merge(self):
        # let's check if we are facing a merge, and in that case,
        # continue the bisection from the merged branch.
        result = None

        LOG.debug("Starting merge handling...")
        # we have to check the commit of the most recent push
        most_recent_push = self.build_range[1]
        jp = JsonPushes(most_recent_push.repo_name)
        push = jp.push(most_recent_push.changeset, full='1')
        msg = push.changeset['desc']
        LOG.debug("Found commit message:\n%s\n" % msg)
        branch = find_branch_in_merge_commit(msg)
        if not (branch and len(push.changesets) >= 2):
            # So we did not found a branch. Let's try with inbound anyway
            if get_category(most_recent_push.repo_name) != 'integration' and \
               len(push.changesets) >= 2:
                jp2 = JsonPushes("mozilla-inbound")
                try:
                    data = jp2.pushes_within_changes(
                        push.changesets[0]['node'],
                        push.changesets[-1]['node'])
                except MozRegressionError:
                    return
                LOG.info("************* Switching to mozilla-inbound by"
                         " default (no branch detected in commit message)")
                return ('mozilla-inbound', data[0].changeset,
                        data[-1].changeset)
            else:
                return
        try:
            # so, this is a merge. We can find the oldest and youngest
            # changesets, and the branch where the merge comes from.
            oldest = push.changesets[0]['node']
            # exclude the merge commit
            youngest = push.changesets[-2]['node']
            LOG.debug("This is a merge from %s" % branch)

            # we can't use directly the youngest changeset because we
            # don't know yet if it is good.
            #
            # PUSH1    PUSH2
            # [1 2] [3 4 5 6 7]
            #    G    MERGE  B
            #
            # so first, grab it. This needs to be done on the right branch.
            jp2 = JsonPushes(branch)
            raw = [
                int(p.push_id)
                for p in jp2.pushes_within_changes(oldest, youngest)
            ]
            data = jp2.pushes(
                startID=str(min(raw) - 2),
                endID=str(max(raw)),
            )

            oldest = data[0].changesets[0]
            youngest = data[-1].changesets[-1]

            # we are ready to bisect further
            LOG.info("************* Switching to %s" % branch)
            gr, br = self._reverse_if_find_fix(oldest, youngest)
            result = (branch, gr, br)
        except MozRegressionError:
            LOG.debug("Got exception", exc_info=True)
            raise MozRegressionError(
                "Unable to exploit the merge commit. Origin branch is {}, and"
                " the commit message for {} was:\n{}".format(
                    most_recent_push.repo_name,
                    most_recent_push.short_changeset, msg))
        LOG.debug('End merge handling')
        return result