From 4d989c64ce2793ef05984525596c2a3f47b0c1fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Fri, 8 Nov 2024 09:39:49 +0100 Subject: [PATCH] [MIG] github_connector: Migration to 17.0 TT51638 --- github_connector/README.rst | 70 +++--- github_connector/__manifest__.py | 2 +- github_connector/i18n/es.po | 6 - .../models/abstract_github_model.py | 3 +- github_connector/models/github_repository.py | 7 +- .../models/github_repository_branch.py | 2 +- github_connector/readme/USAGE.md | 34 +-- ...thub_repository_branch_rule_info_report.py | 8 +- github_connector/security/ir.model.access.csv | 20 +- .../static/description/index.html | 215 ++++++++++-------- github_connector/tests/common.py | 11 +- .../tests/test_github_analysis_rule.py | 25 +- .../tests/test_github_connector.py | 15 +- .../views/view_github_organization.xml | 18 +- .../views/view_github_repository.xml | 13 +- .../views/view_github_repository_branch.xml | 26 +-- github_connector/views/view_github_team.xml | 4 +- .../views/view_github_team_partner.xml | 7 +- .../views/view_github_team_repository.xml | 7 +- github_connector/views/view_res_partner.xml | 10 +- .../wizards/view_wizard_create_repository.xml | 11 +- .../wizards/view_wizard_create_team.xml | 19 +- .../wizards/view_wizard_load_github_model.xml | 3 +- test-requirements.txt | 1 + 24 files changed, 264 insertions(+), 273 deletions(-) create mode 100644 test-requirements.txt diff --git a/github_connector/README.rst b/github_connector/README.rst index 312b7b97..ce87fd0d 100644 --- a/github_connector/README.rst +++ b/github_connector/README.rst @@ -122,18 +122,18 @@ To fetch information from Github, you have to: 2. Select the object type you want to synchronize and its Gthub name - |image| + |sync_organization| 3. Once done for your organization(s), go to 'Github' / 'Github Commnunity' / 'Organizations' - |image1| + |github_organization_kanban| 4. Optionally, once organization is created, you can create series for your projects. Go to 'Github' / 'Organizations' / click on your organization / 'Organization Series' Tabs - |image2| + |github_organization_series| Select branches to download --------------------------- @@ -148,13 +148,13 @@ only main branches (releases): 2. In the 'Settings' tab, set the URL of the 'External Services' you use for Continuous Integration and Coverage. - |image3| + |github_organization_external_services| 3. Once done, click on buttons 'Syncs', to synchronize repositories, teams and members. (This process can take a while depending of your size) - |image4| + |github_organization_sync_buttons| Team / members synchronization ------------------------------ @@ -163,17 +163,17 @@ You can synchronize members teams: 1. Go to 'Teams' / tree view / 'Actions' / 'Update from Github'. - |image5| + |github_team_kanban| 2. In each team, you can see the members list and the role of the members - |image6| + |github_team_partner_kanban| 3. In each team, you can see the repositories list but not the permissions of the team. (See 'Known Issues' Section) - |image7| + |github_team_repository_kanban| Repositories synchronization ---------------------------- @@ -182,12 +182,12 @@ You can synchronize the branches of your repositories: 1. Go to 'Repositories' / tree view / 'Actions' / 'Update from Github' - |image8| + |github_repository_kanban| 2. In each repository, you can see the main branches list and the size of code source. - |image9| + |github_repository_branch_kanban| Fetching the source code ------------------------ @@ -197,12 +197,12 @@ Finally, you can download locally the source code of all your branches: 1. Go to 'Repository Branches' / tree view / 'Actions' / 'Download and Analyse Source Code'. - |image10| + |wizard_download_analyze| 2. In the tree view you can update manually source code or refresh analysis. - |image11| + |github_repository_branch_list| Analysis source code -------------------- @@ -257,14 +257,14 @@ Odoo 4. Later on, a synchronization will be performed, to create the according team in the Odoo instance. - |image12| + |wizard_create_team| 2. Repositories: 1. Go to 'Settings' / 'Create Team in Github'. 2. Set the information and click on Create in Github. - |image13| + |wizard_create_repository| Note ---- @@ -285,33 +285,33 @@ This module provides several reports **Branches by Serie** -|image14| +|reporting_branches_by_serie| **Sizes by Serie** -|image15| +|reporting_sizes_by_serie| **Repository branch analysis rule** -|image16| - -.. |image| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/sync_organization.png -.. |image1| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_organization_kanban.png -.. |image2| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_organization_series.png -.. |image3| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_organization_external_services.png -.. |image4| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_organization_sync_buttons.png -.. |image5| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_team_kanban.png -.. |image6| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_team_partner_kanban.png -.. |image7| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_team_repository_kanban.png -.. |image8| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_repository_kanban.png -.. |image9| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_repository_branch_kanban.png -.. |image10| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/wizard_download_analyze.png -.. |image11| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_repository_branch_list.png -.. |image12| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/wizard_create_team.png -.. |image13| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/wizard_create_repository.png -.. |image14| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/reporting_branches_by_serie.png -.. |image15| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/reporting_sizes_by_serie.png -.. |image16| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_repository_branch_rule_info_report.png +|github_repository_branch_rule_info_report| + +.. |sync_organization| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/sync_organization.png +.. |github_organization_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_organization_kanban.png +.. |github_organization_series| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_organization_series.png +.. |github_organization_external_services| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_organization_external_services.png +.. |github_organization_sync_buttons| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_organization_sync_buttons.png +.. |github_team_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_team_kanban.png +.. |github_team_partner_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_team_partner_kanban.png +.. |github_team_repository_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_team_repository_kanban.png +.. |github_repository_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_repository_kanban.png +.. |github_repository_branch_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_repository_branch_kanban.png +.. |wizard_download_analyze| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/wizard_download_analyze.png +.. |github_repository_branch_list| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_repository_branch_list.png +.. |wizard_create_team| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/wizard_create_team.png +.. |wizard_create_repository| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/wizard_create_repository.png +.. |reporting_branches_by_serie| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/reporting_branches_by_serie.png +.. |reporting_sizes_by_serie| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/reporting_sizes_by_serie.png +.. |github_repository_branch_rule_info_report| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_repository_branch_rule_info_report.png Known issues / Roadmap ====================== diff --git a/github_connector/__manifest__.py b/github_connector/__manifest__.py index bbcef258..26d9b2fd 100644 --- a/github_connector/__manifest__.py +++ b/github_connector/__manifest__.py @@ -7,7 +7,7 @@ { "name": "Github Connector", "summary": "Synchronize information from Github repositories", - "version": "16.0.1.0.0", + "version": "17.0.1.0.0", "category": "Connector", "license": "AGPL-3", "author": "Odoo Community Association (OCA), GRAP, Akretion, Tecnativa", diff --git a/github_connector/i18n/es.po b/github_connector/i18n/es.po index cc755458..3cba85e0 100644 --- a/github_connector/i18n/es.po +++ b/github_connector/i18n/es.po @@ -1457,9 +1457,3 @@ msgstr "o" #, python-format msgid "source_code_local_path should be defined in your configuration file" msgstr "source_code_local_path debe definirse en su archivo de configuración" - -#~ msgid "# String" -#~ msgstr "# Cadena" - -#~ msgid "Total string" -#~ msgstr "Total cadena" diff --git a/github_connector/models/abstract_github_model.py b/github_connector/models/abstract_github_model.py index 9d03a415..6e4d2702 100644 --- a/github_connector/models/abstract_github_model.py +++ b/github_connector/models/abstract_github_model.py @@ -200,7 +200,8 @@ def create_from_name(self, name): else: try: # Try to get an organization 1st. - # An organization is always an user, but a user is not necessarily an org. + # An organization is always an user, but a user is not necessarily + # an org. gh_obj = gh_api.get_organization(p_name) except UnknownObjectException: # Try to get an user. diff --git a/github_connector/models/github_repository.py b/github_connector/models/github_repository.py index b2ef7211..2b715df8 100644 --- a/github_connector/models/github_repository.py +++ b/github_connector/models/github_repository.py @@ -108,11 +108,8 @@ def _compute_team_qty(self): @api.depends("name", "organization_id.github_name") def _compute_complete_name(self): for repository in self: - repository.complete_name = "%(login)s/%(rep_name)s" % ( - { - "login": repository.organization_id.github_name, - "rep_name": repository.name or "", - } + repository.complete_name = "{}/{}".format( + repository.organization_id.github_name, repository.name or "" ) @api.depends("repository_branch_ids.repository_id") diff --git a/github_connector/models/github_repository_branch.py b/github_connector/models/github_repository_branch.py index 5ee8885b..244517c7 100644 --- a/github_connector/models/github_repository_branch.py +++ b/github_connector/models/github_repository_branch.py @@ -179,7 +179,7 @@ def _download_code(self): ) % (branch.local_path) ) from None - command = ("git clone %s -b %s %s") % ( + command = ("git clone {} -b {} {}").format( gh_repo.clone_url, branch.name, branch.local_path, diff --git a/github_connector/readme/USAGE.md b/github_connector/readme/USAGE.md index 478ad88c..f666e6af 100644 --- a/github_connector/readme/USAGE.md +++ b/github_connector/readme/USAGE.md @@ -6,18 +6,18 @@ To fetch information from Github, you have to: 2. Select the object type you want to synchronize and its Gthub name - ![image](../static/description/sync_organization.png) + ![sync_organization](static/description/sync_organization.png) 3. Once done for your organization(s), go to 'Github' / 'Github Commnunity' / 'Organizations' - ![image](../static/description/github_organization_kanban.png) + ![github_organization_kanban](static/description/github_organization_kanban.png) 4. Optionally, once organization is created, you can create series for your projects. Go to 'Github' / 'Organizations' / click on your organization / 'Organization Series' Tabs - ![image](../static/description/github_organization_series.png) + ![github_organization_series](static/description/github_organization_series.png) ## Select branches to download @@ -31,13 +31,13 @@ only main branches (releases): 2. In the 'Settings' tab, set the URL of the 'External Services' you use for Continuous Integration and Coverage. - ![image](../static/description/github_organization_external_services.png) + ![github_organization_external_services](static/description/github_organization_external_services.png) 3. Once done, click on buttons 'Syncs', to synchronize repositories, teams and members. (This process can take a while depending of your size) - ![image](../static/description/github_organization_sync_buttons.png) + ![github_organization_sync_buttons](static/description/github_organization_sync_buttons.png) ## Team / members synchronization @@ -45,17 +45,17 @@ You can synchronize members teams: 1. Go to 'Teams' / tree view / 'Actions' / 'Update from Github'. - ![image](../static/description/github_team_kanban.png) + ![github_team_kanban](static/description/github_team_kanban.png) 2. In each team, you can see the members list and the role of the members - ![image](../static/description/github_team_partner_kanban.png) + ![github_team_partner_kanban](static/description/github_team_partner_kanban.png) 3. In each team, you can see the repositories list but not the permissions of the team. (See 'Known Issues' Section) - ![image](../static/description/github_team_repository_kanban.png) + ![github_team_repository_kanban](static/description/github_team_repository_kanban.png) ## Repositories synchronization @@ -63,12 +63,12 @@ You can synchronize the branches of your repositories: 1. Go to 'Repositories' / tree view / 'Actions' / 'Update from Github' - ![image](../static/description/github_repository_kanban.png) + ![github_repository_kanban](static/description/github_repository_kanban.png) 2. In each repository, you can see the main branches list and the size of code source. - ![image](../static/description/github_repository_branch_kanban.png) + ![github_repository_branch_kanban](static/description/github_repository_branch_kanban.png) ## Fetching the source code @@ -77,12 +77,12 @@ Finally, you can download locally the source code of all your branches: 1. Go to 'Repository Branches' / tree view / 'Actions' / 'Download and Analyse Source Code'. - ![image](../static/description/wizard_download_analyze.png) + ![wizard_download_analyze](static/description/wizard_download_analyze.png) 2. In the tree view you can update manually source code or refresh analysis. - ![image](../static/description/github_repository_branch_list.png) + ![github_repository_branch_list](static/description/github_repository_branch_list.png) ## Analysis source code @@ -133,14 +133,14 @@ Odoo 4. Later on, a synchronization will be performed, to create the according team in the Odoo instance. - ![image](../static/description/wizard_create_team.png) + ![wizard_create_team](static/description/wizard_create_team.png) 2. Repositories: 1. Go to 'Settings' / 'Create Team in Github'. 2. Set the information and click on Create in Github. - ![image](../static/description/wizard_create_repository.png) + ![wizard_create_repository](static/description/wizard_create_repository.png) ## Note @@ -159,12 +159,12 @@ This module provides several reports **Branches by Serie** -![image](../static/description/reporting_branches_by_serie.png) +![reporting_branches_by_serie](static/description/reporting_branches_by_serie.png) **Sizes by Serie** -![image](../static/description/reporting_sizes_by_serie.png) +![reporting_sizes_by_serie](static/description/reporting_sizes_by_serie.png) **Repository branch analysis rule** -![image](../static/description/github_repository_branch_rule_info_report.png) +![github_repository_branch_rule_info_report](static/description/github_repository_branch_rule_info_report.png) diff --git a/github_connector/report/github_repository_branch_rule_info_report.py b/github_connector/report/github_repository_branch_rule_info_report.py index 0b1c1bb9..a64054e3 100644 --- a/github_connector/report/github_repository_branch_rule_info_report.py +++ b/github_connector/report/github_repository_branch_rule_info_report.py @@ -38,7 +38,7 @@ class GithubRepositoryBranchRuleInfoReport(models.Model): @property def _table_query(self): - return "%s %s %s" % (self._select(), self._from(), self._group_by()) + return f"{self._select()} {self._from()} {self._group_by()}" @api.model def _select(self): @@ -63,8 +63,10 @@ def _from(self): FROM github_repository_branch_rule_info as grbri LEFT JOIN github_analysis_rule as gar ON grbri.analysis_rule_id = gar.id LEFT JOIN github_analysis_rule_group as garg ON gar.group_id = garg.id - LEFT JOIN github_repository_branch as grb ON grbri.repository_branch_id = grb.id - LEFT JOIN github_organization_serie as gos ON grb.organization_serie_id = gos.id + LEFT JOIN github_repository_branch as grb + ON grbri.repository_branch_id = grb.id + LEFT JOIN github_organization_serie as gos + ON grb.organization_serie_id = gos.id LEFT JOIN github_repository as gr ON grb.repository_id = gr.id """ diff --git a/github_connector/security/ir.model.access.csv b/github_connector/security/ir.model.access.csv index d5b09dcd..1758d06e 100644 --- a/github_connector/security/ir.model.access.csv +++ b/github_connector/security/ir.model.access.csv @@ -1,22 +1,22 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_github_analysis_rule_reader,github_analysis_rule reader,model_github_analysis_rule,,1,0,0,0 +access_github_analysis_rule_reader,github_analysis_rule reader,model_github_analysis_rule,base.group_user,1,0,0,0 access_github_analysis_rule_manager,github_analysis_rule manager,model_github_analysis_rule,github_connector.group_github_connector_manager,1,1,1,1 -access_github_analysis_rule_group_reader,github_analysis_rule_group reader,model_github_analysis_rule_group,,1,0,0,0 +access_github_analysis_rule_group_reader,github_analysis_rule_group reader,model_github_analysis_rule_group,base.group_user,1,0,0,0 access_github_analysis_rule_group_manager,github_analysis_rule_group manager,model_github_analysis_rule_group,github_connector.group_github_connector_manager,1,1,1,1 -access_github_organization_reader,github_organization reader,model_github_organization,,1,0,0,0 +access_github_organization_reader,github_organization reader,model_github_organization,base.group_user,1,0,0,0 access_github_organization_manager,github_organization manager,model_github_organization,github_connector.group_github_connector_manager,1,1,1,1 -access_github_organization_serie_reader,github_organization_serie reader,model_github_organization_serie,,1,0,0,0 +access_github_organization_serie_reader,github_organization_serie reader,model_github_organization_serie,base.group_user,1,0,0,0 access_github_organization_serie_manager,github_organization_serie manager,model_github_organization_serie,github_connector.group_github_connector_manager,1,1,1,1 -access_github_repository_branch_rule_info_report_reader,github_repository_branch_rule_info_report reader,model_github_repository_branch_rule_info_report,,1,0,0,0 -access_github_repository_reader,github_repository reader,model_github_repository,,1,0,0,0 +access_github_repository_branch_rule_info_report_reader,github_repository_branch_rule_info_report reader,model_github_repository_branch_rule_info_report,base.group_user,1,0,0,0 +access_github_repository_reader,github_repository reader,model_github_repository,base.group_user,1,0,0,0 access_github_repository_manager,github_repository manager,model_github_repository,github_connector.group_github_connector_manager,1,1,1,1 -access_github_repository_branch_reader,github_repository_branch reader,model_github_repository_branch,,1,0,0,0 +access_github_repository_branch_reader,github_repository_branch reader,model_github_repository_branch,base.group_user,1,0,0,0 access_github_repository_branch_manager,github_repository_branch manager,model_github_repository_branch,github_connector.group_github_connector_manager,1,1,1,1 -access_github_team_reader,github_team reader,model_github_team,,1,0,0,0 +access_github_team_reader,github_team reader,model_github_team,base.group_user,1,0,0,0 access_github_team_manager,github_team manager,model_github_team,github_connector.group_github_connector_manager,1,1,1,1 -access_github_team_partner_reader,github_team partner reader,model_github_team_partner,,1,0,0,0 +access_github_team_partner_reader,github_team partner reader,model_github_team_partner,base.group_user,1,0,0,0 access_github_team_partner_manager,github_team partner manager,model_github_team_partner,github_connector.group_github_connector_manager,1,1,1,1 -access_github_team_repository_reader,github_team repository reader,model_github_team_repository,,1,0,0,0 +access_github_team_repository_reader,github_team repository reader,model_github_team_repository,base.group_user,1,0,0,0 access_github_team_repository_manager,github_team repository manager,model_github_team_repository,github_connector.group_github_connector_manager,1,1,1,1 access_github_repository_branch_rule_info_reader,access_github_repository_branch_rule_info_reader,model_github_repository_branch_rule_info,base.group_user,1,0,0,0 access_github_repository_branch_rule_info_manager,access_github_repository_branch_rule_info_manager,model_github_repository_branch_rule_info,github_connector.group_github_connector_manager,1,1,1,1 diff --git a/github_connector/static/description/index.html b/github_connector/static/description/index.html index b7df7465..0cc358ae 100644 --- a/github_connector/static/description/index.html +++ b/github_connector/static/description/index.html @@ -1,4 +1,3 @@ - @@ -9,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -275,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -301,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -369,10 +369,11 @@

Github Connector

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:df4fa6792f06fd7d9b20f54ccf746dc12bf3a42e7ee7f1af4791741969df2f47 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/interface-github Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/interface-github Translate me on Weblate Try me on Runboat

This module allows you to: