예제 #1
0
    def __init__(self, config, secrets, directory, interactive):
        self.secrets = secrets
        self.directory = directory
        self.interactive = interactive

        self.username = config["username"]
        self.orgs = config["orgs"]
        self.repo_maintainers = config["repos"]
        self.default_maintainers = config["reviewers"]
        self.trusted = config["trusted"]
        self.jenkins_repos = config["jenkins_repos"]

        self.jenkins = Jenkins(config["jenkins"], config["jenkins_job"],
                               secrets, self.username)
        self.github = GitHub(secrets["GITHUB_TOKEN"], self.username,
                             self.jenkins_repos)

        self.slack = Slack(read_token=secrets.get("SLACK_READ_TOKEN"),
                           bot_token=secrets.get("SLACK_SEND_TOKEN"),
                           app_token=secrets.get("SLACK_APP_TOKEN"),
                           username=self.username,
                           interactive=interactive)
        self.dispatcher = CommandDispatcher(self.slack)
        if 'create_pr_magic' in config["bot_features"]:
            self.github_interface = GitHubInterface(self.github, self.slack,
                                                    self.dispatcher)
        if 'update_dependencies' in config["bot_features"]:
            self.updater = UpdateChecker(self.github, self.slack,
                                         self.dispatcher, 'Lex-2008')
        if 'generate_changelogs' in config["bot_features"]:
            self.changelogger = ChangelogGenerator(self.github, self.slack,
                                                   self.dispatcher, 'Lex-2008')
예제 #2
0
    def __init__(self, config, secrets, directory, interactive):
        self.secrets = secrets
        self.directory = directory
        self.interactive = interactive

        self.username = config["username"]
        self.orgs = config["orgs"]
        self.repo_maintainers = config["repos"]
        self.default_maintainers = config["reviewers"]
        self.trusted = config["trusted"]

        self.jenkins = Jenkins(config["jenkins"], config["jenkins_job"], secrets)
        self.github = GitHub(secrets["GITHUB_TOKEN"])

        self.slack = None
        try:
            self.slack_read_token = secrets["SLACK_READ_TOKEN"]
            bot_token = secrets["SLACK_SEND_TOKEN"]
            app_token = secrets["SLACK_APP_TOKEN"]
            self.slack = Slack(bot_token, app_token)

            self.dispatcher = CommandDispatcher(self.slack)
            self.github_interface = GitHubInterface(self.github, self.slack, self.dispatcher)
            # self.updater = UpdateChecker(self.github, self.slack, self.dispatcher)
        except KeyError:
            log.info("Skipping slack integration, secrets missing")
예제 #3
0
    def __init__(self, config, secrets, directory, interactive, reports):
        self.secrets = secrets
        self.directory = directory
        self.interactive = interactive
        self.reports = reports

        self.bot_features = config["bot_features"]

        self.username = config["username"]
        self.orgs = config.get("orgs", [])
        self.repo_maintainers = config.get("repos", {})
        self.default_maintainers = config.get("reviewers", [])
        self.trusted = config.get("trusted", [])
        self.jenkins_repos = config.get("jenkins_repos", [])
        banned_emails = config.get("banned_emails", {})
        self.banned_emails = [v for v in banned_emails.values()]

        self.jenkins = None
        if "jenkins" in config:
            self.jenkins = Jenkins(config["jenkins"], config["jenkins_job"],
                                   secrets, self.username)

        self.github = GitHub(secrets["GITHUB_TOKEN"], self.username,
                             self.jenkins_repos)

        self.slack = None
        self.dispatcher = None
        if secrets.get("SLACK_READ_TOKEN"):
            self.slack = Slack(read_token=secrets.get("SLACK_READ_TOKEN"),
                               bot_token=secrets.get("SLACK_SEND_TOKEN"),
                               app_token=secrets.get("SLACK_APP_TOKEN"),
                               username=self.username,
                               interactive=interactive)
            self.dispatcher = CommandDispatcher(self.slack)

            if 'create_prs_from_slack' in self.bot_features:
                self.github_interface = GitHubInterface(
                    self.github, self.slack, self.dispatcher)
            if 'update_dependencies' in self.bot_features:
                self.updater = UpdateChecker(self.github, self.slack,
                                             self.dispatcher, 'Lex-2008')
            if 'generate_changelogs' in self.bot_features:
                self.changelogger = ChangelogGenerator(self.github, self.slack,
                                                       self.dispatcher,
                                                       'Lex-2008')
            if 'map_packages' in self.bot_features:
                self.package_mapper = PackageMapper(self.github, self.slack,
                                                    self.dispatcher,
                                                    'Lex-2008')
            if 'tag_builds' in self.bot_features:
                self.tagger = Tagger(self.github, self.slack, self.dispatcher,
                                     'Lex-2008')