Пример #1
0
    def run(
        self,
        installation_id,
        installation_token,
        event_type,
        data,
        pull,
        missing_conditions,
    ):
        pull.log.debug("process merge", config=self.config)

        output = helpers.merge_report(pull, self.config["strict"])
        if output:
            if self.config["strict"] == "smart":
                queue.remove_pull(pull)
            return output

        if self.config["strict"] and pull.is_behind():
            return self._sync_with_base_branch(pull, installation_id)
        else:
            try:
                return self._merge(pull, installation_id)
            finally:
                if self.config["strict"] == "smart":
                    queue.remove_pull(pull)
Пример #2
0
    def cancel(self, ctxt, sources, missing_conditions):
        # We just rebase the pull request, don't cancel it yet if CIs are
        # running. The pull request will be merge if all rules match again.
        # if not we will delete it when we received all CIs termination
        if self.config["strict"] and self._required_statuses_in_progress(
                ctxt, missing_conditions):
            return helpers.get_wait_for_ci_report(ctxt)

        if self.config["strict"] == "smart":
            queue.remove_pull(ctxt)

        return self.cancelled_check_report
Пример #3
0
    def cancel(self, installation_id, installation_token, event_type, data,
               pull, missing_conditions):
        # We just rebase the pull request, don't cancel it yet if CIs are
        # running. The pull request will be merge if all rules match again.
        # if not we will delete it when we received all CIs termination
        if self.config["strict"] and self._required_statuses_in_progress(
                pull, missing_conditions):
            return

        if self.config["strict"] == "smart":
            queue.remove_pull(pull)

        return self.cancelled_check_report
Пример #4
0
    def run(self, pull, sources, missing_conditions):
        pull.log.debug("process merge", config=self.config)

        output = helpers.merge_report(pull, self.config["strict"])
        if output:
            if self.config["strict"] == "smart":
                queue.remove_pull(pull)
            return output

        if self.config["strict"] and pull.is_behind:
            return self._sync_with_base_branch(pull)
        else:
            try:
                return self._merge(pull)
            finally:
                if self.config["strict"] == "smart":
                    queue.remove_pull(pull)
Пример #5
0
    def run(self, installation_id, installation_token, event_type, data, pull,
            missing_conditions):
        LOG.debug("process merge", config=self.config, pull=pull)

        output = helpers.merge_report(pull)
        if output:
            return output

        output = helpers.output_for_mergeable_state(pull,
                                                    self.config["strict"])
        if output:
            return output

        if self.config["strict"] and pull.is_behind():
            # NOTE(sileht): Almost ready, one last rebase/update

            if not pull.base_is_modifiable():
                return ("failure", "Pull request can't be updated with latest "
                        "base branch changes, owner doesn't allow "
                        "modification", "")
            elif self.config["strict"] == "smart":
                queue.add_pull(pull, self.config["strict_method"])
                return (None, "Base branch will be updated soon",
                        "The pull request base branch will "
                        "be updated soon, and then merged.")
            else:
                return helpers.update_pull_base_branch(
                    pull, installation_id, self.config["strict_method"])
        else:

            # NOTE(sileht): Ready to merge!

            if self.config["strict"] == "smart":
                queue.remove_pull(pull)

            if (self.config["method"] != "rebase"
                    or pull.g_pull.raw_data['rebaseable']):
                return self._merge(pull, self.config["method"])
            elif self.config["rebase_fallback"]:
                return self._merge(pull, self.config["rebase_fallback"])
            else:
                return ("action_required", "Automatic rebasing is not "
                        "possible, manual intervention required", "")