Ejemplo n.º 1
0
    def find_open_release_issues(self):
        """
        Looks for opened release issues on github
        :return: True on found, False if not found
        """
        release_issues = {}
        latest_version = Version(self.github.latest_release())
        opened_issues = self.project.get_issue_list(IssueStatus.open)
        if not opened_issues:
            self.logger.debug(f'No more open issues found')
        else:
            for issue in opened_issues:
                match, version = process_version_from_title(
                    issue.title, latest_version)
                if match:
                    if self.project.can_close_issue(which_username(self.conf),
                                                    issue):
                        release_issues[version] = issue
                        self.logger.info(
                            f'Found new release issue with version: {version}')
                    else:
                        self.logger.warning(
                            f"User {which_username(self.conf)} "
                            f"has no permission to modify issue")

        if len(release_issues) > 1:
            msg = f'Multiple release issues are open {release_issues}, please reduce them to one'
            self.logger.error(msg)
            return False
        if len(release_issues) == 1:
            if which_service(self.project) == GitService.Github:
                labels = self.new_release.labels
            elif which_service(self.project) == GitService.Pagure:
                # Putting labels on Pagure issues is not implemented yet inside ogr-lib
                labels = None

            for version, issue in release_issues.items():
                self.new_pr.update_new_pr_details(version=version,
                                                  issue_id=None,
                                                  issue_number=issue.id,
                                                  labels=labels)
                return True
        else:
            return False
Ejemplo n.º 2
0
 def test_which_username(self):
     git_username = which_username(self.release_bot.conf)
     assert git_username == self.github_user
     assert git_username == self.release_bot.conf.github_username